diff --git a/include/arch/riscv32/common/linker.ld b/include/arch/riscv32/common/linker.ld index 1d37d22bf4f..78af25067b8 100644 --- a/include/arch/riscv32/common/linker.ld +++ b/include/arch/riscv32/common/linker.ld @@ -191,4 +191,10 @@ SECTIONS #include + SECTION_PROLOGUE(.riscv.attributes, 0,) + { + KEEP(*(.riscv.attributes)) + KEEP(*(.gnu.attributes)) + } + } diff --git a/soc/riscv32/openisa_rv32m1/linker.ld b/soc/riscv32/openisa_rv32m1/linker.ld index 845709d35fa..7a598de030c 100644 --- a/soc/riscv32/openisa_rv32m1/linker.ld +++ b/soc/riscv32/openisa_rv32m1/linker.ld @@ -191,6 +191,11 @@ SECTIONS #include + SECTION_PROLOGUE(.riscv.attributes, 0,) + { + KEEP(*(.riscv.attributes)) + KEEP(*(.gnu.attributes)) + } /* * Pulpino toolchains emit these sections; we don't care about them, * but need to avoid build system warnings about orphaned sections.