linker: warn about orphan sections
(Previous patch set was reverted due to issue with priv_stack. Resubmitting after fixing the faults caused by priv_stack.noinit not at the end of RAM.) This adds a linker flag and necessary changes to linker scripts so that linker will warn about orphan sections. Relates to #5534. Fixes #10473, #10474, #10515. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
1fa8cf9279
commit
6600c64331
24 changed files with 312 additions and 0 deletions
40
include/linker/debug-sections.ld
Normal file
40
include/linker/debug-sections.ld
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* following sections are obtained via 'ld --verbose' */
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
SECTION_PROLOGUE(.stab, 0,) { *(.stab) }
|
||||
SECTION_PROLOGUE(.stabstr, 0,) { *(.stabstr) }
|
||||
SECTION_PROLOGUE(.stab.excl, 0,) { *(.stab.excl) }
|
||||
SECTION_PROLOGUE(.stab.exclstr, 0,) { *(.stab.exclstr) }
|
||||
SECTION_PROLOGUE(.stab.index, 0,) { *(.stab.index) }
|
||||
SECTION_PROLOGUE(.stab.indexstr, 0,) { *(.stab.indexstr) }
|
||||
SECTION_PROLOGUE(.comment, 0,) { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
SECTION_PROLOGUE(.debug, 0,) { *(.debug) }
|
||||
SECTION_PROLOGUE(.line, 0,) { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
SECTION_PROLOGUE(.debug_srcinfo, 0,) { *(.debug_srcinfo) }
|
||||
SECTION_PROLOGUE(.debug_sfnames, 0,) { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
SECTION_PROLOGUE(.debug_aranges, 0,) { *(.debug_aranges) }
|
||||
SECTION_PROLOGUE(.debug_pubnames, 0,) { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
SECTION_PROLOGUE(.debug_info, 0,) { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
SECTION_PROLOGUE(.debug_abbrev, 0,) { *(.debug_abbrev) }
|
||||
SECTION_PROLOGUE(.debug_line, 0,) { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
SECTION_PROLOGUE(.debug_frame, 0,) { *(.debug_frame) }
|
||||
SECTION_PROLOGUE(.debug_str, 0,) { *(.debug_str) }
|
||||
SECTION_PROLOGUE(.debug_loc, 0,) { *(.debug_loc) }
|
||||
SECTION_PROLOGUE(.debug_macinfo, 0,) { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
SECTION_PROLOGUE(.debug_weaknames, 0,) { *(.debug_weaknames) }
|
||||
SECTION_PROLOGUE(.debug_funcnames, 0,) { *(.debug_funcnames) }
|
||||
SECTION_PROLOGUE(.debug_typenames, 0,) { *(.debug_typenames) }
|
||||
SECTION_PROLOGUE(.debug_varnames, 0,) { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
SECTION_PROLOGUE(.debug_pubtypes, 0,) { *(.debug_pubtypes) }
|
||||
SECTION_PROLOGUE(.debug_ranges, 0,) { *(.debug_ranges) }
|
||||
/* DWARF Extension. */
|
||||
SECTION_PROLOGUE(.debug_macro, 0,) { *(.debug_macro) }
|
33
include/linker/rel-sections.ld
Normal file
33
include/linker/rel-sections.ld
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* .rel.* are for relocation.
|
||||
* These are being produced by compiler/linker.
|
||||
* Specify these here so they are not considered orphan sections.
|
||||
*/
|
||||
|
||||
SECTION_PROLOGUE(.rel.plt,,)
|
||||
{
|
||||
*(.rel.plt)
|
||||
|
||||
PROVIDE_HIDDEN (__rel_iplt_start = .);
|
||||
*(.rel.iplt)
|
||||
PROVIDE_HIDDEN (__rel_iplt_end = .);
|
||||
}
|
||||
|
||||
SECTION_PROLOGUE(.rela.plt,,)
|
||||
{
|
||||
*(.rela.plt)
|
||||
|
||||
PROVIDE_HIDDEN (__rela_iplt_start = .);
|
||||
*(.rela.iplt)
|
||||
PROVIDE_HIDDEN (__rela_iplt_end = .);
|
||||
}
|
||||
|
||||
SECTION_PROLOGUE(.rel.dyn,,)
|
||||
{
|
||||
*(.rel.*)
|
||||
}
|
||||
|
||||
SECTION_PROLOGUE(.rela.dyn,,)
|
||||
{
|
||||
*(.rela.*)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue