cortex_m: linker: lld: Handle symtab/strtab/shstrtab to fix warnings

LLD produces warnings about orphaned sections if there are no matching
rules in the linker script:

ld.lld: warning: <internal>:(.symtab) is being placed in '.symtab'
ld.lld: warning: <internal>:(.shstrtab) is being placed in '.shstrtab'
ld.lld: warning: <internal>:(.strtab) is being placed in '.strtab'

Handle these sections when building with LLD to prevent the warnings.

Signed-off-by: Patryk Duda <patrykd@google.com>
This commit is contained in:
Patryk Duda 2024-04-16 12:44:32 +02:00 committed by Alberto Escolar
parent 1c3edca8d8
commit c4fefc0767
1 changed files with 9 additions and 0 deletions

View File

@ -469,6 +469,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()