aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2008-11-03 18:52:52 +0000
committerBob Wilson <bob.wilson@acm.org>2008-11-03 18:52:52 +0000
commite78c4c7ea8ad3d53902aa5e23f414ee06d150880 (patch)
tree01f552838bda5c82f5955553dbe0b8d9c7d428dd /ld/scripttempl
parent9bc9e927792511e2c1997ffcf7cd605cd1eb2ea2 (diff)
downloadfsf-binutils-gdb-e78c4c7ea8ad3d53902aa5e23f414ee06d150880.zip
fsf-binutils-gdb-e78c4c7ea8ad3d53902aa5e23f414ee06d150880.tar.gz
fsf-binutils-gdb-e78c4c7ea8ad3d53902aa5e23f414ee06d150880.tar.bz2
* emulparams/elf32xtensa.sh (NO_REL_RELOCS): Set.
* scripttempl/elfxtensa.sc (NO_REL_RELOCS, NO_RELA_RELOCS) (NON_ALLOC_DYN): Import changes from elf.sc.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/elfxtensa.sc58
1 files changed, 50 insertions, 8 deletions
diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
index 368b1cd..df3ed8e 100644
--- a/ld/scripttempl/elfxtensa.sc
+++ b/ld/scripttempl/elfxtensa.sc
@@ -36,6 +36,9 @@
# 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
@@ -282,6 +285,11 @@ SECTIONS
${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) }
@@ -290,10 +298,10 @@ SECTIONS
.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
@@ -330,27 +338,45 @@ eval $COMBRELOCCAT <<EOF
.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
${RELOCATING-$INIT_LIT}
${RELOCATING-$INIT}
@@ -484,7 +510,23 @@ cat <<EOF
${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) }