aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-12 12:06:40 +1030
committerAlan Modra <amodra@gmail.com>2018-10-13 20:33:23 +1030
commit2bf2bf23da5237f465fdbb759657aeb7825a08a3 (patch)
tree49a81efac8f227478ae0f19e6942f53795d6aa51 /ld/scripttempl
parent8bca297856b2e54ac093674554f6abd82e7ce6b0 (diff)
downloadgdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.zip
gdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.tar.gz
gdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.tar.bz2
ELF ld -r scripts
"ld -r" generally should not combine object file sections with different names. For example, "ld -r" should not combine ".text", ".text.hot" and ".text.cold" into an output ".text" section. An exception needs to be made for linker created sections, for example, branch trampoline sections that might be created even for ld -r. "ld -r" also should not define symbols in linker scripts. Any definitions are likely to conflict with those defined at final link. A MEMORY spec is also not needed for ld -r. * Makefile.am (eelf32btsmip_fbsd.c, eelf32btsmipn32_fbsd.c), (eelf32epiphany.c, eelf32epiphany_4x4.c, eelf32ltsmip_fbsd.c), (eelf32ltsmipn32_fbsd.c, eelf32xc16x.c, eelf32xc16xl.c), (eelf32xc16xs.c, emcorepe.c, enios2elf.c, enios2linux.c), (eelf64btsmip_fbsd.c, eelf64ltsmip_fbsd.c): Correct dependencies. * Makefile.in: Regenerate. * emulparams/aarch64cloudabi.sh, * emulparams/aarch64fbsd.sh, * emulparams/aarch64linux.sh, * emulparams/aarch64linux32.sh, * emulparams/arc-nps.sh, * emulparams/elf32_spu.sh, * emulparams/elf32_tic6x_le.sh, * emulparams/elf32bmip.sh, * emulparams/elf32btsmipn32.sh, * emulparams/elf32lr5900n32.sh, * emulparams/elf32mep.sh, * emulparams/elf32metag.sh, * emulparams/elf64btsmip.sh, * emulparams/shelf_vxworks.sh, * emulparams/shlelf_fd.sh, * scripttempl/DWARF.sc, * scripttempl/alpha.sc, * scripttempl/alphavms.sc, * scripttempl/arclinux.sc, * scripttempl/armbpabi.sc, * scripttempl/avr.sc, * scripttempl/dlx.sc, * scripttempl/elf.sc, * scripttempl/elf32cr16.sc, * scripttempl/elf32cr16c.sc, * scripttempl/elf32crx.sc, * scripttempl/elf32msp430.sc, * scripttempl/elf32msp430_3.sc, * scripttempl/elf32xc16x.sc, * scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc, * scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc, * scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc, * scripttempl/elfd10v.sc, * scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc, * scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc, * scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc, * scripttempl/ft32.sc, * scripttempl/hppaelf.sc, * scripttempl/ia64vms.sc, * scripttempl/ip2k.sc, * scripttempl/iq2000.sc, * scripttempl/mep.sc, * scripttempl/mmo.sc, * scripttempl/nds32elf.sc, * scripttempl/pru.sc, * scripttempl/sh.sc, * scripttempl/v850.sc, * scripttempl/v850_rh850.sc, * scripttempl/visium.sc, * scripttempl/xstormy16.sc: Condition various parts of scripts on ${RELOCATABLE} in order to prevent ld -r merging sections or defining symbols. Remove MEMORY and VERSION definitions from ld -r scripts too. * testsuite/ld-elf/group2.d, * testsuite/ld-elf/group4.d, * testsuite/ld-elf/group5.d, * testsuite/ld-elf/group6.d, * testsuite/ld-elf/group7.d, * testsuite/ld-elf/group8a.d, * testsuite/ld-elf/group8b.d, * testsuite/ld-elf/group9a.d, * testsuite/ld-elf/group9b.d, * testsuite/ld-elf/pr17550a.d, * testsuite/ld-elf/pr17550b.d, * testsuite/ld-elf/pr17550d.d: Don't xfail cr16 and crx. * testsuite/ld-elf/init-fini-arrays.d, * testsuite/ld-elf/pr22677.d: Likewise, and dont' xfail mep.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/DWARF.sc2
-rw-r--r--ld/scripttempl/alpha.sc16
-rw-r--r--ld/scripttempl/alphavms.sc12
-rw-r--r--ld/scripttempl/arclinux.sc44
-rw-r--r--ld/scripttempl/armbpabi.sc38
-rw-r--r--ld/scripttempl/avr.sc68
-rw-r--r--ld/scripttempl/dlx.sc6
-rw-r--r--ld/scripttempl/elf.sc88
-rw-r--r--ld/scripttempl/elf32cr16.sc38
-rw-r--r--ld/scripttempl/elf32cr16c.sc40
-rw-r--r--ld/scripttempl/elf32crx.sc4
-rw-r--r--ld/scripttempl/elf32msp430.sc73
-rw-r--r--ld/scripttempl/elf32msp430_3.sc37
-rw-r--r--ld/scripttempl/elf32xc16x.sc16
-rw-r--r--ld/scripttempl/elf32xc16xl.sc16
-rw-r--r--ld/scripttempl/elf32xc16xs.sc17
-rw-r--r--ld/scripttempl/elf64hppa.sc28
-rw-r--r--ld/scripttempl/elf_chaos.sc28
-rw-r--r--ld/scripttempl/elfarc.sc52
-rw-r--r--ld/scripttempl/elfarcv2.sc25
-rw-r--r--ld/scripttempl/elfd10v.sc52
-rw-r--r--ld/scripttempl/elfd30v.sc29
-rw-r--r--ld/scripttempl/elfm68hc11.sc7
-rw-r--r--ld/scripttempl/elfm68hc12.sc7
-rw-r--r--ld/scripttempl/elfm9s12z.sc9
-rw-r--r--ld/scripttempl/elfmicroblaze.sc41
-rw-r--r--ld/scripttempl/elfxgate.sc7
-rw-r--r--ld/scripttempl/elfxtensa.sc26
-rw-r--r--ld/scripttempl/epiphany_4x4.sc72
-rw-r--r--ld/scripttempl/ft32.sc26
-rw-r--r--ld/scripttempl/hppaelf.sc22
-rw-r--r--ld/scripttempl/ia64vms.sc4
-rw-r--r--ld/scripttempl/ip2k.sc3
-rw-r--r--ld/scripttempl/iq2000.sc16
-rw-r--r--ld/scripttempl/mep.sc16
-rw-r--r--ld/scripttempl/mmo.sc4
-rw-r--r--ld/scripttempl/nds32elf.sc36
-rw-r--r--ld/scripttempl/pru.sc23
-rw-r--r--ld/scripttempl/sh.sc8
-rw-r--r--ld/scripttempl/v850.sc38
-rw-r--r--ld/scripttempl/v850_rh850.sc48
-rw-r--r--ld/scripttempl/visium.sc25
-rw-r--r--ld/scripttempl/xstormy16.sc45
43 files changed, 654 insertions, 558 deletions
diff --git a/ld/scripttempl/DWARF.sc b/ld/scripttempl/DWARF.sc
index f8b6f22..e6396ec 100644
--- a/ld/scripttempl/DWARF.sc
+++ b/ld/scripttempl/DWARF.sc
@@ -24,7 +24,7 @@ cat <<EOF
/* DWARF 2 */
.debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
.debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
+ .debug_line 0 : { *(.debug_line${RELOCATING+ .debug_line.* .debug_line_end}) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
diff --git a/ld/scripttempl/alpha.sc b/ld/scripttempl/alpha.sc
index 245838c..5f3a8bf 100644
--- a/ld/scripttempl/alpha.sc
+++ b/ld/scripttempl/alpha.sc
@@ -32,16 +32,16 @@ SECTIONS
{
${RELOCATING+. = ${TEXT_START_ADDR};}
.text : {
- ${RELOCATING+ _ftext = . };
- ${RELOCATING+ __istart = . };
- ${RELOCATING+ *(.init) }
+ ${RELOCATING+ _ftext = .;}
+ ${RELOCATING+ __istart = .;}
+ ${RELOCATING+ *(.init)}
${RELOCATING+ LONG (0x6bfa8001)}
- ${RELOCATING+ eprol = .};
+ ${RELOCATING+ eprol = .;}
*(.text)
- ${RELOCATING+ __fstart = . };
+ ${RELOCATING+ __fstart = .;}
${RELOCATING+ *(.fini)}
${RELOCATING+ LONG (0x6bfa8001)}
- ${RELOCATING+ _etext = .};
+ ${RELOCATING+ _etext = .;}
}
.rdata : {
*(.rdata)
@@ -76,11 +76,11 @@ SECTIONS
${RELOCATING+ _FBSS = .;}
.sbss : {
*(.sbss)
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
}
.bss : {
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
}
${RELOCATING+ _end = .;}
}
diff --git a/ld/scripttempl/alphavms.sc b/ld/scripttempl/alphavms.sc
index 764cc3d..f681899 100644
--- a/ld/scripttempl/alphavms.sc
+++ b/ld/scripttempl/alphavms.sc
@@ -33,13 +33,13 @@ SECTIONS
}
/* RO, executable code. */
\$CODE\$ ALIGN (${PAGESIZE}) : {
- *(\$CODE\$ *\$CODE*)
+ *(\$CODE\$${RELOCATING+ *\$CODE*})
}
/* RO initialized data. */
\$LITERAL\$ ALIGN (${PAGESIZE}) : {
- *(\$LINK\$)
+ ${RELOCATING+*(\$LINK\$)}
*(\$LITERAL\$)
- *(\$READONLY\$)
+ ${RELOCATING+*(\$READONLY\$)
*(\$READONLY_ADDR\$)
*(eh_frame)
*(jcr)
@@ -51,11 +51,11 @@ SECTIONS
*(LIB\$INITIALIZDZ) /* Start marker. */
*(LIB\$INITIALIZD_) /* Hi priority. */
*(LIB\$INITIALIZE) /* User. */
- *(LIB\$INITIALIZE$) /* End marker. */
+ *(LIB\$INITIALIZE$) /* End marker. */}
}
\$DWARF\$ ALIGN (${PAGESIZE}) : {
- \$dwarf2.debug_pubtypes = .;
+ ${RELOCATING+\$dwarf2.debug_pubtypes = .;
*(debug_pubtypes)
\$dwarf2.debug_ranges = .;
*(debug_ranges)
@@ -80,7 +80,7 @@ SECTIONS
*(debug_pubnames)
\$dwarf2.debug_str = .;
*(debug_str)
- \$dwarf2.debug_zzzzzz = .;
+ \$dwarf2.debug_zzzzzz = .;}
}
\$DST\$ 0 : {
diff --git a/ld/scripttempl/arclinux.sc b/ld/scripttempl/arclinux.sc
index 9c23786..931d7a5 100644
--- a/ld/scripttempl/arclinux.sc
+++ b/ld/scripttempl/arclinux.sc
@@ -141,16 +141,16 @@ if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
- PLT=".plt ${RELOCATING-0} : { *(.plt)${IREL_IN_PLT+ *(.iplt)} }
+ PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }
${IREL_IN_PLT-$IPLT}"
fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }"
else
- GOT=".got ${RELOCATING-0} : { *(.got) *(.igot) }"
- GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) }"
+ GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }"
+ GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
fi
fi
REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
@@ -176,9 +176,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+${SBSS_START_SYMBOLS}}
${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)}
- *(.dyn${SBSS_NAME})
+ ${RELOCATING+*(.dyn${SBSS_NAME})}
*(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+${SBSS_END_SYMBOLS}}
}"
SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
@@ -541,12 +541,10 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) ${RELOCATING+*(.eh_frame_entry .eh_frame_entry.*)} }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table
- .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
.gnu_extab ${RELOCATING-0} : ONLY_IF_RO { *(.gnu_extab*) }
/* These sections are generated by the Sun/Oracle C++ compiler. */
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges
- .exception_ranges*) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) }
${TEXT_PLT+${PLT_NEXT_DATA+${PLT}}}
/* Adjust the address for the data segment. We want to adjust up to
@@ -558,12 +556,12 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
.gnu_extab ${RELOCATING-0} : ONLY_IF_RW { *(.gnu_extab) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) }
/* Thread Local Storage sections */
- .tdata ${RELOCATING-0} : { PROVIDE_HIDDEN(.tdata = .); *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
- .tbss ${RELOCATING-0} : { PROVIDE_HIDDEN(.tbss = .); *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
+ .tdata ${RELOCATING-0} : { ${RELOCATING+PROVIDE_HIDDEN(.tdata = .); }*(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
+ .tbss ${RELOCATING-0} : { ${RELOCATING+PROVIDE_HIDDEN(.tbss = .); }*(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
.preinit_array ${RELOCATING-0} :
{
@@ -621,15 +619,15 @@ cat <<EOF
${BSS_PLT+${PLT}}
.${BSS_NAME} ${RELOCATING-0} :
{
- *(.dyn${BSS_NAME})
- *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
- pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ ${RELOCATING+*(.dyn${BSS_NAME})}
+ *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections.
+ FIXME: Why do we need it? When there is no .bss section, we do not
+ pad the .data section. */
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}
${OTHER_BSS_SECTIONS}
${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc
index a12cd3d..8eed447 100644
--- a/ld/scripttempl/armbpabi.sc
+++ b/ld/scripttempl/armbpabi.sc
@@ -42,9 +42,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+PROVIDE (__sbss_start = .);}
${RELOCATING+PROVIDE (___sbss_start = .);}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+PROVIDE (__sbss_end = .);}
${RELOCATING+PROVIDE (___sbss_end = .);}
}"
@@ -154,17 +154,16 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${OUTPUT_ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
-
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+/* Do we need any of these for elf?
- __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING+${INPUT_FILES}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
- if gld -r is used and the intermediate file has sections starting
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
- bug. But for now assigning the zero vmas works. */}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
+
+${LIB_SEARCH_DIRS}
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */
+${EXECUTABLE_SYMBOLS}
+${INPUT_FILES}
/* ARM's proprietary toolchain generate these symbols to match the start
and end of particular sections of the image. SymbianOS uses these
@@ -187,6 +186,9 @@ VERSION
};
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment: */
@@ -254,7 +256,7 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -264,7 +266,7 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -303,13 +305,13 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ . = ALIGN(${ALIGNMENT});}
}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index 5d0a3a1..931ef40 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -24,7 +24,9 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+test -n "${RELOCATING}" && cat <<EOF
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
${EEPROM_LENGTH+__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : $EEPROM_LENGTH;}
@@ -43,7 +45,9 @@ ${EEPROM_LENGTH+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LE
signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
${USER_SIGNATURE_LENGTH+ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__}
}
+EOF
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment: */
@@ -109,32 +113,32 @@ SECTIONS
/* Internal text space or external memory. */
.text ${RELOCATING-0} :
{
- *(.vectors)
+ ${RELOCATING+*(.vectors)
KEEP(*(.vectors))
/* For data that needs to reside in the lower 64k of progmem. */
- ${RELOCATING+ *(.progmem.gcc*)}
+ *(.progmem.gcc*)
/* PR 13812: Placing the trampolines here gives a better chance
that they will be in range of the code that uses them. */
- ${RELOCATING+. = ALIGN(2);}
- ${CONSTRUCTING+ __trampolines_start = . ; }
+ . = ALIGN(2);
+ __trampolines_start = . ;
/* The jump trampolines for the 16-bit limited relocs will reside here. */
*(.trampolines)
- ${RELOCATING+ *(.trampolines*)}
- ${CONSTRUCTING+ __trampolines_end = . ; }
+ *(.trampolines*)
+ __trampolines_end = . ;
/* avr-libc expects these data to reside in lower 64K. */
- ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
- ${RELOCATING+ *libc.a:*(.progmem.data)}
+ *libprintf_flt.a:*(.progmem.data)
+ *libc.a:*(.progmem.data)
- ${RELOCATING+ *(.progmem.*)}
+ *(.progmem.*)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
/* For code that needs to reside in the lower 128k progmem. */
*(.lowtext)
- ${RELOCATING+ *(.lowtext*)}
+ *(.lowtext*)}
${CONSTRUCTING+ __ctors_start = . ; }
${CONSTRUCTING+ *(.ctors) }
@@ -142,10 +146,10 @@ SECTIONS
${CONSTRUCTING+ __dtors_start = . ; }
${CONSTRUCTING+ *(.dtors) }
${CONSTRUCTING+ __dtors_end = . ; }
- KEEP(SORT(*)(.ctors))
+ ${RELOCATING+KEEP(SORT(*)(.ctors))
KEEP(SORT(*)(.dtors))
- /* From this point on, we don't bother about wether the insns are
+ /* From this point on, we do not bother about whether the insns are
below or above the 16 bits boundary. */
*(.init0) /* Start here after reset. */
KEEP (*(.init0))
@@ -166,11 +170,11 @@ SECTIONS
*(.init8)
KEEP (*(.init8))
*(.init9) /* Call main(). */
- KEEP (*(.init9))
+ KEEP (*(.init9))}
*(.text)
- ${RELOCATING+. = ALIGN(2);}
- ${RELOCATING+ *(.text.*)}
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
+ *(.text.*)
+ . = ALIGN(2);
*(.fini9) /* _exit() starts here. */
KEEP (*(.fini9))
*(.fini8)
@@ -194,18 +198,18 @@ SECTIONS
/* For code that needs not to reside in the lower progmem. */
*(.hightext)
- ${RELOCATING+ *(.hightext*)}
+ *(.hightext*)
- ${RELOCATING+ *(.progmemx.*)}
+ *(.progmemx.*)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
- /* For tablejump instruction arrays. We don't relax
+ /* For tablejump instruction arrays. We do not relax
JMP / CALL instructions within these sections. */
*(.jumptables)
- ${RELOCATING+ *(.jumptables*)}
+ *(.jumptables*)
- ${RELOCATING+ _etext = . ; }
+ _etext = . ;}
} ${RELOCATING+ > text}
EOF
@@ -218,8 +222,8 @@ if test -n "$RODATA_PM_OFFSET"; then
.rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} :
{
*(.rodata)
- ${RELOCATING+ *(.rodata*)}
- *(.gnu.linkonce.r*)
+ ${RELOCATING+ *(.rodata*)
+ *(.gnu.linkonce.r*)}
} ${RELOCATING+AT> text}
EOF
fi
@@ -229,18 +233,18 @@ cat <<EOF
{
${RELOCATING+ PROVIDE (__data_start = .) ; }
*(.data)
- ${RELOCATING+ *(.data*)}
- *(.gnu.linkonce.d*)
+ ${RELOCATING+ *(.data*)
+ *(.gnu.linkonce.d*)}
EOF
# Classical devices that don't show flash memory in the SRAM address space
# need .rodata to be part of .data because the compiler will use LD*
# instructions and LD* cannot access flash.
-if test -z "$RODATA_PM_OFFSET"; then
+if test -z "$RODATA_PM_OFFSET" && test -n "${RELOCATING}"; then
cat <<EOF
*(.rodata) /* We need to include .rodata here if gcc is used */
- ${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
+ *(.rodata*) /* with -fdata-sections. */
*(.gnu.linkonce.r*)
EOF
fi
@@ -256,7 +260,7 @@ cat <<EOF
${RELOCATING+ PROVIDE (__bss_start = .) ; }
*(.bss)
${RELOCATING+ *(.bss*)}
- *(COMMON)
+ ${RELOCATING+ *(COMMON)}
${RELOCATING+ PROVIDE (__bss_end = .) ; }
} ${RELOCATING+ > data}
@@ -292,9 +296,9 @@ cat <<EOF
.fuse ${RELOCATING-0}:
{
KEEP(*(.fuse))
- KEEP(*(.lfuse))
+ ${RELOCATING+KEEP(*(.lfuse))
KEEP(*(.hfuse))
- KEEP(*(.efuse))
+ KEEP(*(.efuse))}
} ${RELOCATING+ > fuse}
EOF
fi
diff --git a/ld/scripttempl/dlx.sc b/ld/scripttempl/dlx.sc
index 175ceb3..0741893 100644
--- a/ld/scripttempl/dlx.sc
+++ b/ld/scripttempl/dlx.sc
@@ -21,7 +21,7 @@ SECTIONS
${RELOCATING+. = ${TEXT_START_ADDR};}
.text :
{
- CREATE_OBJECT_SYMBOLS
+ ${RELOCATING+CREATE_OBJECT_SYMBOLS}
*(.text)
${RELOCATING+etext = ${DATA_ALIGNMENT};}
}
@@ -35,8 +35,8 @@ SECTIONS
.bss :
{
*(.bss)
- *(COMMON)
- ${RELOCATING+end = . };
+ ${RELOCATING+*(COMMON)}
+ ${RELOCATING+end = .;}
}
}
EOF
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index b10e330..d3e1828 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -144,16 +144,16 @@ if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
- PLT=".plt ${RELOCATING-0} : { *(.plt)${IREL_IN_PLT+ *(.iplt)} }
+ PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }
${IREL_IN_PLT-$IPLT}"
fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }"
else
- GOT=".got ${RELOCATING-0} : { *(.got) *(.igot) }"
- GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) }"
+ GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }"
+ GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
fi
fi
REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
@@ -179,9 +179,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+${SBSS_START_SYMBOLS}}
${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)}
- *(.dyn${SBSS_NAME})
+ ${RELOCATING+*(.dyn${SBSS_NAME})}
*(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+${SBSS_END_SYMBOLS}}
}"
SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
@@ -231,9 +231,9 @@ test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
test "${LARGE_SECTIONS}" = "yes" && LARGE_BSS="
.lbss ${RELOCATING-0} :
{
- *(.dynlbss)
+ ${RELOCATING+*(.dynlbss)}
*(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
- *(LARGE_COMMON)
+ ${RELOCATING+*(LARGE_COMMON)}
}"
test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
.lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
@@ -245,12 +245,6 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
*(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}"
-PREINIT_ARRAY=".preinit_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
- KEEP (*(.preinit_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
- }"
if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
@@ -262,19 +256,25 @@ else
CTORS_IN_INIT_ARRAY=
DTORS_IN_FINI_ARRAY=
fi
-INIT_ARRAY=".init_array ${RELOCATING-0} :
+PREINIT_ARRAY=".preinit_array :
{
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}
+ KEEP (*(.preinit_array))
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}
+ }"
+INIT_ARRAY=".init_array :
+ {
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}
${SORT_INIT_ARRAY}
KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY}))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}
}"
-FINI_ARRAY=".fini_array ${RELOCATING-0} :
+FINI_ARRAY=".fini_array :
{
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}
${SORT_FINI_ARRAY}
KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}
}"
CTOR=".ctors ${CONSTRUCTING-0} :
{
@@ -327,7 +327,7 @@ SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-
if test -z "$TINY_READONLY_SECTION"; then
case "$LD_FLAG" in
*textonly*)
- SEPARATE_TEXT=yes
+ SEPARATE_TEXT=" "
TEXT_SEGMENT_ALIGN=". = ALIGN(${MAXPAGESIZE});"
;;
esac
@@ -368,7 +368,7 @@ ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
SECTIONS
{
- /* Read-only sections, merged into text segment: */
+ ${RELOCATING+${SEPARATE_TEXT-/* Read-only sections, merged into text segment: */}}
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
@@ -546,11 +546,11 @@ SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
fi
cat <<EOF
- /* Adjust the address for the rodata segment. We want to adjust up to
+ ${RELOCATING+/* Adjust the address for the rodata segment. We want to adjust up to
the same address within the page on the next page up. */
- ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${RODATA_ADDR};}}}
- ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
- ${CREATE_PIE+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
+ ${CREATE_SHLIB-${CREATE_PIE-. = ${RODATA_ADDR};}}
+ ${CREATE_SHLIB+. = ${SHLIB_RODATA_ADDR};}
+ ${CREATE_PIE+. = ${SHLIB_RODATA_ADDR};}}
EOF
if test -n "${SEPARATE_CODE}"; then
emit_early_ro
@@ -564,27 +564,25 @@ cat <<EOF
${CREATE_SHLIB-${SDATA2}}
${CREATE_SHLIB-${SBSS2}}
${OTHER_READONLY_SECTIONS}
- .eh_frame_hdr : { *(.eh_frame_hdr) ${RELOCATING+*(.eh_frame_entry .eh_frame_entry.*)} }
- .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table
- .gcc_except_table.*) }
+ .eh_frame_hdr : { *(.eh_frame_hdr)${RELOCATING+ *(.eh_frame_entry .eh_frame_entry.*)} }
+ .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
.gnu_extab ${RELOCATING-0} : ONLY_IF_RO { *(.gnu_extab*) }
/* These sections are generated by the Sun/Oracle C++ compiler. */
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges
- .exception_ranges*) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) }
${TEXT_PLT+${PLT_NEXT_DATA+${PLT} ${OTHER_PLT_SECTIONS}}}
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. */
+ ${RELOCATING+/* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. */}
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
- ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
- ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
+ ${CREATE_SHLIB+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
+ ${CREATE_PIE+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
/* Exception handling */
- .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
+ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
.gnu_extab ${RELOCATING-0} : ONLY_IF_RW { *(.gnu_extab) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} :
@@ -647,13 +645,13 @@ cat <<EOF
{
${RELOCATING+*(.dynbss)}
*(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
+ FIXME: Why do we need it? When there is no .bss section, we do not
pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}
${OTHER_BSS_SECTIONS}
${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
@@ -666,8 +664,8 @@ SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_A
cat <<EOF
${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
- ${RELOCATING+${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}}
- ${RELOCATING+${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}}
+ ${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}
+ ${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}
${LARGE_SECTIONS}
${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
@@ -692,7 +690,7 @@ cat <<EOF
.comment 0 : { *(.comment) }
- .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
+ .gnu.build.attributes : { *(.gnu.build.attributes${RELOCATING+ .gnu.build.attributes.*}) }
EOF
diff --git a/ld/scripttempl/elf32cr16.sc b/ld/scripttempl/elf32cr16.sc
index cdabd9c..936c03a 100644
--- a/ld/scripttempl/elf32cr16.sc
+++ b/ld/scripttempl/elf32cr16.sc
@@ -6,6 +6,10 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+# Using an empty script for ld -r is better than mashing together
+# sections. This hack likely leaves ld -Ur broken.
+test -n "${RELOCATING}" || exit 0
+
# The next line should be uncommented if it is desired to link
# without libstart.o and directly enter main.
@@ -23,7 +27,10 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
/* Define memory regions. */
MEMORY
@@ -32,6 +39,9 @@ MEMORY
ram : ORIGIN = 4M, LENGTH = 10M
}
+EOF
+
+cat <<EOF
/* Many sections come in three flavours. There is the 'real' section,
like ".data". Then there are the per-procedure or per-variable
sections, generated by -ffunction-sections and -fdata-sections in GCC,
@@ -54,33 +64,33 @@ SECTIONS
__INIT_START = .;
KEEP (*(.init))
__INIT_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.fini :
{
__FINI_START = .;
KEEP (*(.fini))
__FINI_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.jcr :
{
KEEP (*(.jcr))
- } > rom
+ }${RELOCATING+ > rom}
.text :
{
__TEXT_START = .;
*(.text) *(.text.*) *(.gnu.linkonce.t.*)
__TEXT_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.rdata :
{
__RDATA_START = .;
*(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata*)
__RDATA_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.ctor ALIGN(4) :
{
@@ -106,7 +116,7 @@ SECTIONS
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.dtor ALIGN(4) :
{
@@ -116,21 +126,21 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END = .;
- } > rom
+ }${RELOCATING+ > rom}
.data :
{
__DATA_START = .;
*(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
__DATA_END = .;
- } > ram AT > rom
+ }${RELOCATING+ > ram AT > rom}
.bss (NOLOAD) :
{
__BSS_START = .;
*(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
__BSS_END = .;
- } > ram
+ }${RELOCATING+ > ram}
/* You may change the sizes of the following sections to fit the actual
size your program requires.
@@ -143,21 +153,21 @@ SECTIONS
. = ALIGN(4);
__HEAP_START = .;
. += 0x2000; __HEAP_MAX = .;
- } > ram
+ }${RELOCATING+ > ram}
.stack (NOLOAD) :
{
. = ALIGN(4);
. += 0x6000;
__STACK_START = .;
- } > ram
+ }${RELOCATING+ > ram}
.istack (NOLOAD) :
{
. = ALIGN(4);
. += 0x100;
__ISTACK_START = .;
- } > ram
+ }${RELOCATING+ > ram}
.comment 0 : { *(.comment) }
@@ -168,5 +178,5 @@ EOF
cat <<EOF
}
-__DATA_IMAGE_START = LOADADDR(.data);
+${RELOCATING+__DATA_IMAGE_START = LOADADDR(.data);}
EOF
diff --git a/ld/scripttempl/elf32cr16c.sc b/ld/scripttempl/elf32cr16c.sc
index 637302e..55645c6 100644
--- a/ld/scripttempl/elf32cr16c.sc
+++ b/ld/scripttempl/elf32cr16c.sc
@@ -6,6 +6,10 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+# Using an empty script for ld -r is better than mashing together
+# sections. This hack likely leaves ld -Ur broken.
+test -n "${RELOCATING}" || exit 0
+
test -z "$ENTRY" && ENTRY=_start
cat <<EOF
@@ -19,8 +23,9 @@ cat <<EOF
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. */
-
-${RELOCATING+ENTRY(${ENTRY})}
+EOF
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
MEMORY
{
@@ -30,6 +35,9 @@ MEMORY
ram : ORIGIN = 4M, LENGTH = 10M
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* The heap is located in near memory, to suit both the near and
@@ -38,21 +46,21 @@ SECTIONS
there. The alignment to 4 bytes is compatible for both the CR16C
bus width (2 bytes) and CR16CPlus bus width (4 bytes). */
- .text : { __TEXT_START = .; *(.text) __TEXT_END = .; } > rom
- .rdata : { __RDATA_START = .; *(.rdata_4) *(.rdata_2) *(.rdata_1) __RDATA_END = .; } > near_rom
- .ctor ALIGN(4) : { __CTOR_LIST = .; *(.ctors) __CTOR_END = .; } > near_rom
- .dtor ALIGN(4) : { __DTOR_LIST = .; *(.dtors) __DTOR_END = .; } > near_rom
- .data : { __DATA_START = .; *(.data_4) *(.data_2) *(.data_1) *(.data) __DATA_END = .; } > ram AT > rom
- .bss (NOLOAD) : { __BSS_START = .; *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) __BSS_END = .; } > ram
- .nrdata : { __NRDATA_START = .; *(.nrdat_4) *(.nrdat_2) *(.nrdat_1) __NRDATA_END = .; } > near_rom
- .ndata : { __NDATA_START = .; *(.ndata_4) *(.ndata_2) *(.ndata_1) __NDATA_END = .; } > near_ram AT > rom
- .nbss (NOLOAD) : { __NBSS_START = .; *(.nbss_4) *(.nbss_2) *(.nbss_1) *(.ncommon) __NBSS_END = .; } > near_ram
- .heap (NOLOAD) : { . = ALIGN(4); __HEAP_START = .; . += 0x2000; __HEAP_MAX = .; } > near_ram
- .stack (NOLOAD) : { . = ALIGN(4); . += 0x6000; __STACK_START = .; } > ram
- .istack (NOLOAD) : { . = ALIGN(2); . += 0x100; __ISTACK_START = .; } > ram
+ .text : { __TEXT_START = .; *(.text) __TEXT_END = .; }${RELOCATING+ > rom}
+ .rdata : { __RDATA_START = .; *(.rdata_4) *(.rdata_2) *(.rdata_1) __RDATA_END = .; }${RELOCATING+ > near_rom}
+ .ctor ALIGN(4) : { __CTOR_LIST = .; *(.ctors) __CTOR_END = .; }${RELOCATING+ > near_rom}
+ .dtor ALIGN(4) : { __DTOR_LIST = .; *(.dtors) __DTOR_END = .; }${RELOCATING+ > near_rom}
+ .data : { __DATA_START = .; *(.data_4) *(.data_2) *(.data_1) *(.data) __DATA_END = .; }${RELOCATING+ > ram AT > rom}
+ .bss (NOLOAD) : { __BSS_START = .; *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) __BSS_END = .; }${RELOCATING+ > ram}
+ .nrdata : { __NRDATA_START = .; *(.nrdat_4) *(.nrdat_2) *(.nrdat_1) __NRDATA_END = .; }${RELOCATING+ > near_rom}
+ .ndata : { __NDATA_START = .; *(.ndata_4) *(.ndata_2) *(.ndata_1) __NDATA_END = .; }${RELOCATING+ > near_ram AT > rom}
+ .nbss (NOLOAD) : { __NBSS_START = .; *(.nbss_4) *(.nbss_2) *(.nbss_1) *(.ncommon) __NBSS_END = .; }${RELOCATING+ > near_ram}
+ .heap (NOLOAD) : { . = ALIGN(4); __HEAP_START = .; . += 0x2000; __HEAP_MAX = .; }${RELOCATING+ > near_ram}
+ .stack (NOLOAD) : { . = ALIGN(4); . += 0x6000; __STACK_START = .; }${RELOCATING+ > ram}
+ .istack (NOLOAD) : { . = ALIGN(2); . += 0x100; __ISTACK_START = .; }${RELOCATING+ > ram}
}
-__DATA_IMAGE_START = LOADADDR(.data);
-__NDATA_IMAGE_START = LOADADDR(.ndata);
+${RELOCATING+__DATA_IMAGE_START = LOADADDR(.data);}
+${RELOCATING+__NDATA_IMAGE_START = LOADADDR(.ndata);}
EOF
diff --git a/ld/scripttempl/elf32crx.sc b/ld/scripttempl/elf32crx.sc
index 89aafa6..319a867 100644
--- a/ld/scripttempl/elf32crx.sc
+++ b/ld/scripttempl/elf32crx.sc
@@ -6,6 +6,10 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+# Using an empty script for ld -r is better than mashing together
+# sections. This hack likely leaves ld -Ur broken.
+test -n "${RELOCATING}" || exit 0
+
# The next line should be uncommented if it is desired to link
# without libstart.o and directly enter main.
diff --git a/ld/scripttempl/elf32msp430.sc b/ld/scripttempl/elf32msp430.sc
index 1f69a12..b35f0ef 100644
--- a/ld/scripttempl/elf32msp430.sc
+++ b/ld/scripttempl/elf32msp430.sc
@@ -32,6 +32,9 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
MEMORY
{
text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE
@@ -43,6 +46,9 @@ MEMORY
${HEAP_MEMORY_MSP430}
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* Bootloader. */
@@ -51,7 +57,7 @@ SECTIONS
${RELOCATING+ PROVIDE (__boot_start = .) ; }
*(.bootloader)
${RELOCATING+. = ALIGN(2);}
- *(.bootloader.*)
+ ${RELOCATING+*(.bootloader.*)}
} ${RELOCATING+ > bootloader}
/* Information memory. */
@@ -59,7 +65,7 @@ SECTIONS
{
*(.infomem)
${RELOCATING+. = ALIGN(2);}
- *(.infomem.*)
+ ${RELOCATING+*(.infomem.*)}
} ${RELOCATING+ > infomem}
/* Information memory (not loaded into MPU). */
@@ -67,7 +73,7 @@ SECTIONS
{
*(.infomemnobits)
${RELOCATING+. = ALIGN(2);}
- *(.infomemnobits.*)
+ ${RELOCATING+*(.infomemnobits.*)}
} ${RELOCATING+ > infomemnobits}
/* Read-only sections, merged into text segment. */
@@ -133,7 +139,7 @@ SECTIONS
/* Internal text space. */
.text :
{
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(SORT_NONE(.init))
*(SORT_NONE(.init0)) /* Start here after reset. */
*(SORT_NONE(.init1))
@@ -144,7 +150,7 @@ SECTIONS
*(SORT_NONE(.init6)) /* C++ constructors. */
*(SORT_NONE(.init7))
*(SORT_NONE(.init8))
- *(SORT_NONE(.init9)) /* Call main(). */
+ *(SORT_NONE(.init9)) /* Call main(). */}
${CONSTRUCTING+ __ctors_start = . ; }
${CONSTRUCTING+ *(.ctors) }
@@ -153,19 +159,19 @@ SECTIONS
${CONSTRUCTING+ *(.dtors) }
${CONSTRUCTING+ __dtors_end = . ; }
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(.lower.text.* .lower.text)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);}
*(.text)
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(.text.*)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
*(.text:*)
*(.either.text.* .either.text)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
*(SORT_NONE(.fini9))
*(SORT_NONE(.fini8))
*(SORT_NONE(.fini7))
@@ -178,18 +184,18 @@ SECTIONS
*(SORT_NONE(.fini0)) /* Infinite loop after program termination. */
*(SORT_NONE(.fini))
- _etext = .;
+ _etext = .;}
} ${RELOCATING+ > text}
.rodata :
{
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(.lower.rodata.* .lower.rodata)
. = ALIGN(2);
- *(.plt)
- *(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
- *(.rodata1)
+ *(.plt)}
+ *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.* .const .const:*})
+ ${RELOCATING+*(.rodata1)
*(.either.rodata.*) *(.either.rodata)
*(.eh_frame_hdr)
@@ -230,13 +236,13 @@ SECTIONS
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
+ KEEP (*(.dtors))}
} ${RELOCATING+ > text}
.vectors ${RELOCATING-0}:
{
${RELOCATING+ PROVIDE (__vectors_start = .) ; }
- *(.vectors*)
+ *(.vectors${RELOCATING+*})
${RELOCATING+ _vectors_end = . ; }
} ${RELOCATING+ > vectors}
@@ -244,17 +250,17 @@ SECTIONS
{
${RELOCATING+ PROVIDE (__data_start = .) ; }
${RELOCATING+ PROVIDE (__datastart = .) ; }
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
KEEP (*(.jcr))
*(.data.rel.ro.local) *(.data.rel.ro*)
*(.dynamic)
- ${RELOCATING+. = ALIGN(2);}
- *(.lower.data.* .lower.data)
+ . = ALIGN(2);
+ *(.lower.data.* .lower.data)}
*(.data)
- *(.data.*)
+ ${RELOCATING+*(.data.*)
*(.gnu.linkonce.d*)
KEEP (*(.gnu.linkonce.d.*personality*))
*(.data1)
@@ -262,26 +268,26 @@ SECTIONS
*(.either.data.* .either.data)
*(.got.plt) *(.got)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
*(.sdata .sdata.* .gnu.linkonce.s.*)
- ${RELOCATING+. = ALIGN(2);}
- ${RELOCATING+ _edata = . ; }
- } ${RELOCATING+ > data ${RELOCATING+AT> text}}
+ . = ALIGN(2);
+ _edata = .;}
+ } ${RELOCATING+ > data AT> text}
- __romdatastart = LOADADDR(.data);
- __romdatacopysize = SIZEOF(.data);
+ ${RELOCATING+__romdatastart = LOADADDR(.data);
+ __romdatacopysize = SIZEOF(.data);}
.bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
{
${RELOCATING+. = ALIGN(2);}
${RELOCATING+ PROVIDE (__bss_start = .); }
- ${RELOCATING+ PROVIDE (__bssstart = .); }
+ ${RELOCATING+ PROVIDE (__bssstart = .);
*(.lower.bss.* .lower.bss)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);}
*(.bss)
- *(.either.bss.* .either.bss)
+ ${RELOCATING+*(.either.bss.* .either.bss)
*(COMMON)
- ${RELOCATING+ PROVIDE (__bss_end = .) ; }
+ PROVIDE (__bss_end = .);}
} ${RELOCATING+ > data}
${RELOCATING+ PROVIDE (__bsssize = SIZEOF(.bss)); }
@@ -317,7 +323,7 @@ EOF
. $srcdir/scripttempl/DWARF.sc
-cat <<EOF
+test -n "${RELOCATING}" && cat <<EOF
.MSP430.attributes 0 :
{
KEEP (*(.MSP430.attributes))
@@ -331,5 +337,8 @@ cat <<EOF
PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
PROVIDE (__subdevice_has_heap = ${GOT_HEAP_MSP-0}) ;
+EOF
+
+cat <<EOF
}
EOF
diff --git a/ld/scripttempl/elf32msp430_3.sc b/ld/scripttempl/elf32msp430_3.sc
index 0ed56e5..d808a52 100644
--- a/ld/scripttempl/elf32msp430_3.sc
+++ b/ld/scripttempl/elf32msp430_3.sc
@@ -14,6 +14,9 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
MEMORY
{
text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE
@@ -21,6 +24,9 @@ MEMORY
vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment. */
@@ -86,7 +92,7 @@ SECTIONS
/* Internal text space. */
.text :
{
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(SORT_NONE(.init))
*(SORT_NONE(.init0)) /* Start here after reset. */
*(SORT_NONE(.init1))
@@ -97,7 +103,7 @@ SECTIONS
*(SORT_NONE(.init6)) /* C++ constructors. */
*(SORT_NONE(.init7))
*(SORT_NONE(.init8))
- *(SORT_NONE(.init9)) /* Call main(). */
+ *(SORT_NONE(.init9)) /* Call main(). */}
${CONSTRUCTING+ __ctors_start = . ; }
${CONSTRUCTING+ *(.ctors) }
@@ -108,12 +114,12 @@ SECTIONS
${RELOCATING+. = ALIGN(2);}
*(.text)
- ${RELOCATING+. = ALIGN(2);}
+ ${RELOCATING+. = ALIGN(2);
*(.text.*)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
*(.text:*)
- ${RELOCATING+. = ALIGN(2);}
+ . = ALIGN(2);
*(SORT_NONE(.fini9))
*(SORT_NONE(.fini8))
*(SORT_NONE(.fini7))
@@ -126,14 +132,14 @@ SECTIONS
*(SORT_NONE(.fini0)) /* Infinite loop after program termination. */
*(SORT_NONE(.fini))
- ${RELOCATING+ _etext = . ; }
+ _etext = . ;}
} ${RELOCATING+ > text}
.rodata :
{
- *(.rodata .rodata.* .gnu.linkonce.r.*)
- *(.const)
- *(.const:*)
+ *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*})
+ ${RELOCATING+*(.const)}
+ ${RELOCATING+*(.const:*)}
} ${RELOCATING+ > text}
.data ${RELOCATING-0} :
@@ -141,11 +147,11 @@ SECTIONS
${RELOCATING+ PROVIDE (__data_start = .) ; }
${RELOCATING+. = ALIGN(2);}
*(.data)
- *(.data.*)
- *(.gnu.linkonce.d*)
+ ${RELOCATING+*(.data.*)}
+ ${RELOCATING+*(.gnu.linkonce.d*)}
${RELOCATING+. = ALIGN(2);}
${RELOCATING+ _edata = . ; }
- } ${RELOCATING+ > data ${RELOCATING+AT> text}}
+ } ${RELOCATING+ > data AT> text}
__romdatastart = LOADADDR(.data);
__romdatacopysize = SIZEOF(.data);
@@ -181,7 +187,7 @@ SECTIONS
.vectors ${RELOCATING-0}:
{
${RELOCATING+ PROVIDE (__vectors_start = .) ; }
- *(.vectors*)
+ *(.vectors${RELOCATING+*})
${RELOCATING+ _vectors_end = . ; }
} ${RELOCATING+ > vectors}
@@ -205,11 +211,14 @@ EOF
. $srcdir/scripttempl/DWARF.sc
-cat <<EOF
+test -n "${RELOCATING}" && cat <<EOF
PROVIDE (__stack = ${STACK}) ;
PROVIDE (__data_start_rom = _etext) ;
PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ;
PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
+EOF
+
+cat <<EOF
}
EOF
diff --git a/ld/scripttempl/elf32xc16x.sc b/ld/scripttempl/elf32xc16x.sc
index 3a2c7b5..4c7cc36 100644
--- a/ld/scripttempl/elf32xc16x.sc
+++ b/ld/scripttempl/elf32xc16x.sc
@@ -13,7 +13,10 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
-${RELOCATING+ENTRY ("_start")}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY ("_start")
MEMORY
{
@@ -28,6 +31,9 @@ MEMORY
ldata : o =0x4000 ,l = 0x0200
}
+ELF
+
+cat <<EOF
SECTIONS
{
.init :
@@ -37,15 +43,15 @@ SECTIONS
.text :
{
- *(.rodata)
- *(.text.*)
+ ${RELOCATING+*(.rodata)}
+ ${RELOCATING+*(.text.*)}
*(.text)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > introm}
.data :
{
*(.data)
- *(.data.*)
+ ${RELOCATING+*(.data.*)}
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > dram}
@@ -54,7 +60,7 @@ SECTIONS
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ _end = . ; }
} ${RELOCATING+ > dram}
diff --git a/ld/scripttempl/elf32xc16xl.sc b/ld/scripttempl/elf32xc16xl.sc
index 545df67..0b47319 100644
--- a/ld/scripttempl/elf32xc16xl.sc
+++ b/ld/scripttempl/elf32xc16xl.sc
@@ -13,7 +13,10 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
-${RELOCATING+ENTRY ("_start")}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY ("_start")
MEMORY
{
vectarea : o =0xc00000, l = 0x0300
@@ -26,6 +29,9 @@ MEMORY
ldata : o =0x4000 ,l = 0x0200
}
+EOF
+
+cat <<EOF
SECTIONS
{
/*.vects :
@@ -39,15 +45,15 @@ SECTIONS
.text :
{
- *(.rodata)
- *(.text.*)
+ ${RELOCATING+*(.rodata)}
+ ${RELOCATING+*(.text.*)}
*(.text)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > introm}
.data :
{
*(.data)
- *(.data.*)
+ ${RELOCATING+*(.data.*)}
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > dram}
@@ -56,7 +62,7 @@ SECTIONS
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ _end = . ; }
} ${RELOCATING+ > dram}
diff --git a/ld/scripttempl/elf32xc16xs.sc b/ld/scripttempl/elf32xc16xs.sc
index 545df67..89672f9 100644
--- a/ld/scripttempl/elf32xc16xs.sc
+++ b/ld/scripttempl/elf32xc16xs.sc
@@ -13,7 +13,10 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
-${RELOCATING+ENTRY ("_start")}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY ("_start")
MEMORY
{
vectarea : o =0xc00000, l = 0x0300
@@ -26,6 +29,10 @@ MEMORY
ldata : o =0x4000 ,l = 0x0200
}
+
+EOF
+
+cat <<EOF
SECTIONS
{
/*.vects :
@@ -39,15 +46,15 @@ SECTIONS
.text :
{
- *(.rodata)
- *(.text.*)
+ ${RELOCATING+*(.rodata)}
+ ${RELOCATING+*(.text.*)}
*(.text)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > introm}
.data :
{
*(.data)
- *(.data.*)
+ ${RELOCATING+*(.data.*)}
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > dram}
@@ -56,7 +63,7 @@ SECTIONS
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ _end = . ; }
} ${RELOCATING+ > dram}
diff --git a/ld/scripttempl/elf64hppa.sc b/ld/scripttempl/elf64hppa.sc
index 9b1d34e..1bed674 100644
--- a/ld/scripttempl/elf64hppa.sc
+++ b/ld/scripttempl/elf64hppa.sc
@@ -123,7 +123,7 @@ fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
else
GOT=".got ${RELOCATING-0} : { *(.got) }"
GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
@@ -138,9 +138,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+${SBSS_START_SYMBOLS}}
${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+${SBSS_END_SYMBOLS}}
}"
SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
@@ -433,7 +433,7 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -443,7 +443,7 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -496,15 +496,15 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
- pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ ${RELOCATING+*(.dynbss)}
+ *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections.
+ FIXME: Why do we need it? When there is no .bss section, we do not
+ pad the .data section. */
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}
${OTHER_BSS_SECTIONS}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
diff --git a/ld/scripttempl/elf_chaos.sc b/ld/scripttempl/elf_chaos.sc
index 85f40ab..9db5b73 100644
--- a/ld/scripttempl/elf_chaos.sc
+++ b/ld/scripttempl/elf_chaos.sc
@@ -238,7 +238,7 @@ cat <<EOF
EOF
fi
cat <<EOF
- . = ALIGN(0x1000);
+ ${RELOCATING+. = ALIGN(0x1000);}
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
${OTHER_PLT_RELOC_SECTIONS}
@@ -260,36 +260,36 @@ cat <<EOF
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
${RELOCATING+PROVIDE (etext = .);}
- . = ALIGN(0x1000);
+ ${RELOCATING+. = ALIGN(0x1000);}
${CREATE_SHLIB-${SDATA2}}
${CREATE_SHLIB-${SBSS2}}
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
- . = ALIGN(0x1000);
+ ${RELOCATING+. = ALIGN(0x1000);}
.data ${RELOCATING-0} :
{
- *(.rodata .rodata.*)
+ ${RELOCATING+*(.rodata .rodata.*)
*(.rodata1)
*(.gnu.linkonce.r.*)
- ${RELOCATING+${DATA_START_SYMBOLS}}
+ ${DATA_START_SYMBOLS}}
*(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
${CONSTRUCTING+SORT(CONSTRUCTORS)}
- KEEP (*(.eh_frame))
+ ${RELOCATING+KEEP (*(.eh_frame))
*(.gcc_except_table)
${CTOR}
${DTOR}
- KEEP (*(.jcr))
+ KEEP (*(.jcr))}
}
.data1 ${RELOCATING-0} : { *(.data1) }
- . = ALIGN(0x1000);
+ ${RELOCATING+. = ALIGN(0x1000);}
.gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) }
${WRITABLE_RODATA+${RODATA}}
${OTHER_READWRITE_SECTIONS}
${TEXT_DYNAMIC-${DYNAMIC}}
${DATA_PLT+${PLT}}
${RELOCATING+${OTHER_GOT_SYMBOLS}}
- .got ${RELOCATING-0} : { *(.got.plt) *(.got) }
+ .got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }
${OTHER_GOT_SECTIONS}
${CREATE_SHLIB+${SDATA2}}
${CREATE_SHLIB+${SBSS2}}
@@ -301,16 +301,16 @@ cat <<EOF
${RELOCATING+${OTHER_BSS_SYMBOLS}}
${SBSS}
${BSS_PLT+${PLT}}
- . = ALIGN(0x1000);
+ ${RELOCATING+. = ALIGN(0x1000);}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ . = ALIGN(${ALIGNMENT});}
}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
@@ -320,7 +320,6 @@ cat <<EOF
${STACK_ADDR+${STACK}}
/* Stabs debugging sections. */
- . = ALIGN(0x1000);
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
@@ -328,7 +327,6 @@ cat <<EOF
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
- . = ALIGN(0x1000);
.comment 0 : { *(.comment) }
EOF
diff --git a/ld/scripttempl/elfarc.sc b/ld/scripttempl/elfarc.sc
index 802ef91..c1a0b3c 100644
--- a/ld/scripttempl/elfarc.sc
+++ b/ld/scripttempl/elfarc.sc
@@ -84,7 +84,7 @@ if test -n "${COMMONPAGESIZE}"; then
fi
INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
PLT=".plt ${RELOCATING-0} : { *(.plt) }"
-test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
+test -z "$GOT" && GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }"
@@ -93,9 +93,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+PROVIDE (__sbss_start = .);}
${RELOCATING+PROVIDE (___sbss_start = .);}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+PROVIDE (__sbss_end = .);}
${RELOCATING+PROVIDE (___sbss_end = .);}
}"
@@ -265,8 +265,8 @@ cat <<EOF
.jlitab ${RELOCATING-0} :
{
${RELOCATING+${JLI_START_TABLE}}
- jlitab*.o(.jlitab*)
- *(.jlitab*)
+ ${RELOCATING+jlitab*.o(.jlitab*)}
+ *(.jlitab${RELOCATING+*})
} =${NOP-0}
.text ${RELOCATING-0} :
{
@@ -295,7 +295,7 @@ cat <<EOF
${CREATE_SHLIB-${SBSS2}}
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -304,7 +304,7 @@ cat <<EOF
${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
/* Exception handling */
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
@@ -360,13 +360,13 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+*(.dynbss)}
+ *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(${ALIGNMENT});}
}
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
@@ -374,27 +374,31 @@ cat <<EOF
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
+EOF
+test -n "${RELOCATING}" && cat <<EOF
/* We want to be able to set a default stack / heap size in a dejagnu
board description file, but override it for selected test cases.
The options appear in the wrong order to do this with a single symbol -
ldflags comes after flags injected with per-file stanzas, and thus
the setting from ldflags prevails. */
- .heap ${RELOCATING-0} :
+ .heap :
{
- ${RELOCATING+ __start_heap = . ; }
- ${RELOCATING+ . = . + (DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : (DEFINED(__DEFAULT_HEAP_SIZE) ? __DEFAULT_HEAP_SIZE : 20k)) ; }
- ${RELOCATING+ __end_heap = . ; }
+ __start_heap = . ;
+ . = . + (DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : (DEFINED(__DEFAULT_HEAP_SIZE) ? __DEFAULT_HEAP_SIZE : 20k)) ;
+ __end_heap = . ;
}
- ${RELOCATING+. = ALIGN(0x8);}
- .stack ${RELOCATING-0} :
+ . = ALIGN(0x8);
+ .stack :
{
- ${RELOCATING+ __stack = . ; }
- ${RELOCATING+ . = . + (DEFINED(__STACK_SIZE) ? __STACK_SIZE : (DEFINED(__DEFAULT_STACK_SIZE) ? __DEFAULT_STACK_SIZE : 64k)) ; }
- ${RELOCATING+ __stack_top = . ; }
+ __stack = . ;
+ . = . + (DEFINED(__STACK_SIZE) ? __STACK_SIZE : (DEFINED(__DEFAULT_STACK_SIZE) ? __DEFAULT_STACK_SIZE : 64k)) ;
+ __stack_top = . ;
}
+EOF
+cat <<EOF
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
@@ -422,7 +426,7 @@ cat <<EOF
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
- .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
diff --git a/ld/scripttempl/elfarcv2.sc b/ld/scripttempl/elfarcv2.sc
index ccc608e..1027123 100644
--- a/ld/scripttempl/elfarcv2.sc
+++ b/ld/scripttempl/elfarcv2.sc
@@ -12,7 +12,7 @@ test -z "$ENTRY" && ENTRY=start
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
# If we request a big endian toolchain, give a big endian linker
-test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } ${RELOCATING+ > ${DATA_MEMORY}}"
+test -z "$GOT" && GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) } ${RELOCATING+ > ${DATA_MEMORY}}"
test "${ARC_ENDIAN}" == "big" && OUTPUT_FORMAT=${BIG_OUTPUT_FORMAT}
if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
test -z "${ELFSIZE}" && ELFSIZE=32
@@ -177,12 +177,13 @@ SECTIONS
.jcr : { KEEP (*(.jcr)) } ${RELOCATING+> ${TEXT_MEMORY}}
.eh_frame : { KEEP (*(.eh_frame)) } ${RELOCATING+> ${TEXT_MEMORY}}
- .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } ${RELOCATING+> ${TEXT_MEMORY}}
+ .gcc_except_table : { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } ${RELOCATING+> ${TEXT_MEMORY}}
.plt : { *(.plt) } ${RELOCATING+> ${TEXT_MEMORY}}
.jlitab :
{
${RELOCATING+${JLI_START_TABLE}}
- jlitab*.o:(.jlitab*) *(.jlitab*)
+ ${RELOCATING+jlitab*.o:(.jlitab*)}
+ *(.jlitab${RELOCATING+*})
} ${RELOCATING+> ${TEXT_MEMORY}}
.rodata ${RELOCATING-0} :
@@ -236,7 +237,7 @@ SECTIONS
line will have no effect, see PR13697. Thus, keep .data */
KEEP (*(.data))
${RELOCATING+${DATA_START_SYMBOLS}}
- *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
+ ${RELOCATING+*(.data.* .gnu.linkonce.d.*)}
${CONSTRUCTING+SORT(CONSTRUCTORS)}
} ${RELOCATING+ > ${DATA_MEMORY}}
@@ -251,13 +252,13 @@ SECTIONS
${RELOCATING+${SBSS2}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+*(.dynbss)}
+ *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
${RELOCATING+PROVIDE (end = .);}
} ${RELOCATING+ > ${DATA_MEMORY}}
@@ -298,7 +299,7 @@ SECTIONS
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
- .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
diff --git a/ld/scripttempl/elfd10v.sc b/ld/scripttempl/elfd10v.sc
index d21f580f..b79e95e 100644
--- a/ld/scripttempl/elfd10v.sc
+++ b/ld/scripttempl/elfd10v.sc
@@ -70,12 +70,15 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${OUTPUT_ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+/* Do we need any of these for elf?
- __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
+${LIB_SEARCH_DIRS}
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */
+${EXECUTABLE_SYMBOLS}
MEMORY
{
@@ -94,47 +97,50 @@ MEMORY
STACK : org = 0x0200BFFC, len = 4
}
+EOF
+
+cat <<EOF
SECTIONS
{
.text ${RELOCATING+${TEXT_START_ADDR}} :
{
- ${RELOCATING+${TEXT_START_SYMBOLS}}
+ ${RELOCATING+${TEXT_START_SYMBOLS}
KEEP (*(SORT_NONE(.init)))
KEEP (*(SORT_NONE(.init.*)))
KEEP (*(SORT_NONE(.fini)))
- KEEP (*(SORT_NONE(.fini.*)))
+ KEEP (*(SORT_NONE(.fini.*)))}
*(.text)
- *(.text.*)
+ ${RELOCATING+*(.text.*)}
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
- *(.gnu.linkonce.t*)
- ${RELOCATING+_etext = .;}
- ${RELOCATING+PROVIDE (etext = .);}
+ ${RELOCATING+*(.gnu.linkonce.t*)
+ _etext = .;
+ PROVIDE (etext = .);}
} ${RELOCATING+ >INSN} =${NOP-0}
.rodata ${RELOCATING+${READONLY_START_ADDR}} : {
*(.rodata)
- *(.gnu.linkonce.r*)
- *(.rodata.*)
+ ${RELOCATING+*(.gnu.linkonce.r*)
+ *(.rodata.*)}
} ${RELOCATING+ >DATA}
.rodata1 ${RELOCATING-0} : {
*(.rodata1)
- *(.rodata1.*)
+ ${RELOCATING+*(.rodata1.*)}
} ${RELOCATING+ >DATA}
.data ${RELOCATING-0} :
{
${RELOCATING+${DATA_START_SYMBOLS}}
*(.data)
- *(.data.*)
- *(.gnu.linkonce.d*)
+ ${RELOCATING+*(.data.*)
+ *(.gnu.linkonce.d*)}
${CONSTRUCTING+CONSTRUCTORS}
} ${RELOCATING+ >DATA}
.data1 ${RELOCATING-0} : {
*(.data1)
- *(.data1.*)
+ ${RELOCATING+*(.data1.*)}
} ${RELOCATING+ >DATA}
${RELOCATING+${CTOR} >DATA}
@@ -145,20 +151,20 @@ SECTIONS
we can shorten the on-disk segment size. */
.sdata ${RELOCATING-0} : {
*(.sdata)
- *(.sdata.*)
+ ${RELOCATING+*(.sdata.*)}
} ${RELOCATING+ >DATA}
${RELOCATING+_edata = .;}
${RELOCATING+PROVIDE (edata = .);}
${RELOCATING+__bss_start = .;}
- .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } ${RELOCATING+ >DATA}
+ .sbss ${RELOCATING-0} : { *(.sbss)${RELOCATING+ *(.scommon)} } ${RELOCATING+ >DATA}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
- *(.dynbss.*)
+ ${RELOCATING+*(.dynbss)
+ *(.dynbss.*)}
*(.bss)
- *(.bss.*)
- *(COMMON)
+ ${RELOCATING+*(.bss.*)
+ *(COMMON)}
} ${RELOCATING+ >DATA}
${RELOCATING+_end = . ;}
diff --git a/ld/scripttempl/elfd30v.sc b/ld/scripttempl/elfd30v.sc
index 388a578..8e306ca 100644
--- a/ld/scripttempl/elfd30v.sc
+++ b/ld/scripttempl/elfd30v.sc
@@ -52,6 +52,9 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
MEMORY
{
text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE}
@@ -60,6 +63,9 @@ MEMORY
eit : ORIGIN = ${EIT_START_ADDR}, LENGTH = ${EIT_SIZE}
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment: */
@@ -71,12 +77,12 @@ SECTIONS
.gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
.gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
- .rel.text ${RELOCATING-0} : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
- .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
- .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
- .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
- .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
- .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+ .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.gnu.linkonce.t*}) }
+ .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.gnu.linkonce.t*}) }
+ .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.gnu.linkonce.d*}) }
+ .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.gnu.linkonce.d*}) }
+ .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.gnu.linkonce.r*}) }
+ .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.gnu.linkonce.r*}) }
.rel.stext ${RELOCATING-0} : { *(.rel.stest) }
.rela.stext ${RELOCATING-0} : { *(.rela.stest) }
.rel.etext ${RELOCATING-0} : { *(.rel.etest) }
@@ -120,10 +126,10 @@ SECTIONS
.text :
{
*(.text)
- *(.gnu.linkonce.t*)
+ ${RELOCATING+*(.gnu.linkonce.t*)
*(SORT_NONE(.init))
*(SORT_NONE(.fini))
- ${RELOCATING+ _etext = . ; }
+ _etext = . ;}
} ${RELOCATING+ > ${TEXT_MEMORY}}
/* Internal data space */
@@ -146,7 +152,7 @@ SECTIONS
.data ${RELOCATING-0} :
{
*(.data)
- *(.gnu.linkonce.d*)
+ ${RELOCATING+*(.gnu.linkonce.d*)}
${CONSTRUCTING+CONSTRUCTORS}
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ${DATA_MEMORY}}
@@ -180,7 +186,7 @@ SECTIONS
{
${RELOCATING+ PROVIDE (__bss_start = .) ; }
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ PROVIDE (__bss_end = .) ; }
${RELOCATING+ _end = . ; }
} ${RELOCATING+ > ${DATA_MEMORY}}
@@ -207,10 +213,9 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- PROVIDE (__stack = ${STACK_START_ADDR});
+ ${RELOCATING+PROVIDE (__stack = ${STACK_START_ADDR});}
}
EOF
-
diff --git a/ld/scripttempl/elfm68hc11.sc b/ld/scripttempl/elfm68hc11.sc
index df7694f..ae1bfd6 100644
--- a/ld/scripttempl/elfm68hc11.sc
+++ b/ld/scripttempl/elfm68hc11.sc
@@ -410,12 +410,11 @@ SECTIONS
${RELOCATING+__bss_start = .;}
${RELOCATING+*(.sbss)}
${RELOCATING+*(.scommon)}
-
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+PROVIDE (_end = .);}
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
@@ -424,7 +423,7 @@ SECTIONS
.eeprom ${RELOCATING-0} :
{
*(.eeprom)
- *(.eeprom.*)
+ ${RELOCATING+*(.eeprom.*)}
} ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
diff --git a/ld/scripttempl/elfm68hc12.sc b/ld/scripttempl/elfm68hc12.sc
index 4b8154a..4690ab6 100644
--- a/ld/scripttempl/elfm68hc12.sc
+++ b/ld/scripttempl/elfm68hc12.sc
@@ -413,12 +413,11 @@ SECTIONS
${RELOCATING+*(.softregs)}
${RELOCATING+*(.sbss)}
${RELOCATING+*(.scommon)}
-
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+PROVIDE (_end = .);}
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
@@ -427,7 +426,7 @@ SECTIONS
.eeprom ${RELOCATING-0} :
{
*(.eeprom)
- *(.eeprom.*)
+ ${RELOCATING+*(.eeprom.*)}
} ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
diff --git a/ld/scripttempl/elfm9s12z.sc b/ld/scripttempl/elfm9s12z.sc
index 5553aeb..b14c68b 100644
--- a/ld/scripttempl/elfm9s12z.sc
+++ b/ld/scripttempl/elfm9s12z.sc
@@ -173,7 +173,7 @@ ${RELOCATING+${LIB_SEARCH_DIRS}}
${RELOCATING+${EXECUTABLE_SYMBOLS}}
${RELOCATING+${MEMORY_DEF}}
-PROVIDE (_start = $[$ROM_TOP - $ROM_SIZE + 1]);
+${RELOCATING+PROVIDE (_start = $[$ROM_TOP - $ROM_SIZE + 1]);}
SECTIONS
{
.hash ${RELOCATING-0} : { *(.hash) }
@@ -403,12 +403,11 @@ SECTIONS
${RELOCATING+*(.sbss)}
${RELOCATING+*(.common)}
${RELOCATING+*(.scommon)}
-
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+PROVIDE (_end = .);}
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
@@ -417,7 +416,7 @@ SECTIONS
.eeprom ${RELOCATING-0} :
{
*(.eeprom)
- *(.eeprom.*)
+ ${RELOCATING+*(.eeprom.*)}
} ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
diff --git a/ld/scripttempl/elfmicroblaze.sc b/ld/scripttempl/elfmicroblaze.sc
index d8f7569..4a7c196 100644
--- a/ld/scripttempl/elfmicroblaze.sc
+++ b/ld/scripttempl/elfmicroblaze.sc
@@ -63,9 +63,9 @@ ${RELOCATING+${LIB_SEARCH_DIRS}}
${RELOCATING+ENTRY (${ENTRY})}
-_TEXT_START_ADDR = DEFINED(_TEXT_START_ADDR) ? _TEXT_START_ADDR : 0x50;
+${RELOCATING+_TEXT_START_ADDR = DEFINED(_TEXT_START_ADDR) ? _TEXT_START_ADDR : 0x50;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x0;
-_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400;
+_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400;}
SECTIONS
{
@@ -79,7 +79,7 @@ SECTIONS
${RELOCATING+ _ftext = .;}
.text : {
- ${RELOCATING+*(.text)}
+ *(.text)
${RELOCATING+*(.text.*)}
${RELOCATING+*(.gnu.linkonce.t.*)}
}
@@ -103,10 +103,10 @@ SECTIONS
${RELOCATING+ . = ALIGN(4);}
${RELOCATING+ _frodata = . ;}
.rodata : {
- ${RELOCATING+*(.rodata)}
+ *(.rodata)
${RELOCATING+*(.rodata.*)}
${RELOCATING+*(.gnu.linkonce.r.*)}
- ${CONSTRUCTING+CONSTRUCTORS}; /* Is this needed? */
+ ${CONSTRUCTING+CONSTRUCTORS;} /* Is this needed? */
}
${RELOCATING+ _erodata = .;}
@@ -115,14 +115,14 @@ SECTIONS
${RELOCATING+. = ALIGN(8);}
${RELOCATING+ _ssrw = .;}
.sdata2 : {
- ${RELOCATING+*(.sdata2)}
+ *(.sdata2)
${RELOCATING+*(.sdata2.*)}
${RELOCATING+*(.gnu.linkonce.s2.*)}
}
${RELOCATING+. = ALIGN(4);}
.sbss2 : {
${RELOCATING+PROVIDE (__sbss2_start = .);}
- ${RELOCATING+*(.sbss2)}
+ *(.sbss2)
${RELOCATING+*(.sbss2.*)}
${RELOCATING+*(.gnu.linkonce.sb2.*)}
${RELOCATING+PROVIDE (__sbss2_end = .);}
@@ -135,36 +135,36 @@ SECTIONS
${RELOCATING+ . = ALIGN(4);}
${RELOCATING+ _fdata = .;}
.data : {
- ${RELOCATING+*(.data)}
+ *(.data)
${RELOCATING+*(.gnu.linkonce.d.*)}
- ${CONSTRUCTING+CONSTRUCTORS}; /* Is this needed? */
+ ${CONSTRUCTING+CONSTRUCTORS;} /* Is this needed? */
}
${RELOCATING+ _edata = . ;}
/* Added to handle pic code */
.got : {
- ${RELOCATING+*(.got)}
+ *(.got)
}
.got1 : {
- ${RELOCATING+*(.got1)}
+ *(.got1)
}
.got2 : {
- ${RELOCATING+*(.got2)}
+ *(.got2)
}
/* Added by Sathya to handle C++ exceptions */
.eh_frame : {
- ${RELOCATING+*(.eh_frame)}
+ *(.eh_frame)
}
.jcr : {
- ${RELOCATING+*(.jcr)}
+ *(.jcr)
}
.gcc_except_table : {
- ${RELOCATING+*(.gcc_except_table)}
+ *(.gcc_except_table)
}
/* Alignments by 8 to ensure that _SDA_BASE_ on a word boundary */
@@ -172,14 +172,14 @@ SECTIONS
${RELOCATING+. = ALIGN(8);}
${RELOCATING+ _ssro = .;}
.sdata : {
- ${RELOCATING+*(.sdata)}
+ *(.sdata)
${RELOCATING+*(.sdata.*)}
${RELOCATING+*(.gnu.linkonce.s.*)}
}
${RELOCATING+. = ALIGN(4);}
.sbss : {
${RELOCATING+PROVIDE (__sbss_start = .);}
- ${RELOCATING+*(.sbss)}
+ *(.sbss)
${RELOCATING+*(.sbss.*)}
${RELOCATING+*(.gnu.linkonce.sb.*)}
${RELOCATING+PROVIDE (__sbss_end = .);}
@@ -193,14 +193,13 @@ SECTIONS
${RELOCATING+ _fbss = .;}
.bss : {
${RELOCATING+PROVIDE (__bss_start = .);}
- ${RELOCATING+*(.bss)}
+ *(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
${RELOCATING+*(COMMON)}
${RELOCATING+. = ALIGN(. != 0 ? 4 : 1);}
${RELOCATING+PROVIDE (__bss_end = .);}
-
}
${RELOCATING+ . = ALIGN(4);}
@@ -223,12 +222,12 @@ SECTIONS
}
.tdata : {
- ${RELOCATING+*(.tdata)}
+ *(.tdata)
${RELOCATING+*(.tdata.*)}
${RELOCATING+*(.gnu.linkonce.td.*)}
}
.tbss : {
- ${RELOCATING+*(.tbss)}
+ *(.tbss)
${RELOCATING+*(.tbss.*)}
${RELOCATING+*(.gnu.linkonce.tb.*)}
}
diff --git a/ld/scripttempl/elfxgate.sc b/ld/scripttempl/elfxgate.sc
index f5d4911..083876a 100644
--- a/ld/scripttempl/elfxgate.sc
+++ b/ld/scripttempl/elfxgate.sc
@@ -413,12 +413,11 @@ SECTIONS
${RELOCATING+*(.softregs)}
${RELOCATING+*(.sbss)}
${RELOCATING+*(.scommon)}
-
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+PROVIDE (_end = .);}
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
@@ -427,7 +426,7 @@ SECTIONS
.eeprom ${RELOCATING-0} :
{
*(.eeprom)
- *(.eeprom.*)
+ ${RELOCATING+*(.eeprom.*)}
} ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
index 7350d2d..63448e1 100644
--- a/ld/scripttempl/elfxtensa.sc
+++ b/ld/scripttempl/elfxtensa.sc
@@ -136,7 +136,7 @@ fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
else
GOT=".got ${RELOCATING-0} : { *(.got) }"
GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
@@ -410,7 +410,7 @@ cat <<EOF
${TINY_READONLY_SECTION}
.text ${RELOCATING-0} :
{
- *(.got.plt* .plt*)
+ ${RELOCATING+*(.got.plt* .plt*)}
${RELOCATING+${INIT_START}}
${RELOCATING+KEEP (*(.init.literal))}
@@ -442,7 +442,7 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -452,7 +452,7 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -506,15 +506,15 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
- pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ ${RELOCATING+*(.dynbss)}
+ *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections.
+ FIXME: Why do we need it? When there is no .bss section, we do not
+ pad the .data section. */
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}
${OTHER_BSS_SECTIONS}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
diff --git a/ld/scripttempl/epiphany_4x4.sc b/ld/scripttempl/epiphany_4x4.sc
index d8718e8..41b2b50 100644
--- a/ld/scripttempl/epiphany_4x4.sc
+++ b/ld/scripttempl/epiphany_4x4.sc
@@ -123,7 +123,7 @@ fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
else
GOT=".got ${RELOCATING-0} : { *(.got) }"
GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
@@ -138,9 +138,9 @@ if test -z "${NO_SMALL_DATA}"; then
{
${RELOCATING+${SBSS_START_SYMBOLS}}
${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+${SBSS_END_SYMBOLS}}
}"
SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
@@ -150,7 +150,7 @@ if test -z "${NO_SMALL_DATA}"; then
.sdata ${RELOCATING-0} :
{
${RELOCATING+${SDATA_START_SYMBOLS}}
- ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
+ ${RELOCATING+${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}}
*(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
}"
SDATA2=".sdata2 ${RELOCATING-0} :
@@ -191,9 +191,9 @@ test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS="
${OTHER_BSS_SECTIONS}
.lbss ${RELOCATING-0} :
{
- *(.dynlbss)
+ ${RELOCATING+*(.dynlbss)}
*(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
- *(LARGE_COMMON)
+ ${RELOCATING+*(LARGE_COMMON)}
}"
test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
.lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
@@ -259,16 +259,13 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${OUTPUT_ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
-
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING+${INPUT_FILES}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
- if gld -r is used and the intermediate file has sections starting
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
- bug. But for now assigning the zero vmas works. */}
+EOF
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
+${EXECUTABLE_SYMBOLS}
+${INPUT_FILES}
/* BSP specific*/
__PROG_SIZE_FOR_CORE__ = 1M;
@@ -284,8 +281,8 @@ __FIRST_CORE_COL_ = 0x24;
PROVIDE (__CORE_ROW_ = __FIRST_CORE_ROW_);
PROVIDE (__CORE_COL_ = __FIRST_CORE_COL_);
-/* generic don't touch */
-/* used to calculated the slice address in the external memory*/
+/* generic do not touch */
+/* used to calculated the slice address in the external memory */
__CORE_NUM_ = (__CORE_ROW_ - __FIRST_CORE_ROW_ )* __MAX_NUM_CORES_IN_COLS__ + (__CORE_COL_ - __FIRST_CORE_COL_ ) ;
@@ -331,10 +328,14 @@ MEMORY
}
+EOF
+cat <<EOF
SECTIONS
{
+EOF
+test -n "${RELOCATING}" && cat <<EOF
IVT 0 : {*.o(IVT) } > RESERVED_CRT0_RAM
RESERVED_CRT0 : {*.o(RESERVED_CRT0) } > RESERVED_CRT0_RAM
RESERVED_CRT0 : {*.o(reserved_crt0) } > RESERVED_CRT0_RAM
@@ -354,7 +355,7 @@ SECTIONS
__new_lib_start_external_ = ( ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ *__CORE_NUM_ );
__new_lib_start_ = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ORIGIN(BANK1_SRAM) : __new_lib_start_external_ ;
- NEW_LIB_RO ${RELOCATING+__new_lib_start_} : { lib_a-*.o(.text .rodata ) *.o(libgloss_epiphany) } /* > INTERNAL_RAM*/
+ NEW_LIB_RO __new_lib_start_ : { lib_a-*.o(.text .rodata) *.o(libgloss_epiphany) } /* > INTERNAL_RAM */
GNU_C_BUILTIN_LIB_RO ADDR(NEW_LIB_RO) + SIZEOF(NEW_LIB_RO) : {
*mulsi3.o(.text .rodata) *modsi3.o(.text .rodata)
*divsi3.o(.text .rodata) *udivsi3.o(.text .rodata)
@@ -366,8 +367,9 @@ SECTIONS
__init_start = DEFINED(__USE_INTERNAL_MEM_) ? ORIGIN(BANK1_SRAM) : (ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) ) ;
__init_start = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) : __init_start;
+EOF
-
+cat <<EOF
/* Read-only sections, merged into text segment: */
/*${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}*/
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
@@ -467,12 +469,12 @@ fi
cat <<EOF
- .init __init_start :
+ .init ${RELOCATING+__init_start} :
{
${RELOCATING+${INIT_START}}
KEEP (*(.init))
${RELOCATING+${INIT_END}}
- } /*> INTERNAL_RAM*/ =${NOP-0}
+ } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0}
${TEXT_PLT+${PLT}}
${TINY_READONLY_SECTION}
@@ -482,7 +484,7 @@ cat <<EOF
${RELOCATING+${FINI_START}}
KEEP (*(.fini))
${RELOCATING+${FINI_END}}
- } /*> INTERNAL_RAM*/ =${NOP-0}
+ } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0}
.text ${RELOCATING+ADDR(.fini)+SIZEOF(.fini)} ${RELOCATING-0} :
{
@@ -491,7 +493,7 @@ cat <<EOF
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
${RELOCATING+${OTHER_TEXT_SECTIONS}}
- } /*> INTERNAL_RAM */ =${NOP-0}
+ } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0}
${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
@@ -503,7 +505,7 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -513,7 +515,7 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -528,7 +530,7 @@ cat <<EOF
.init_array ${RELOCATING-0} :
{
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
+ ${RELOCATING+KEEP (*(SORT(.init_array.*)))}
KEEP (*(.init_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
}
@@ -536,7 +538,7 @@ cat <<EOF
{
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
KEEP (*(.fini_array))
- KEEP (*(SORT(.fini_array.*)))
+ ${RELOCATING+KEEP (*(SORT(.fini_array.*)))}
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
}
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
@@ -560,7 +562,7 @@ cat <<EOF
${RELOCATING+${DATA_START_SYMBOLS}}
*(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
${CONSTRUCTING+SORT(CONSTRUCTORS)}
- } /*> INTERNAL_RAM*/
+ } /* ${RELOCATING+ > INTERNAL_RAM} */
.data1 ${RELOCATING-0} : { *(.data1) }
${WRITABLE_RODATA+${RODATA}}
${OTHER_READWRITE_SECTIONS}
@@ -583,16 +585,16 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING+ADDR(.rodata)+SIZEOF(.rodata)} ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
+ FIXME: Why do we need it? When there is no .bss section, we do not
pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
- } /*> INTERNAL_RAM*/
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ } /* ${RELOCATING+ > INTERNAL_RAM} */
${OTHER_BSS_SECTIONS}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
@@ -603,11 +605,11 @@ cat <<EOF
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
- PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;
+ ${RELOCATING+PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;}
.stack ${RELOCATING+__stack_start_} : { ${RELOCATING+___stack = .;} *(.stack) }
- PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );
- PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );
+ ${RELOCATING+PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );}
+ ${RELOCATING+PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );}
EOF
if test -n "${NON_ALLOC_DYN}"; then
diff --git a/ld/scripttempl/ft32.sc b/ld/scripttempl/ft32.sc
index 7119652..2d7d647 100644
--- a/ld/scripttempl/ft32.sc
+++ b/ld/scripttempl/ft32.sc
@@ -7,13 +7,15 @@ TORS=".tors :
*(.dtors)
___dtors_end = . ;
. = ALIGN(4);
- } > ram"
+ } ${RELOCATING+ > ram}"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
${LIB_SEARCH_DIRS}
+EOF
+test -n "${RELOCATING}" && cat <<EOF
/* Allow the command line to override the memory region sizes. */
__PMSIZE = DEFINED(__PMSIZE) ? __PMSIZE : 256K;
__RAMSIZE = DEFINED(__RAMSIZE) ? __RAMSIZE : 64K;
@@ -23,35 +25,37 @@ MEMORY
flash (rx) : ORIGIN = 0, LENGTH = __PMSIZE
ram (rw!x) : ORIGIN = 0x800000, LENGTH = __RAMSIZE
}
+EOF
+cat <<EOF
SECTIONS
{
.text :
{
- *(.text*)
- *(.strings)
+ *(.text${RELOCATING+*})
+ ${RELOCATING+*(.strings)
*(._pm*)
*(.init)
*(.fini)
- ${RELOCATING+ _etext = . ; }
- . = ALIGN(4);
+ _etext = .;
+ . = ALIGN(4);}
} ${RELOCATING+ > flash}
${CONSTRUCTING+${TORS}}
.data : ${RELOCATING+ AT (ADDR (.text) + SIZEOF (.text))}
{
*(.data)
- *(.rodata)
+ ${RELOCATING+*(.rodata)
*(.rodata*)
- ${RELOCATING+ _edata = . ; }
- . = ALIGN(4);
+ _edata = .;
+ . = ALIGN(4);}
} ${RELOCATING+ > ram}
.bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
{
${RELOCATING+ _bss_start = . ; }
*(.bss)
- *(COMMON)
- ${RELOCATING+ _end = . ; }
- . = ALIGN(4);
+ ${RELOCATING+*(COMMON)
+ _end = .;
+ . = ALIGN(4);}
} ${RELOCATING+ > ram}
${RELOCATING+ __data_load_start = LOADADDR(.data); }
diff --git a/ld/scripttempl/hppaelf.sc b/ld/scripttempl/hppaelf.sc
index c06a493..c74f6d0 100644
--- a/ld/scripttempl/hppaelf.sc
+++ b/ld/scripttempl/hppaelf.sc
@@ -22,30 +22,30 @@ SECTIONS
{
.text 0x1000 ${RELOCATING++${TEXT_START_ADDR}}:
{
- ${RELOCATING+__text_start = .};
- CREATE_OBJECT_SYMBOLS
+ ${RELOCATING+__text_start = .;
+ CREATE_OBJECT_SYMBOLS}
*(.PARISC.stubs)
*(.text)
- ${RELOCATING+etext = .};
- ${RELOCATING+_etext = .};
+ ${RELOCATING+etext = .;
+ _etext = .;}
}
${RELOCATING+. = ${DATA_ADDR};}
.data :
{
- ${RELOCATING+ . = . + 0x1000 };
- ${RELOCATING+__data_start = .};
+ ${RELOCATING+. = . + 0x1000;
+ __data_start = .;}
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
- ${RELOCATING+edata = .};
- ${RELOCATING+_edata = .};
+ ${RELOCATING+edata = .;
+ _edata = .;}
}
${RELOCATING+. = ${DATA_ADDR} + SIZEOF(.data);}
.bss :
{
*(.bss)
- *(COMMON)
- ${RELOCATING+end = . };
- ${RELOCATING+_end = . };
+ ${RELOCATING+*(COMMON)
+ end = .;
+ _end = .;}
}
}
EOF
diff --git a/ld/scripttempl/ia64vms.sc b/ld/scripttempl/ia64vms.sc
index 11c95bd..9b83ffa 100644
--- a/ld/scripttempl/ia64vms.sc
+++ b/ld/scripttempl/ia64vms.sc
@@ -7,6 +7,10 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+# Using an empty script for ld -r is better than mashing together
+# sections. This hack likely leaves ld -Ur broken.
+test -n "${RELOCATING}" || exit 0
+
PAGESIZE=0x10000
BLOCKSIZE=0x200
diff --git a/ld/scripttempl/ip2k.sc b/ld/scripttempl/ip2k.sc
index 53ec829..6aa1f42 100644
--- a/ld/scripttempl/ip2k.sc
+++ b/ld/scripttempl/ip2k.sc
@@ -4,6 +4,9 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+# Using an empty script for ld -r is better than mashing together
+# sections. This hack likely leaves ld -Ur broken.
+test -n "${RELOCATING}" || exit 0
cat << EOF
/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
diff --git a/ld/scripttempl/iq2000.sc b/ld/scripttempl/iq2000.sc
index 58f9c29..e5f5c77 100644
--- a/ld/scripttempl/iq2000.sc
+++ b/ld/scripttempl/iq2000.sc
@@ -333,9 +333,9 @@ cat <<EOF
{
${RELOCATING+PROVIDE (__eh_frame_begin = .);}
*(.eh_frame)
- LONG (0);
+ ${RELOCATING+LONG (0);}
${RELOCATING+PROVIDE (__eh_frame_end = .);}
- } ${RELOCATING+}
+ }
.gcc_except_table : { *(.gcc_except_table) }
${INITIAL_READONLY_SECTIONS}
.hash ${RELOCATING-0} : { *(.hash) }
@@ -356,7 +356,7 @@ cat <<EOF
.jcr : { KEEP (*(.jcr)) }
${DATA_PLT+${PLT}}
${RELOCATING+${OTHER_GOT_SYMBOLS}}
- .got ${RELOCATING-0} : { *(.got.plt) *(.got) }
+ .got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }
${RELOCATING+${OTHER_GOT_SECTIONS}}
${CREATE_SHLIB+${SDATA2}}
${CREATE_SHLIB+${SBSS2}}
@@ -379,26 +379,26 @@ cat <<EOF
{
${RELOCATING+PROVIDE (__sbss_start = .);}
${RELOCATING+PROVIDE (___sbss_start = .);}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss)
${RELOCATING+*(.sbss.*)}
${RELOCATING+*(.gnu.linkonce.sb.*)}
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+PROVIDE (__sbss_end = .);}
${RELOCATING+PROVIDE (___sbss_end = .);}
}
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ . = ALIGN(${ALIGNMENT});}
}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
diff --git a/ld/scripttempl/mep.sc b/ld/scripttempl/mep.sc
index b651349..a71570b 100644
--- a/ld/scripttempl/mep.sc
+++ b/ld/scripttempl/mep.sc
@@ -109,7 +109,7 @@ INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
PLT=".plt ${RELOCATING-0} : { *(.plt) }"
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }"
else
GOT=".got ${RELOCATING-0} : { *(.got) }"
GOTPLT="${RELOCATING+${DATA_SEGMENT_RELRO_GOTPLT_END}}
@@ -126,9 +126,9 @@ if test -z "${NO_SMALL_DATA}"; then
${RELOCATING+PROVIDE (__sbss_start = .);}
${RELOCATING+PROVIDE (___sbss_start = .);}
${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
- *(.dynsbss)
+ ${RELOCATING+*(.dynsbss)}
*(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
${RELOCATING+PROVIDE (__sbss_end = .);}
${RELOCATING+PROVIDE (___sbss_end = .);}
}"
@@ -331,7 +331,7 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -341,7 +341,7 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -391,13 +391,13 @@ cat <<EOF
${BSS_PLT+${PLT}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ . = ALIGN(${ALIGNMENT});}
}
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
diff --git a/ld/scripttempl/mmo.sc b/ld/scripttempl/mmo.sc
index cbe56ee..a2248bc 100644
--- a/ld/scripttempl/mmo.sc
+++ b/ld/scripttempl/mmo.sc
@@ -139,9 +139,9 @@ cat <<EOF
*(.MMIX.reg_contents);
}
- /* By default, put the high end of the stack where the register stack
+ ${RELOCATING+/* By default, put the high end of the stack where the register stack
begins. They grow in opposite directions. */
- PROVIDE (__Stack_start = 0x6000000000000000);
+ PROVIDE (__Stack_start = 0x6000000000000000);}
/* Unfortunately, stabs are not mappable from ELF to MMO.
It can probably be fixed with some amount of work. */
diff --git a/ld/scripttempl/nds32elf.sc b/ld/scripttempl/nds32elf.sc
index dd9a0c1..a96cf2e 100644
--- a/ld/scripttempl/nds32elf.sc
+++ b/ld/scripttempl/nds32elf.sc
@@ -46,16 +46,16 @@ if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
- PLT=".plt ${RELOCATING-0} : { *(.plt)${IREL_IN_PLT+ *(.iplt)} }
+ PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }
${IREL_IN_PLT-$IPLT}"
fi
test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
if test -z "$GOT"; then
if test -z "$SEPARATE_GOTPLT"; then
- GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }"
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }"
else
- GOT=".got ${RELOCATING-0} : { *(.got) *(.igot) }"
- GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) *(.igot.plt) }"
+ GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }"
+ GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
fi
fi
REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
@@ -80,27 +80,27 @@ if test -z "${NO_SMALL_DATA}"; then
SBSS=".sbss_b ${RELOCATING-0} :
{
*(.sbss_b${RELOCATING+ .sbss_b.*})
- *(.scommon_b${RELOCATING+ .scommon_b.*})
+ ${RELOCATING+*(.scommon_b .scommon_b.*)}
${RELOCATING+. = ALIGN(2);}
}
.sbss_h ${RELOCATING-0} :
{
*(.sbss_h${RELOCATING+ .sbss_h.*})
- *(.scommon_h${RELOCATING+ .scommon_h.*})
+ ${RELOCATING+*(.scommon_h .scommon_h.*)}
${RELOCATING+. = ALIGN(4);}
}
.sbss_w ${RELOCATING-0} :
{
*(.sbss_w${RELOCATING+ .sbss_w.*})
- *(.scommon_w${RELOCATING+ .scommon_w.*})
+ ${RELOCATING+*(.scommon_w .scommon_w.*)
*(.dynsbss)
*(.scommon)
- ${RELOCATING+. = ALIGN(8);}
+ . = ALIGN(8);}
}
.sbss_d ${RELOCATING-0} :
{
*(.sbss_d${RELOCATING+ .sbss_d.*})
- *(.scommon_d${RELOCATING+ .scommon_d.*})
+ ${RELOCATING+*(.scommon_d .scommon_d.*)}
${RELOCATING+PROVIDE (__sbss_end = .);}
${RELOCATING+PROVIDE (___sbss_end = .);}
}"
@@ -488,11 +488,9 @@ cat <<EOF
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table
- .gcc_except_table.*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
/* These sections are generated by the Sun/Oracle C++ compiler. */
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges
- .exception_ranges*) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) }
${TEXT_PLT+${PLT_NEXT_DATA+${PLT}}}
/* Adjust the address for the data segment. We want to adjust up to
@@ -503,8 +501,8 @@ cat <<EOF
/* Exception handling */
.eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
- .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) }
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
@@ -565,15 +563,15 @@ cat <<EOF
${BSS_PLT+${PLT}}
.${BSS_NAME} ${RELOCATING-0} :
{
- *(.dyn${BSS_NAME})
+ ${RELOCATING+*(.dyn${BSS_NAME})}
*(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
+ FIXME: Why do we need it? When there is no .bss section, we do not
pad the .data section. */
- ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}
${OTHER_BSS_SECTIONS}
${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc
index f64e0b7..bba9b6f 100644
--- a/ld/scripttempl/pru.sc
+++ b/ld/scripttempl/pru.sc
@@ -2,6 +2,9 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
MEMORY
{
imem (x) : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH
@@ -11,10 +14,13 @@ MEMORY
__HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32;
__STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 512;
-${RELOCATING+ PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem)) ; }
+PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem));
+
+ENTRY (_start)
-${RELOCATING+ENTRY (_start)}
+EOF
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment: */
@@ -122,11 +128,11 @@ SECTIONS
${CONSTRUCTING+ KEEP (*(.fini_array))}
${CONSTRUCTING+ __fini_array_end = . ; }
- /* DATA memory starts at address 0. So to avoid placing a valid static
+ ${RELOCATING+/* DATA memory starts at address 0. So to avoid placing a valid static
variable at the invalid NULL address, we introduce the .data.atzero
section. If CRT can make some use of it - great. Otherwise skip a
word. In all cases .data/.bss sections must start at non-zero. */
- . += (. == 0 ? 4 : 0);
+ . += (. == 0 ? 4 : 0);}
${RELOCATING+ PROVIDE (_data_start = .) ; }
*(.data)
@@ -143,9 +149,8 @@ SECTIONS
.resource_table ${RELOCATING-0} :
{
- *(.resource_table)
KEEP (*(.resource_table))
- } > dmem
+ } ${RELOCATING+ > dmem}
.bss ${RELOCATING-0} :
{
@@ -154,7 +159,7 @@ SECTIONS
${RELOCATING+ *(.bss.*)}
${RELOCATING+ *(.bss:*)}
${RELOCATING+*(.gnu.linkonce.b*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ PROVIDE (_bss_end = .) ; }
} ${RELOCATING+ > dmem}
@@ -166,9 +171,9 @@ SECTIONS
${RELOCATING+ PROVIDE (_noinit_end = .) ; }
${RELOCATING+ PROVIDE (_heap_start = .) ; }
${RELOCATING+ . += __HEAP_SIZE ; }
- /* Stack is not here really. It will be put at the end of DMEM.
+ ${RELOCATING+/* Stack is not here really. It will be put at the end of DMEM.
But we take into account its size here, in order to allow
- for MEMORY overflow checking during link time. */
+ for MEMORY overflow checking during link time. */}
${RELOCATING+ . += __STACK_SIZE ; }
} ${RELOCATING+ > dmem}
diff --git a/ld/scripttempl/sh.sc b/ld/scripttempl/sh.sc
index 7d1e3db..0a500b3 100644
--- a/ld/scripttempl/sh.sc
+++ b/ld/scripttempl/sh.sc
@@ -12,7 +12,7 @@ TORS=".tors :
___dtors = . ;
*(.dtors)
___dtors_end = . ;
- } > ram"
+ }${RELOCATING+ > ram}"
cat <<EOF
/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
@@ -24,11 +24,17 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
MEMORY
{
ram : o = 0x1000, l = 512k
}
+EOF
+
+cat <<EOF
SECTIONS
{
.text :
diff --git a/ld/scripttempl/v850.sc b/ld/scripttempl/v850.sc
index c66c310..df8302c 100644
--- a/ld/scripttempl/v850.sc
+++ b/ld/scripttempl/v850.sc
@@ -25,9 +25,9 @@ SECTIONS
.zdata ${ZDATA_START_ADDR} :
{
*(.zdata)
- *(.zbss)
+ ${RELOCATING+*(.zbss)
*(reszdata)
- *(.zcommon)
+ *(.zcommon)}
}
/* This is the read only part of the zero data area.
@@ -39,8 +39,8 @@ SECTIONS
.rozdata ${ROZDATA_START_ADDR} :
{
*(.rozdata)
- *(romzdata)
- *(romzbss)
+ ${RELOCATING+*(romzdata)
+ *(romzbss)}
}
/* Read-only sections, merged into text segment. */
@@ -81,7 +81,7 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
- *(.gnu.linkonce.t*)
+ ${RELOCATING+*(.gnu.linkonce.t*)}
} =0
${RELOCATING+_etext = .;}
@@ -103,22 +103,22 @@ SECTIONS
}
.fini : { KEEP (*(.fini)) } =0
- .rodata : { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
+ .rodata : { *(.rodata) ${RELOCATING+*(.rodata.*) *(.gnu.linkonce.r*)} }
.rodata1 : { *(.rodata1) }
.data :
{
*(.data)
- ${RELOCATING+*(.data.*)}
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
+ ${RELOCATING+*(.data.*)
+ *(.gnu.linkonce.d*)}
+ ${CONSTRUCTING+CONSTRUCTORS}
}
.data1 : { *(.data1) }
.ctors :
{
${CONSTRUCTING+___ctors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
- KEEP (*(SORT(.ctors.*)))
+ ${RELOCATING+KEEP (*(SORT(.ctors.*)))}
KEEP (*crtend(.ctors))
${CONSTRUCTING+___ctors_end = .;}
}
@@ -126,7 +126,7 @@ SECTIONS
{
${CONSTRUCTING+___dtors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
- KEEP (*(SORT(.dtors.*)))
+ ${RELOCATING+KEEP (*(SORT(.dtors.*)))}
KEEP (*crtend.o(.dtors))
${CONSTRUCTING+___dtors_end = .;}
}
@@ -137,17 +137,17 @@ SECTIONS
.gcc_except_table : { *(.gcc_except_table) }
- .got : { *(.got.plt) *(.got) }
+ .got : {${RELOCATING+ *(.got.plt)} *(.got) }
.dynamic : { *(.dynamic) }
.tdata ${TDATA_START_ADDR} :
{
- ${RELOCATING+PROVIDE (__ep = .);}
+ ${RELOCATING+PROVIDE (__ep = .);
*(.tbyte)
- *(.tcommon_byte)
+ *(.tcommon_byte)}
*(.tdata)
- *(.tbss)
- *(.tcommon)
+ ${RELOCATING+*(.tbss)
+ *(.tcommon)}
}
/* We want the small data sections together, so single-instruction offsets
@@ -175,7 +175,7 @@ SECTIONS
{
${RELOCATING+__sbss_start = .;}
*(.sbss)
- *(.scommon)
+ ${RELOCATING+*(.scommon)}
}
${RELOCATING+_edata = DEFINED (__sbss_start) ? __sbss_start : . ;}
@@ -185,9 +185,9 @@ SECTIONS
{
${RELOCATING+__bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;}
${RELOCATING+__real_bss_start = . ;}
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
}
${RELOCATING+_end = . ;}
diff --git a/ld/scripttempl/v850_rh850.sc b/ld/scripttempl/v850_rh850.sc
index 618dc2f..b32cbe5 100644
--- a/ld/scripttempl/v850_rh850.sc
+++ b/ld/scripttempl/v850_rh850.sc
@@ -25,11 +25,11 @@ SECTIONS
.zdata ${ZDATA_START_ADDR} :
{
*(.zdata)
- *(.zdata23)
+ ${RELOCATING+*(.zdata23)
*(.zbss)
*(.zbss23)
*(reszdata)
- *(.zcommon)
+ *(.zcommon)}
}
/* This is the read only part of the zero data area.
@@ -41,10 +41,10 @@ SECTIONS
.rozdata ${ROZDATA_START_ADDR} :
{
*(.rozdata)
- *(romzdata)
+ ${RELOCATING+*(romzdata)
*(romzbss)
*(.zconst)
- *(.zconst23)
+ *(.zconst23)}
}
/* Read-only sections, merged into text segment. */
@@ -85,7 +85,7 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
- *(.gnu.linkonce.t*)
+ ${RELOCATING+*(.gnu.linkonce.t*)}
} =0
${RELOCATING+_etext = .;}
@@ -110,25 +110,25 @@ SECTIONS
.rodata :
{
*(.rodata)
- ${RELOCATING+*(.rodata.*)}
+ ${RELOCATING+*(.rodata.*)
*(.gnu.linkonce.r*)
- *(.const)
+ *(.const)}
}
.rodata1 : { *(.rodata1) }
.data :
{
*(.data)
- ${RELOCATING+*(.data.*)}
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
+ ${RELOCATING+*(.data.*)
+ *(.gnu.linkonce.d*)}
+ ${CONSTRUCTING+CONSTRUCTORS}
}
.data1 : { *(.data1) }
.ctors :
{
${CONSTRUCTING+___ctors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
- KEEP (*(SORT(.ctors.*)))
+ ${RELOCATING+KEEP (*(SORT(.ctors.*)))}
KEEP (*crtend(.ctors))
${CONSTRUCTING+___ctors_end = .;}
}
@@ -136,7 +136,7 @@ SECTIONS
{
${CONSTRUCTING+___dtors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
- KEEP (*(SORT(.dtors.*)))
+ ${RELOCATING+KEEP (*(SORT(.dtors.*)))}
KEEP (*crtend.o(.dtors))
${CONSTRUCTING+___dtors_end = .;}
}
@@ -147,23 +147,23 @@ SECTIONS
.gcc_except_table : { *(.gcc_except_table) }
- .got : { *(.got.plt) *(.got) }
+ .got : {${RELOCATING+ *(.got.plt)} *(.got) }
.dynamic : { *(.dynamic) }
.tdata ${TDATA_START_ADDR} :
{
- ${RELOCATING+PROVIDE (__ep = .);}
+ ${RELOCATING+PROVIDE (__ep = .);
*(.edata)
*(.edata23)
*(.tbyte)
- *(.tcommon_byte)
+ *(.tcommon_byte)}
*(.tdata)
- *(.tdata*)
+ ${RELOCATING+*(.tdata*)
*(.ebss)
*(.ebss23)
*(.tbss)
*(.tbss*)
- *(.tcommon)
+ *(.tcommon)}
}
/* We want the small data sections together, so single-instruction offsets
@@ -174,15 +174,15 @@ SECTIONS
{
${RELOCATING+PROVIDE (__gp = . + 0x8000);}
*(.sdata)
- *(.sdata23)
+ ${RELOCATING+*(.sdata23)}
}
/* See comment about .rozdata. */
.rosdata ${ROSDATA_START_ADDR} :
{
*(.rosdata)
- *(.sconst)
- *(.sconst23)
+ ${RELOCATING+*(.sconst)
+ *(.sconst23)}
}
/* We place the .sbss data section AFTER the .rosdata section, so that
@@ -194,8 +194,8 @@ SECTIONS
{
${RELOCATING+__sbss_start = .;}
*(.sbss)
- *(.sbss23)
- *(.scommon)
+ ${RELOCATING+*(.sbss23)
+ *(.scommon)}
}
${RELOCATING+_edata = DEFINED (__sbss_start) ? __sbss_start : . ;}
@@ -205,9 +205,9 @@ SECTIONS
{
${RELOCATING+__bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;}
${RELOCATING+__real_bss_start = . ;}
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
}
${RELOCATING+_end = . ;}
diff --git a/ld/scripttempl/visium.sc b/ld/scripttempl/visium.sc
index 3bf6e16..c210865 100644
--- a/ld/scripttempl/visium.sc
+++ b/ld/scripttempl/visium.sc
@@ -35,14 +35,15 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
ENTRY(${ENTRY})
+EOF
+test -n "${RELOCATING}" && cat <<EOF
/* Start and end of main stack. Assumes 256K of RAM. */
-${RELOCATING+ _estack = 0xe0040000 - 4;}
-${RELOCATING+ _sstack = 0xe0040000 - 64K;}
+_estack = 0xe0040000 - 4;
+_sstack = 0xe0040000 - 64K;
/* End of heap. */
-${RELOCATING+ _eheap = _sstack - 4;}
-
+_eheap = _sstack - 4;
MEMORY
{
@@ -53,12 +54,14 @@ MEMORY
saferam : ORIGIN = 0xf0000000, LENGTH = 0x10000000
}
+EOF
+cat <<EOF
SECTIONS
{
.init ${RELOCATING-0} : {
KEEP (*(.init))
- KEEP (*(.fini))
+ ${RELOCATING+KEEP (*(.fini))}
${RELOCATING+ _einit = .;}
} ${RELOCATING+ > init}
@@ -91,7 +94,7 @@ SECTIONS
end of ctors marker and it must be last. */
KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
- KEEP (*(SORT(.ctors.*)))
+ ${RELOCATING+KEEP (*(SORT(.ctors.*)))}
KEEP (*(.ctors))
${CONSTRUCTING+ __CTOR_END__ = .;}
} ${RELOCATING+ > rom}
@@ -100,14 +103,14 @@ SECTIONS
${CONSTRUCTING+ __DTOR_LIST__ = .;}
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
- KEEP (*(SORT(.dtors.*)))
+ ${RELOCATING+KEEP (*(SORT(.dtors.*)))}
KEEP (*(.dtors))
${CONSTRUCTING+ __DTOR_END__ = .;}
} ${RELOCATING+ > rom}
.rodata ${RELOCATING-0} : {
${RELOCATING+ . = ALIGN(4);}
${RELOCATING+ _srdata = .;}
- *(.rdata)
+ ${RELOCATING+*(.rdata)}
*(.rodata)
${RELOCATING+*(.rodata.*)}
${RELOCATING+*(.gnu.linkonce.r.*)}
@@ -140,7 +143,7 @@ SECTIONS
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)}
${RELOCATING+ . = ALIGN(4);}
${RELOCATING+ __bss_end = .;}
${RELOCATING+ _sheap = .;}
@@ -168,7 +171,7 @@ EOF
cat <<EOF
}
-
+${RELOCATING+
/* Provide a default address for the simulated file-I/O device. */
PROVIDE (_sim_fileio_register = 0x2fff0000);
@@ -176,6 +179,6 @@ PROVIDE (_sim_fileio_register = 0x2fff0000);
PROVIDE (_sim_cmdline_header = 0x2ffe0000);
/* Provide a default address for the simulated 1 MHz clock. */
-PROVIDE (_sim_clock = 0x20002100);
+PROVIDE (_sim_clock = 0x20002100);}
EOF
diff --git a/ld/scripttempl/xstormy16.sc b/ld/scripttempl/xstormy16.sc
index 6153c30..01eed5d 100644
--- a/ld/scripttempl/xstormy16.sc
+++ b/ld/scripttempl/xstormy16.sc
@@ -107,15 +107,14 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${OUTPUT_ARCH})
-${RELOCATING+ENTRY(${ENTRY})}
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
+ENTRY(${ENTRY})
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING+${INPUT_FILES}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
- if gld -r is used and the intermediate file has sections starting
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
- bug. But for now assigning the zero vmas works. */}
+${LIB_SEARCH_DIRS}
+${EXECUTABLE_SYMBOLS}
+${INPUT_FILES}
/* There are two memory regions we care about, one from 0 through 0x7F00
that is RAM and one from 0x8000 up which is ROM. */
@@ -124,7 +123,9 @@ MEMORY
RAM (w) : ORIGIN = 0, LENGTH = 0x7F00
ROM (!w) : ORIGIN = 0x8000, LENGTH = 0xFF8000
}
+EOF
+cat <<EOF
SECTIONS
{
.data ${RELOCATING-0} :
@@ -136,7 +137,7 @@ SECTIONS
${RELOCATING+*(.data.*)}
${RELOCATING+*(.gnu.linkonce.d.*)}
${CONSTRUCTING+SORT(CONSTRUCTORS)}
- } > RAM
+ }${RELOCATING+ > RAM}
${RELOCATING+${OTHER_READWRITE_SECTIONS}}
${RELOCATING+${OTHER_GOT_SYMBOLS}}
${RELOCATING+${OTHER_GOT_SECTIONS}}
@@ -146,16 +147,16 @@ SECTIONS
${RELOCATING+${OTHER_BSS_SYMBOLS}}
.bss ${RELOCATING-0} :
{
- *(.dynbss)
+ ${RELOCATING+*(.dynbss)}
*(.bss)
${RELOCATING+*(.bss.*)}
${RELOCATING+*(.gnu.linkonce.b.*)}
- *(COMMON)
+ ${RELOCATING+*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
- } > RAM
+ . = ALIGN(${ALIGNMENT});}
+ }${RELOCATING+ > RAM}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+${OTHER_END_SYMBOLS}}
@@ -164,15 +165,15 @@ SECTIONS
${RELOCATING+PROVIDE (end = .);}
/* Read-only sections in ROM. */
- .int_vec ${RELOCATING-0} : { *(.int_vec) } ${RELOCATING+> ROM}
+ .int_vec ${RELOCATING-0} : { *(.int_vec) }${RELOCATING+ > ROM}
- .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} } ${RELOCATING+> ROM}
+ .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} }${RELOCATING+ > ROM}
${RELOCATING+${CTOR}}
${RELOCATING+${DTOR}}
- .jcr : { KEEP (*(.jcr)) } ${RELOCATING+> ROM}
- .eh_frame : { KEEP (*(.eh_frame)) } ${RELOCATING+> ROM}
- .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } ${RELOCATING+> ROM}
- .plt : { *(.plt) } ${RELOCATING+> ROM}
+ .jcr : { KEEP (*(.jcr)) }${RELOCATING+ > ROM}
+ .eh_frame : { KEEP (*(.eh_frame)) }${RELOCATING+ > ROM}
+ .gcc_except_table : { *(.gcc_except_table)${RELOCATING+ *(.gcc_except_table.*)} }${RELOCATING+ > ROM}
+ .plt : { *(.plt) }${RELOCATING+ > ROM}
.text ${RELOCATING-0} :
{
@@ -184,19 +185,19 @@ SECTIONS
*(.gnu.warning)
${RELOCATING+*(.gnu.linkonce.t.*)}
${RELOCATING+${OTHER_TEXT_SECTIONS}}
- } ${RELOCATING+> ROM =${NOP-0}}
+ }${RELOCATING+ > ROM =${NOP-0}}
.init ${RELOCATING-0} :
{
${RELOCATING+${INIT_START}}
KEEP (*(.init))
${RELOCATING+${INIT_END}}
- } ${RELOCATING+> ROM =${NOP-0}}
+ }${RELOCATING+ > ROM =${NOP-0}}
.fini ${RELOCATING-0} :
{
${RELOCATING+${FINI_START}}
KEEP (*(.fini))
${RELOCATING+${FINI_END}}
- } ${RELOCATING+> ROM =${NOP-0}}
+ }${RELOCATING+ > ROM =${NOP-0}}
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
${RELOCATING+PROVIDE (etext = .);}