aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2012-09-09 16:30:40 +0000
committerHans-Peter Nilsson <hp@axis.com>2012-09-09 16:30:40 +0000
commita9ae0bdaba0b448c7823277964c9ae13063d03a0 (patch)
tree6e84a70f3e65aa3910e06cca49bcfee844afc095 /ld/scripttempl
parente81fea4d172699b2e986bc541f812cac0995da6b (diff)
downloadgdb-a9ae0bdaba0b448c7823277964c9ae13063d03a0.zip
gdb-a9ae0bdaba0b448c7823277964c9ae13063d03a0.tar.gz
gdb-a9ae0bdaba0b448c7823277964c9ae13063d03a0.tar.bz2
* emultempl/mmo.em (mmo_place_orphan): Rewrite to also attach
orphan sections to .data and .bss output sections, not just .text. When giving up on finding a suitable output section, attach to any output section other than .MMIX.reg_contents, if it exists. * scripttempl/mmo.sc: Move output debug sections to just before .MMIX.reg_contents. Add .gnu.attributes. Add new . = . NOP assignments and move end-of-section provide-symbols after them to force the end-of-section symbols to the address after orphan placement. Add SORT_NONE to .init and .fini sections.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/mmo.sc80
1 files changed, 44 insertions, 36 deletions
diff --git a/ld/scripttempl/mmo.sc b/ld/scripttempl/mmo.sc
index 38a5b4a..b14954d 100644
--- a/ld/scripttempl/mmo.sc
+++ b/ld/scripttempl/mmo.sc
@@ -20,12 +20,12 @@ SECTIONS
/* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
${RELOCATING+ PROVIDE (_init_start = .);}
${RELOCATING+ PROVIDE (_init = .);}
- ${RELOCATING+ KEEP (*(.init))}
+ ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
${RELOCATING+ PROVIDE (_init_end = .);}
${RELOCATING+ PROVIDE (_fini_start = .);}
${RELOCATING+ PROVIDE (_fini = .);}
- ${RELOCATING+ KEEP (*(.fini))}
+ ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
${RELOCATING+ PROVIDE (_fini_end = .);}
/* FIXME: Align ctors, dtors, ehframe. */
@@ -57,35 +57,17 @@ SECTIONS
${RELOCATING+KEEP (*(.eh_frame))}
${RELOCATING+*(.gcc_except_table)}
- ${RELOCATING+ PROVIDE(etext = .);}
- ${RELOCATING+ PROVIDE(_etext = .);}
- ${RELOCATING+ PROVIDE(__etext = .);}
${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
}
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- .debug_ranges 0 : { *(.debug_ranges) }
-
- /* DWARF 3 */
- .debug_pubtypes 0 : { *(.debug_pubtypes) }
- .debug_ranges 0 : { *(.debug_ranges) }
-
- /* DWARF Extension. */
- .debug_macro 0 : { *(.debug_macro) }
+ /* The following NOP assignment and those after .data and .bss, are
+ necessary to get orphan sections adopted by the .text inserted before
+ the following end-section symbols. An output section would also serve
+ this purpose, but we can't do that. */
+ . = .;
+ ${RELOCATING+ PROVIDE(etext = .);}
+ ${RELOCATING+ PROVIDE(_etext = .);}
+ ${RELOCATING+ PROVIDE(__etext = .);}
.data ${RELOCATING+ ${DATA_ADDR}}:
{
@@ -94,14 +76,13 @@ SECTIONS
*(.data);
${RELOCATING+*(.data.*)}
${RELOCATING+*(.gnu.linkonce.d*)}
-
- ${RELOCATING+ PROVIDE(__Edata = .);}
-
- /* Deprecated, use __Edata. */
- ${RELOCATING+ PROVIDE(edata = .);}
- ${RELOCATING+ PROVIDE(_edata = .);}
- ${RELOCATING+ PROVIDE(__edata = .);}
}
+ . = .;
+ ${RELOCATING+ PROVIDE(__Edata = .);}
+ /* Deprecated, use __Edata. */
+ ${RELOCATING+ PROVIDE(edata = .);}
+ ${RELOCATING+ PROVIDE(_edata = .);}
+ ${RELOCATING+ PROVIDE(__edata = .);}
/* At the moment, although perhaps we should, we can't map sections
without contents to sections *with* contents due to FIXME: a BFD bug.
@@ -115,8 +96,9 @@ SECTIONS
${RELOCATING+ *(.bss);}
${RELOCATING+*(.bss.*)}
${RELOCATING+ *(COMMON);}
- ${RELOCATING+ PROVIDE(__Ebss = .);}
}
+ . = .;
+ ${RELOCATING+ PROVIDE(__Ebss = .);}
/* Deprecated, use __Ebss or __Eall as appropriate. */
${RELOCATING+ PROVIDE(end = .);}
@@ -124,6 +106,30 @@ SECTIONS
${RELOCATING+ PROVIDE(__end = .);}
${RELOCATING+ PROVIDE(__Eall = .);}
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ .debug_ranges 0 : { *(.debug_ranges) }
+
+ /* DWARF 3 */
+ .debug_pubtypes 0 : { *(.debug_pubtypes) }
+ .debug_ranges 0 : { *(.debug_ranges) }
+
+ /* DWARF Extension. */
+ .debug_macro 0 : { *(.debug_macro) }
+
.MMIX.reg_contents :
{
/* Note that this section always has a fixed VMA - that of its
@@ -140,5 +146,7 @@ SECTIONS
It can probably be fixed with some amount of work. */
/DISCARD/ :
{ ${RELOCATING+ *(.gnu.warning.*);} }
+
+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
}
EOF