diff --git a/Makefile.rules_generic b/Makefile.rules_generic index c417762c4..6b47a4f69 100644 --- a/Makefile.rules_generic +++ b/Makefile.rules_generic @@ -89,7 +89,14 @@ $(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 +ifeq ($(IS_PLUGIN),) +LDFLAGS += -L$(BOLOS_SDK)/target/$(TARGET) +SCRIPT_LD := $(BOLOS_SDK)/target/$(TARGET)/script.ld +else +LDFLAGS += -L$(BOLOS_SDK)/target/$(TARGET) +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/nanos/plugin_script.ld b/target/nanos/plugin_script.ld new file mode 100644 index 000000000..b76c2c15c --- /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 ethereum 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..b76c2c15c --- /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 ethereum 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..66c6279bd --- /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 ethereum 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 5ef60477f..82b459121 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. diff --git a/target/stax/plugin_script.ld b/target/stax/plugin_script.ld new file mode 100644 index 000000000..b76c2c15c --- /dev/null +++ b/target/stax/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 ethereum plugins */ +ASSERT( (_ebss - _bss) <= 0, ".bss section must be empty for plugins" ) diff --git a/target/stax/script.ld b/target/stax/script.ld index e921f4ded..19b296a05 100644 --- a/target/stax/script.ld +++ b/target/stax/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.