diff --git a/include/arch/arc/v2/linker.ld b/include/arch/arc/v2/linker.ld index c2113e54aa3..ef4db72ae89 100644 --- a/include/arch/arc/v2/linker.ld +++ b/include/arch/arc/v2/linker.ld @@ -132,6 +132,8 @@ SECTIONS { } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rodata_end = .; MPU_ALIGN(_image_rodata_end - _image_rom_start); _image_rom_end = .; @@ -227,6 +229,7 @@ SECTIONS { #include #include +#include __data_ram_end = .; diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index 8a0852fc862..d92293a69ec 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -273,6 +273,8 @@ SECTIONS . = ALIGN(4); } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rodata_end = .; MPU_ALIGN(_image_rodata_end -_image_rom_start); _image_rom_end = .; @@ -411,6 +413,7 @@ SECTIONS #include #include +#include __data_ram_end = .; diff --git a/include/arch/arm/cortex_r/scripts/linker.ld b/include/arch/arm/cortex_r/scripts/linker.ld index e4a8e9fdaa7..0685fbd3d6c 100644 --- a/include/arch/arm/cortex_r/scripts/linker.ld +++ b/include/arch/arm/cortex_r/scripts/linker.ld @@ -272,6 +272,8 @@ SECTIONS . = ALIGN(4); } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rodata_end = .; MPU_ALIGN(_image_rodata_end -_image_rom_start); _image_rom_end = .; @@ -412,6 +414,8 @@ SECTIONS #include +#include + __data_ram_end = .; diff --git a/include/arch/nios2/linker.ld b/include/arch/nios2/linker.ld index 3b4b70899f8..cb2ecdc39d2 100644 --- a/include/arch/nios2/linker.ld +++ b/include/arch/nios2/linker.ld @@ -163,6 +163,8 @@ SECTIONS . = ALIGN(4); } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rom_end = .; __data_rom_start = ALIGN(4); /* XIP imaged DATA ROM start addr */ @@ -280,6 +282,8 @@ SECTIONS } GROUP_LINK_IN(RAMABLE_REGION) +#include + /* Define linker symbols */ _image_ram_end = .; _end = .; /* end of image */ diff --git a/include/arch/riscv/common/linker.ld b/include/arch/riscv/common/linker.ld index c429a17bb2c..753fdabf6a1 100644 --- a/include/arch/riscv/common/linker.ld +++ b/include/arch/riscv/common/linker.ld @@ -120,6 +120,8 @@ SECTIONS } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rom_end = .; __data_rom_start = .; @@ -196,6 +198,8 @@ SECTIONS } GROUP_LINK_IN(RAMABLE_REGION) +#include + _image_ram_end = .; _end = .; /* end of image */ diff --git a/include/arch/x86/ia32/linker.ld b/include/arch/x86/ia32/linker.ld index 4dd3ff4dbf8..47d08f64923 100644 --- a/include/arch/x86/ia32/linker.ld +++ b/include/arch/x86/ia32/linker.ld @@ -160,6 +160,8 @@ SECTIONS #include } GROUP_LINK_IN(ROMABLE_REGION) +#include + MMU_PAGE_ALIGN /* ROM ends here, position counter will now be in RAM areas */ _image_rom_end = .; @@ -348,6 +350,7 @@ SECTIONS #include #include +#include MMU_PAGE_ALIGN __data_ram_end = .; diff --git a/include/arch/x86/intel64/linker.ld b/include/arch/x86/intel64/linker.ld index 62e40483936..230852a5e1d 100644 --- a/include/arch/x86/intel64/linker.ld +++ b/include/arch/x86/intel64/linker.ld @@ -54,9 +54,12 @@ SECTIONS #include #endif /* CONFIG_CUSTOM_RODATA_LD */ + } GROUP_LINK_IN(ROMABLE_REGION) + +#include + _image_rodata_end = .; _image_rodata_size = _image_rodata_end - _image_rodata_start; - } GROUP_LINK_IN(ROMABLE_REGION) SECTION_PROLOGUE(_DATA_SECTION_NAME,,ALIGN(16)) { @@ -70,6 +73,7 @@ SECTIONS #include #include +#include SECTION_PROLOGUE(_BSS_SECTION_NAME, (NOLOAD), ALIGN(16)) { diff --git a/include/linker/cplusplus-ram.ld b/include/linker/cplusplus-ram.ld new file mode 100644 index 00000000000..64474e79dbd --- /dev/null +++ b/include/linker/cplusplus-ram.ld @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2019 Jan Van Winkel + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if defined (CONFIG_CPLUSPLUS) + SECTION_PROLOGUE(.gcc_except_table,,ONLY_IF_RW) + { + *(.gcc_except_table .gcc_except_table.*) + } GROUP_LINK_IN(RAMABLE_REGION) +#endif diff --git a/include/linker/cplusplus-rom.ld b/include/linker/cplusplus-rom.ld new file mode 100644 index 00000000000..bb41e50d171 --- /dev/null +++ b/include/linker/cplusplus-rom.ld @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2019 Jan Van Winkel + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if defined (CONFIG_CPLUSPLUS) + SECTION_PROLOGUE(.gcc_except_table,,ONLY_IF_RO) + { + *(.gcc_except_table .gcc_except_table.*) + } GROUP_LINK_IN(ROMABLE_REGION) +#endif diff --git a/soc/riscv/openisa_rv32m1/linker.ld b/soc/riscv/openisa_rv32m1/linker.ld index 0800b57fd08..c8e86e3f9e4 100644 --- a/soc/riscv/openisa_rv32m1/linker.ld +++ b/soc/riscv/openisa_rv32m1/linker.ld @@ -163,6 +163,8 @@ SECTIONS } GROUP_LINK_IN(ROMABLE_REGION) +#include + _image_rodata_end = .; _image_rom_end = .; @@ -202,6 +204,7 @@ SECTIONS } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) #include +#include __data_ram_end = .; __data_rom_start = LOADADDR(_DATA_SECTION_NAME);