diff --git a/Makefile.rules_generic b/Makefile.rules_generic index 04a98a510..c2754a1af 100644 --- a/Makefile.rules_generic +++ b/Makefile.rules_generic @@ -89,7 +89,13 @@ $(OBJ_DIR)/%.o: %.S $(BUILD_DEPENDENCIES) prepare $(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@) ifeq ($(SCRIPT_LD),) -SCRIPT_LD:=$(BOLOS_SDK)/target/$(TARGET)/script.ld +LDFLAGS += -L$(BOLOS_SDK)/target/$(TARGET) +ifeq ($(IS_PLUGIN),) +SCRIPT_LD := $(BOLOS_SDK)/target/$(TARGET)/script.ld +else +SCRIPT_LD := $(BOLOS_SDK)/target/$(TARGET)/plugin_script.ld +$(info Using plugin link script: $(SCRIPT_LD)) +endif else $(info Using custom link script: $(SCRIPT_LD)) endif diff --git a/target/fatstacks/plugin_script.ld b/target/fatstacks/plugin_script.ld new file mode 100644 index 000000000..61bcc010a --- /dev/null +++ b/target/fatstacks/plugin_script.ld @@ -0,0 +1,22 @@ +/******************************************************************************* +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +********************************************************************************/ + +/* Reuse the main linker script */ +INCLUDE script.ld + +/* No global variable allowed in plugins */ +ASSERT( (_ebss - _bss) <= 0, ".bss section must be empty for plugins" ) diff --git a/target/fatstacks/script.ld b/target/fatstacks/script.ld index e921f4ded..19b296a05 100644 --- a/target/fatstacks/script.ld +++ b/target/fatstacks/script.ld @@ -1,6 +1,6 @@ /******************************************************************************* -* Ledger Blue - Secure firmware -* (c) 2016, 2017, 2018, 2019 Ledger +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/target/nanos/plugin_script.ld b/target/nanos/plugin_script.ld new file mode 100644 index 000000000..61bcc010a --- /dev/null +++ b/target/nanos/plugin_script.ld @@ -0,0 +1,22 @@ +/******************************************************************************* +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +********************************************************************************/ + +/* Reuse the main linker script */ +INCLUDE script.ld + +/* No global variable allowed in plugins */ +ASSERT( (_ebss - _bss) <= 0, ".bss section must be empty for plugins" ) diff --git a/target/nanos/script.ld b/target/nanos/script.ld index 6707f728f..88c311626 100644 --- a/target/nanos/script.ld +++ b/target/nanos/script.ld @@ -1,6 +1,6 @@ /******************************************************************************* -* Ledger Blue - Secure firmware -* (c) 2016, 2017, 2018, 2019, 2020 Ledger +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/target/nanos2/plugin_script.ld b/target/nanos2/plugin_script.ld new file mode 100644 index 000000000..61bcc010a --- /dev/null +++ b/target/nanos2/plugin_script.ld @@ -0,0 +1,22 @@ +/******************************************************************************* +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +********************************************************************************/ + +/* Reuse the main linker script */ +INCLUDE script.ld + +/* No global variable allowed in plugins */ +ASSERT( (_ebss - _bss) <= 0, ".bss section must be empty for plugins" ) diff --git a/target/nanos2/script.ld b/target/nanos2/script.ld index 47a298109..8fd537a6b 100644 --- a/target/nanos2/script.ld +++ b/target/nanos2/script.ld @@ -1,6 +1,6 @@ /******************************************************************************* -* Ledger Blue - Secure firmware -* (c) 2016, 2017, 2018, 2019 Ledger +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/target/nanox/plugin_script.ld b/target/nanox/plugin_script.ld new file mode 100644 index 000000000..1e09b06a6 --- /dev/null +++ b/target/nanox/plugin_script.ld @@ -0,0 +1,22 @@ +/******************************************************************************* +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +********************************************************************************/ + +/* Reuse the main linker script */ +INCLUDE script.ld + +/* No global variable allowed in plugins */ +ASSERT( (_ebss - _bss) <= 4, ".bss section must be empty for plugins" ) diff --git a/target/nanox/script.ld b/target/nanox/script.ld index c436449a3..c1104bf18 100644 --- a/target/nanox/script.ld +++ b/target/nanox/script.ld @@ -1,6 +1,6 @@ /******************************************************************************* -* Ledger Blue - Secure firmware -* (c) 2016, 2017, 2018, 2019 Ledger +* Ledger - Secure firmware +* (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.