# OS, where a separate postlinker will operated on the generated
# executable or shared object. See elf.sc for configuration variables
# that apply; only BPABI-specific variables will be noted here.
+#
+# Copyright (C) 2014-2020 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
test -z "$ENTRY" && ENTRY=_start
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
{
${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 = .);}
}"
SDATA="/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
- .sdata ${RELOCATING-0} :
+ .sdata ${RELOCATING-0} :
{
${RELOCATING+${SDATA_START_SYMBOLS}}
*(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
KEEP (*(.fini_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
}"
-CTOR=".ctors ${CONSTRUCTING-0} :
+CTOR=".ctors ${CONSTRUCTING-0} :
{
${CONSTRUCTING+${CTOR_START}}
/* gcc uses crtbegin.o to find the start of
DATA_ADDR="SEGMENT_START(\"data\", ${DATA_ADDR-${DATA_SEGMENT_ALIGN}})"
SHLIB_DATA_ADDR="SEGMENT_START(\"data\", ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}})"
-# if this is for an embedded system, don't add SIZEOF_HEADERS.
+# If this is for an embedded system, don't add SIZEOF_HEADERS.
if [ -z "$EMBEDDED" ]; then
test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
SHLIB_BASE_ADDRESS="${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS"
fi
cat <<EOF
+/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
+
+ Copying and distribution of this script, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. */
+
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. */}
-
-/* ARM's proprietary toolchain generate these symbols to match the start
+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
- symbols. We provide them for compatibility with ARM's toolchains.
- These symbols should be bound locally; each shared object may define
- its own version of these symbols. */
-
+ symbols. We provide them for compatibility with ARM's toolchains.
+ These symbols should be bound locally; each shared object may define
+ its own version of these symbols. */
+
VERSION
-{
+{
/* Give these a dummy version to work around linker lameness.
The name used shouldn't matter as these are all local symbols. */
- __GNU {
- local:
+ __GNU {
+ local:
Image\$\$ER_RO\$\$Base;
Image\$\$ER_RO\$\$Limit;
SHT\$\$INIT_ARRAY\$\$Base;
SHT\$\$INIT_ARRAY\$\$Limit;
- .ARM.exidx\$\$Base;
+ .ARM.exidx\$\$Base;
.ARM.exidx\$\$Limit;
};
}
+EOF
+
+cat <<EOF
SECTIONS
{
/* Read-only sections, merged into text segment: */
EOF
cat <<EOF
- .init ${RELOCATING-0} :
- {
+ .init ${RELOCATING-0} :
+ {
${RELOCATING+${INIT_START}}
- KEEP (*(.init))
+ KEEP (*(SORT_NONE(.init)))
${RELOCATING+${INIT_END}}
} =${NOP-0}
.text ${RELOCATING-0} :
{
${RELOCATING+${TEXT_START_SYMBOLS}}
*(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
- /* .gnu.warning sections are handled specially by elf32.em. */
+ /* .gnu.warning sections are handled specially by elf.em. */
*(.gnu.warning)
${RELOCATING+${OTHER_TEXT_SECTIONS}}
} =${NOP-0}
.fini ${RELOCATING-0} :
{
${RELOCATING+${FINI_START}}
- KEEP (*(.fini))
+ KEEP (*(SORT_NONE(.fini)))
${RELOCATING+${FINI_END}}
} =${NOP-0}
/* The SymbianOS kernel requires that the PLT go at the end of the
${RELOCATING+${FINI_ARRAY}}
${OTHER_READONLY_SECTIONS}
- .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame_hdr ${RELOCATING-0} : { *(.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. */
/* 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.*}) }
${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});}
${RELOCATING+_end = .;}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${STACK_ADDR+${STACK}}
/* These sections are not mapped under the BPABI. */
.dynamic 0 : { *(.dynamic) }
.comment 0 : { *(.comment) }
EOF
-source $srcdir/scripttempl/DWARF.sc
+. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${STACK_ADDR+${STACK}}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
${RELOCATING+${DISCARDED}}
.rel.dyn 0 :
{
EOF
-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
cat <<EOF
}
.rela.dyn 0 :
{
EOF
-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
cat <<EOF
}
EOF