From c420733c335a10f71cef888dfc80640349c611dd Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Tue, 19 Mar 2024 14:26:21 -0700 Subject: [PATCH] riscv: linker: lld: Handle symtab/strtab/shstrtab to fix warnings lld will produce warnings for the symtab, strtab, and shstrtab sections if --orphan-handling=warn is specified and there are no matching rules in the linker script for these sections. Handle these sections when building with lld to prevent the warnings. Signed-off-by: Jonathon Penix --- include/zephyr/arch/riscv/common/linker.ld | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index a9bfa7a42ee..ccb16cc2c67 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -421,6 +421,15 @@ GROUP_END(DTCM) KEEP(*(.gnu.attributes)) } +/* Output section descriptions are needed for these sections to suppress + * warnings when "--orphan-handling=warn" is set for lld. + */ +#if defined(CONFIG_LLVM_USE_LLD) + SECTION_PROLOGUE(.symtab, 0,) { *(.symtab) } + SECTION_PROLOGUE(.strtab, 0,) { *(.strtab) } + SECTION_PROLOGUE(.shstrtab, 0,) { *(.shstrtab) } +#endif + /* Sections generated from 'zephyr,memory-region' nodes */ LINKER_DT_SECTIONS()