aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2010-02-27 12:34:25 +0000
committerJie Zhang <jie.zhang@analog.com>2010-02-27 12:34:25 +0000
commit3cff7cc71fc25ffa83e7d5ce8f4aeb308fb656db (patch)
tree9fa0a8f6e1ec56367ae6b180392f4d69520074c8 /ld/scripttempl
parenteb1956643ddbb298d1005c939d3b9fce04980a4a (diff)
downloadgdb-3cff7cc71fc25ffa83e7d5ce8f4aeb308fb656db.zip
gdb-3cff7cc71fc25ffa83e7d5ce8f4aeb308fb656db.tar.gz
gdb-3cff7cc71fc25ffa83e7d5ce8f4aeb308fb656db.tar.bz2
* scripttempl/armbpabi.sc: Don't combine .init_array.* or
.fini_array.* when do relocatable linking. * scripttempl/elf.sc: Likewise. * scripttempl/elf32sh-symbian.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. testsuite/ * ld-elf/init-fini-arrays.s: New test. * ld-elf/init-fini-arrays.d: New test.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/armbpabi.sc38
-rw-r--r--ld/scripttempl/elf.sc30
-rw-r--r--ld/scripttempl/elf32sh-symbian.sc30
-rw-r--r--ld/scripttempl/elf64hppa.sc30
-rw-r--r--ld/scripttempl/elfxtensa.sc30
5 files changed, 84 insertions, 74 deletions
diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc
index 556ff1e..8b3ea0a 100644
--- a/ld/scripttempl/armbpabi.sc
+++ b/ld/scripttempl/armbpabi.sc
@@ -64,6 +64,24 @@ else
NO_SMALL_DATA=" "
fi
test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
+INIT_ARRAY=".init_array ${RELOCATING-0} :
+ {
+ /* SymbianOS uses this symbol. */
+ ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
+ /* SymbianOS uses this symbol. */
+ ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}
+ }"
+FINI_ARRAY=".fini_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
+ }"
CTOR=".ctors ${CONSTRUCTING-0} :
{
${CONSTRUCTING+${CTOR_START}}
@@ -218,24 +236,8 @@ cat <<EOF
KEEP (*(.preinit_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_end = .);}}
}
- .init_array ${RELOCATING-0} :
- {
- /* SymbianOS uses this symbol. */
- ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
- /* SymbianOS uses this symbol. */
- ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}
- }
- .fini_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
- }
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index a17eb27..0f4a4d7 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -216,6 +216,20 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
*(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}"
+INIT_ARRAY=".init_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
+ }"
+FINI_ARRAY=".fini_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
+ }"
CTOR=".ctors ${CONSTRUCTING-0} :
{
${CONSTRUCTING+${CTOR_START}}
@@ -455,20 +469,8 @@ cat <<EOF
KEEP (*(.preinit_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
}
- .init_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
- }
- .fini_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
- }
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
.jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
diff --git a/ld/scripttempl/elf32sh-symbian.sc b/ld/scripttempl/elf32sh-symbian.sc
index 1cfbbc6..c8d9360 100644
--- a/ld/scripttempl/elf32sh-symbian.sc
+++ b/ld/scripttempl/elf32sh-symbian.sc
@@ -85,6 +85,20 @@ DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn"
RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) }"
test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
+INIT_ARRAY=".init_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
+ }"
+FINI_ARRAY=".fini_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
+ }"
CTOR=".ctors ALIGN(4) :
{
${CONSTRUCTING+${CTOR_START}}
@@ -214,20 +228,8 @@ SECTIONS
KEEP (*(.preinit_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_end = .);}}
}
- .init_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}}
- }
- .fini_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
- }
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
diff --git a/ld/scripttempl/elf64hppa.sc b/ld/scripttempl/elf64hppa.sc
index 452ae7a..584192a 100644
--- a/ld/scripttempl/elf64hppa.sc
+++ b/ld/scripttempl/elf64hppa.sc
@@ -200,6 +200,20 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
*(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}"
+INIT_ARRAY=".init_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
+ }"
+FINI_ARRAY=".fini_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
+ }"
CTOR=".ctors ${CONSTRUCTING-0} :
{
${CONSTRUCTING+${CTOR_START}}
@@ -428,20 +442,8 @@ cat <<EOF
KEEP (*(.preinit_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
}
- .init_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
- }
- .fini_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
- }
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
.jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
index 22fde0c..53cec71 100644
--- a/ld/scripttempl/elfxtensa.sc
+++ b/ld/scripttempl/elfxtensa.sc
@@ -217,6 +217,20 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
*(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
}"
+INIT_ARRAY=".init_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
+ }"
+FINI_ARRAY=".fini_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
+ }"
CTOR=".ctors ${CONSTRUCTING-0} :
{
${CONSTRUCTING+${CTOR_START}}
@@ -438,20 +452,8 @@ cat <<EOF
KEEP (*(.preinit_array))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
}
- .init_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
- }
- .fini_array ${RELOCATING-0} :
- {
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array))
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
- }
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
.jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }