diff options
author | Alan Modra <amodra@gmail.com> | 2008-10-22 05:20:44 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2008-10-22 05:20:44 +0000 |
commit | 485cf679681e0218e710df1df17a9158c1445e47 (patch) | |
tree | 41b2cc090512ff188afec8a921b2d32a97d9659b /ld/scripttempl | |
parent | 11d5096372dd488db0b6c1211f59b789de8889e9 (diff) | |
download | gdb-485cf679681e0218e710df1df17a9158c1445e47.zip gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.gz gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.bz2 |
* 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.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r-- | ld/scripttempl/elf.sc | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 5c35e4f..120db06 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.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 @@ -268,6 +271,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) } @@ -276,10 +284,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 @@ -316,27 +324,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 .init ${RELOCATING-0} : { ${RELOCATING+${INIT_START}} @@ -464,7 +490,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) } |