1
0
Fork 0

powerpc: Link warning for orphan sections

Add --orphan-handling=warn to final link flags. This ensures we can
handle all sections explicitly. This would have caught subtle breakage
such as 7de3b27bac at build-time.

Also bring existing orphan sections into the fold:
- .text.hot and .text.unlikely are compiler generated sections.
- .sdata2, .dynsbss, .plt are used by PPC32
- We previously did not specify DWARF_DEBUG or STABS_DEBUG
- DWARF_DEBUG did not include all DWARF sections that can be emitted
- A number of sections are unused and can be discarded.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
hifive-unleashed-5.1
Nicholas Piggin 2017-05-12 03:40:40 +10:00 committed by Michael Ellerman
parent c494adefef
commit 83a092cf95
3 changed files with 27 additions and 2 deletions

View File

@ -98,6 +98,7 @@ endif
LDFLAGS_vmlinux-y := -Bstatic LDFLAGS_vmlinux-y := -Bstatic
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
ifeq ($(CONFIG_PPC64),y) ifeq ($(CONFIG_PPC64),y)
ifeq ($(call cc-option-yn,-mcmodel=medium),y) ifeq ($(call cc-option-yn,-mcmodel=medium),y)

View File

@ -91,7 +91,7 @@ SECTIONS
ALIGN_FUNCTION(); ALIGN_FUNCTION();
#endif #endif
/* careful! __ftr_alt_* sections need to be close to .text */ /* careful! __ftr_alt_* sections need to be close to .text */
*(.text .fixup __ftr_alt_* .ref.text) *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
SCHED_TEXT SCHED_TEXT
CPUIDLE_TEXT CPUIDLE_TEXT
LOCK_TEXT LOCK_TEXT
@ -258,7 +258,9 @@ SECTIONS
.data : AT(ADDR(.data) - LOAD_OFFSET) { .data : AT(ADDR(.data) - LOAD_OFFSET) {
DATA_DATA DATA_DATA
*(.sdata) *(.sdata)
*(.sdata2)
*(.got.plt) *(.got) *(.got.plt) *(.got)
*(.plt)
} }
#else #else
.data : AT(ADDR(.data) - LOAD_OFFSET) { .data : AT(ADDR(.data) - LOAD_OFFSET) {
@ -321,6 +323,16 @@ SECTIONS
_end = . ; _end = . ;
PROVIDE32 (end = .); PROVIDE32 (end = .);
/* Sections to be discarded. */ STABS_DEBUG
DWARF_DEBUG
DISCARDS DISCARDS
/DISCARD/ : {
*(*.EMB.apuinfo)
*(.glink .iplt .plt .rela* .comment)
*(.gnu.version*)
*(.gnu.attributes)
*(.eh_frame)
}
} }

View File

@ -595,6 +595,7 @@
#define SBSS(sbss_align) \ #define SBSS(sbss_align) \
. = ALIGN(sbss_align); \ . = ALIGN(sbss_align); \
.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
*(.dynsbss) \
*(.sbss) \ *(.sbss) \
*(.scommon) \ *(.scommon) \
} }
@ -641,11 +642,22 @@
.debug_str 0 : { *(.debug_str) } \ .debug_str 0 : { *(.debug_str) } \
.debug_loc 0 : { *(.debug_loc) } \ .debug_loc 0 : { *(.debug_loc) } \
.debug_macinfo 0 : { *(.debug_macinfo) } \ .debug_macinfo 0 : { *(.debug_macinfo) } \
.debug_pubtypes 0 : { *(.debug_pubtypes) } \
/* DWARF 3 */ \
.debug_ranges 0 : { *(.debug_ranges) } \
/* SGI/MIPS DWARF 2 extensions */ \ /* SGI/MIPS DWARF 2 extensions */ \
.debug_weaknames 0 : { *(.debug_weaknames) } \ .debug_weaknames 0 : { *(.debug_weaknames) } \
.debug_funcnames 0 : { *(.debug_funcnames) } \ .debug_funcnames 0 : { *(.debug_funcnames) } \
.debug_typenames 0 : { *(.debug_typenames) } \ .debug_typenames 0 : { *(.debug_typenames) } \
.debug_varnames 0 : { *(.debug_varnames) } \ .debug_varnames 0 : { *(.debug_varnames) } \
/* GNU DWARF 2 extensions */ \
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \
/* DWARF 4 */ \
.debug_types 0 : { *(.debug_types) } \
/* DWARF 5 */ \
.debug_macro 0 : { *(.debug_macro) } \
.debug_addr 0 : { *(.debug_addr) }
/* Stabs debugging sections. */ /* Stabs debugging sections. */
#define STABS_DEBUG \ #define STABS_DEBUG \