Handle these defines.
* emulparams/criself.sh, * emulparams/crislinux.sh,
* emulparams/elf32am33lin.sh, * emulparams/elf32fr30.sh,
* emulparams/elf32_i860.sh, * emulparams/elf32ip2k.sh,
* emulparams/elf32mcore.sh, * emulparams/elf32ppccommon.sh,
* emulparams/elf32ppcwindiss.sh, * emulparams/elf32_sparc.sh,
* emulparams/elf32_spu.sh, * emulparams/elf32vax.sh,
* emulparams/elf64alpha.sh, * emulparams/elf64mmix.sh,
* emulparams/elf64ppc.sh, * emulparams/elf64_s390.sh,
* emulparams/elf64_sparc.sh, * emulparams/elf_s390.sh,
* emulparams/elf_x86_64.sh, * emulparams/h8300elf.sh,
* emulparams/hppa64linux.sh, * emulparams/hppalinux.sh,
* emulparams/m68kelf.sh, * emulparams/mn10200.sh,
* emulparams/pjelf.sh, * emulparams/ppclynx.sh,
* emulparams/shelf32.sh, * emulparams/shelf_nto.sh,
* emulparams/shelf.sh, * emulparams/shelf_vxworks.sh,
* emulparams/shlelf32_linux.sh, * emulparams/shlelf_linux.sh,
* emulparams/shlelf_nto.sh (NO_REL_RELOCS): Set.
* emulparams/arcelf.sh, * emulparams/elf32_i960.sh,
* emulparams/elf32openrisc.sh, * emulparams/elf_i386_be.sh,
* emulparams/elf_i386_ldso.sh, * emulparams/elf_i386.sh,
* emulparams/elf_i386_vxworks.sh, * emulparams/i386lynx.sh,
* emulparams/i386moss.sh, * emulparams/i386nto.sh,
* emulparams/or32elf.sh, * emulparams/scoreelf.sh (NO_RELA_RELOCS): Set.
+2008-10-22 Alan Modra <amodra@bigpond.net.au>
+
+ * scripttempl/elf.sc (NO_REL_RELOCS, NO_RELA_RELOCS, NON_ALLOC_DYN):
+ Handle these defines.
+ * emulparams/criself.sh, * emulparams/crislinux.sh,
+ * emulparams/elf32am33lin.sh, * emulparams/elf32fr30.sh,
+ * emulparams/elf32_i860.sh, * emulparams/elf32ip2k.sh,
+ * emulparams/elf32mcore.sh, * emulparams/elf32ppccommon.sh,
+ * emulparams/elf32ppcwindiss.sh, * emulparams/elf32_sparc.sh,
+ * emulparams/elf32_spu.sh, * emulparams/elf32vax.sh,
+ * emulparams/elf64alpha.sh, * emulparams/elf64mmix.sh,
+ * emulparams/elf64ppc.sh, * emulparams/elf64_s390.sh,
+ * emulparams/elf64_sparc.sh, * emulparams/elf_s390.sh,
+ * emulparams/elf_x86_64.sh, * emulparams/h8300elf.sh,
+ * emulparams/hppa64linux.sh, * emulparams/hppalinux.sh,
+ * emulparams/m68kelf.sh, * emulparams/mn10200.sh,
+ * emulparams/pjelf.sh, * emulparams/ppclynx.sh,
+ * emulparams/shelf32.sh, * emulparams/shelf_nto.sh,
+ * emulparams/shelf.sh, * emulparams/shelf_vxworks.sh,
+ * emulparams/shlelf32_linux.sh, * emulparams/shlelf_linux.sh,
+ * emulparams/shlelf_nto.sh (NO_REL_RELOCS): Set.
+ * emulparams/arcelf.sh, * emulparams/elf32_i960.sh,
+ * emulparams/elf32openrisc.sh, * emulparams/elf_i386_be.sh,
+ * emulparams/elf_i386_ldso.sh, * emulparams/elf_i386.sh,
+ * emulparams/elf_i386_vxworks.sh, * emulparams/i386lynx.sh,
+ * emulparams/i386moss.sh, * emulparams/i386nto.sh,
+ * emulparams/or32elf.sh, * emulparams/scoreelf.sh (NO_RELA_RELOCS): Set.
+
2008-10-22 Alan Modra <amodra@bigpond.net.au>
* ldlang.c (lang_output_section_find_by_flags): Handle non-alloc
OUTPUT_FORMAT="elf32-littlearc"
LITTLE_OUTPUT_FORMAT="elf32-littlearc"
BIG_OUTPUT_FORMAT="elf32-bigarc"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x0
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=arc
# Symbols have underscore prepended.
OUTPUT_FORMAT="elf32-us-cris"
+NO_REL_RELOCS=yes
ARCH=cris
MAXPAGESIZE=32
ENTRY=__start
MACHINE=
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-cris"
+NO_REL_RELOCS=yes
ARCH=cris
TEMPLATE_NAME=elf32
OUTPUT_FORMAT="elf32-i860-little"
BIG_OUTPUT_FORMAT="elf32-i860"
LITTLE_OUTPUT_FORMAT="elf32-i860-little"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0
PAGE_SIZE=0x1000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
SCRIPT_NAME=elf
TEMPLATE_NAME=elf32
OUTPUT_FORMAT="elf32-i960"
+NO_RELA_RELOCS=yes
ARCH=i960
MACHINE=
TEXT_START_ADDR=0
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sparc"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=spuelf
OUTPUT_FORMAT="elf32-spu"
+NO_REL_RELOCS=yes
ARCH=spu
MACHINE=
ALIGNMENT=16
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-am33lin"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x8000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=mn10300
TEMPLATE_NAME=generic
EXTRA_EM_FILE=genelf
OUTPUT_FORMAT="elf32-fr30"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000
ARCH=fr30
MAXPAGESIZE=256
MACHINE=
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-ip2k"
+NO_REL_RELOCS=yes
# See also `include/elf/ip2k.h'
DATA_ADDR=0x01000100
TEXT_START_ADDR=0x02010000
OUTPUT_FORMAT="elf32-mcore-little"
BIG_OUTPUT_FORMAT="elf32-mcore-big"
LITTLE_OUTPUT_FORMAT="elf32-mcore-little"
+NO_REL_RELOCS=yes
PAGE_SIZE=0x1000
TARGET_PAGE_SIZE=0x400
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
MACHINE=
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-openrisc"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x10000
ARCH=openrisc
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
GENERATE_PIE_SCRIPT=yes
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-powerpc"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x01800000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
TEMPLATE_NAME=elf32
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-powerpc"
+NO_REL_RELOCS=yes
ARCH=powerpc
MACHINE=
EMBEDDED=yes
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-vax"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000
case ${LD_FLAG} in
n|N) TEXT_START_ADDR=0x1000 ;;
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-s390"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x80000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ELFSIZE=64
TEMPLATE_NAME=elf32
OUTPUT_FORMAT="elf64-sparc"
+NO_REL_RELOCS=yes
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="sparc:v9"
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=alphaelf
OUTPUT_FORMAT="elf64-alpha"
+NO_REL_RELOCS=yes
TEXT_START_ADDR="0x120000000"
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ELFSIZE=64
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf64-mmix"
+NO_REL_RELOCS=yes
ENTRY=_start.
# Default to 0 as mmixal does.
GENERATE_PIE_SCRIPT=yes
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf64-powerpc"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000000
#SEGMENT_SIZE=0x10000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x08048000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x80000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=i386
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x08048000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=i386
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386-vxworks"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x08048000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-s390"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x00400000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-x86-64"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x400000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-h8300"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x100
MAXPAGESIZE=2
TARGET_PAGE_SIZE=128
ELFSIZE=64
# FIXME: this output format is for hpux.
OUTPUT_FORMAT="elf64-hppa-linux"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000
TARGET_PAGE_SIZE=0x10000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
SCRIPT_NAME=elf
ELFSIZE=32
OUTPUT_FORMAT="elf32-hppa-linux"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x10000
TARGET_PAGE_SIZE=0x10000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
ENTRY=_main
TEXT_BASE=0x0
DYN_TEXT_BASE=0x00400000
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x00002000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=i386
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x08048000
TEXT_START_SYMBOLS='_btext = .;'
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-m68k"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x80000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
TEMPLATE_NAME=generic
EXTRA_EM_FILE=genelf
OUTPUT_FORMAT="elf32-mn10200"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x0
ARCH=mn10200
MACHINE=
TEMPLATE_NAME=generic
EXTRA_EM_FILE=genelf
OUTPUT_FORMAT="elf32-or32"
+NO_RELA_RELOCS=yes
TEXT_START_ADDR=0x1000000
TARGET_PAGE_SIZE=0x1000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
TEMPLATE_NAME=generic
EXTRA_EM_FILE=genelf
OUTPUT_FORMAT="elf32-pj"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x1000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=pj
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-powerpc"
+NO_REL_RELOCS=yes
TEXT_BASE=0x00002000
DYN_TEXT_BASE=0x00400000
TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})"
OUTPUT_FORMAT="elf32-bigscore"
BIG_OUTPUT_FORMAT="elf32-bigscore"
LITTLE_OUTPUT_FORMAT="elf32-littlescore"
+NO_RELA_RELOCS=yes
GROUP="-lm -lc -lglsim -lgcc -lstdc++"
TEXT_START_ADDR=0x00000000
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x1000
MAXPAGESIZE=128
ARCH=sh
# sh[l]elf(32|64).sh parameter scripts.
SCRIPT_NAME=elf
OUTPUT_FORMAT=${OUTPUT_FORMAT-"elf32-sh64"}
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x1000
MAXPAGESIZE=128
ARCH=sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x08040000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=sh
# shlelf_vxworks.sh
SCRIPT_NAME=elf
+NO_REL_RELOCS=yes
BIG_OUTPUT_FORMAT="elf32-sh-vxworks"
LITTLE_OUTPUT_FORMAT="elf32-shl-vxworks"
OUTPUT_FORMAT="$BIG_OUTPUT_FORMAT"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh64-linux"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x400000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh-linux"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x400000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-shl"
+NO_REL_RELOCS=yes
TEXT_START_ADDR=0x08040000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=sh
# DATA_PLT - .plt should be in data segment, not text segment.
# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
# BSS_PLT - .plt should be in bss segment
+# NO_REL_RELOCS - Don't include .rel.* sections in script
+# NO_RELA_RELOCS - Don't include .rela.* sections in script
+# NON_ALLOC_DYN - Place dynamic sections after data segment.
# TEXT_DYNAMIC - .dynamic in text segment, not data segment.
# EMBEDDED - whether this is for an embedded system.
# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
${INITIAL_READONLY_SECTIONS}
.note.gnu.build-id : { *(.note.gnu.build-id) }
+EOF
+
+test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
+test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
+cat > ldscripts/dyntmp.$$ <<EOF
${TEXT_DYNAMIC+${DYNAMIC}}
.hash ${RELOCATING-0} : { *(.hash) }
.gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
.gnu.version ${RELOCATING-0} : { *(.gnu.version) }
.gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
.gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
-
EOF
+
if [ "x$COMBRELOC" = x ]; then
- COMBRELOCCAT=cat
+ COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
else
COMBRELOCCAT="cat > $COMBRELOC"
fi
.rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
${REL_LARGE}
EOF
+
if [ -n "$COMBRELOC" ]; then
-cat <<EOF
+cat >> ldscripts/dyntmp.$$ <<EOF
.rel.dyn ${RELOCATING-0} :
{
EOF
-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
-cat <<EOF
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+cat >> ldscripts/dyntmp.$$ <<EOF
}
.rela.dyn ${RELOCATING-0} :
{
EOF
-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC
-cat <<EOF
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+cat >> ldscripts/dyntmp.$$ <<EOF
}
EOF
fi
-cat <<EOF
+
+cat >> ldscripts/dyntmp.$$ <<EOF
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
${OTHER_PLT_RELOC_SECTIONS}
+EOF
+if test -z "${NON_ALLOC_DYN}"; then
+ if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
+ cat ldscripts/dyntmp.$$
+ else
+ if test -z "${NO_REL_RELOCS}"; then
+ sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
+ fi
+ if test -z "${NO_RELA_RELOCS}"; then
+ sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
+ fi
+ fi
+ rm -f ldscripts/dyntmp.$$
+fi
+
+cat <<EOF
.init ${RELOCATING-0} :
{
${RELOCATING+${INIT_START}}
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+EOF
+if test -n "${NON_ALLOC_DYN}"; then
+ if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
+ cat ldscripts/dyntmp.$$
+ else
+ if test -z "${NO_REL_RELOCS}"; then
+ sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
+ fi
+ if test -z "${NO_RELA_RELOCS}"; then
+ sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
+ fi
+ fi
+ rm -f ldscripts/dyntmp.$$
+fi
+
+cat <<EOF
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }