From 3ba7097e732601d7a4da46b8b4f640ee2925d308 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 7 Dec 2018 11:05:59 -0500 Subject: [PATCH] linker: add orphan sections to linker script Add missing sections being reported as orphan with latest compiler version for x86 and discard them. Do the same on ARM. Those sections are used for dynamic linking which we do not support in Zephyr. Signed-off-by: Anas Nashif --- include/arch/arm/cortex_m/scripts/linker.ld | 7 +++---- include/arch/x86/linker.ld | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index 4d3cb2e1970..0567202ee7c 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -113,12 +113,12 @@ SECTIONS * .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose', * before text section. */ - SECTION_PROLOGUE(.plt,,) + /DISCARD/ : { *(.plt) } - SECTION_PROLOGUE(.iplt,,) + /DISCARD/ : { *(.iplt) } @@ -293,8 +293,7 @@ SECTIONS * These are here according to 'arm-zephyr-elf-ld --verbose', * before data section. */ - SECTION_PROLOGUE(.got,,) - { + /DISCARD/ : { *(.got.plt) *(.igot.plt) *(.got) diff --git a/include/arch/x86/linker.ld b/include/arch/x86/linker.ld index 2bc38a77d3f..eac47a0db6b 100644 --- a/include/arch/x86/linker.ld +++ b/include/arch/x86/linker.ld @@ -69,6 +69,17 @@ SECTIONS #include + /DISCARD/ : + { + *(.plt) + } + + /DISCARD/ : + { + *(.iplt) + } + + GROUP_START(ROMABLE_REGION) #ifdef CONFIG_REALMODE /* 16-bit sections */ @@ -164,7 +175,15 @@ SECTIONS _image_rom_size = _image_rom_end - _image_rom_start; GROUP_END(ROMABLE_REGION) - + /* + * Needed for dynamic linking which we do not have, do discard + */ + /DISCARD/ : { + *(.got.plt) + *(.igot.plt) + *(.got) + *(.igot) + } /* RAMABLE_REGION */ GROUP_START(RAMABLE_REGION)