aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-11-03 15:01:58 +0000
committerPaul Brook <paul@codesourcery.com>2005-11-03 15:01:58 +0000
commit6f2942edf01d584dcc76b960a50de9f67f13e7c3 (patch)
tree8230c1f700af4942a273fa328fadbe2e4fc70e0e /ld/scripttempl
parent6ece8836a6da593ddc29e0e9a9d79a39bb784206 (diff)
downloadgdb-6f2942edf01d584dcc76b960a50de9f67f13e7c3.zip
gdb-6f2942edf01d584dcc76b960a50de9f67f13e7c3.tar.gz
gdb-6f2942edf01d584dcc76b960a50de9f67f13e7c3.tar.bz2
2005-11-03 Paul Brook <paul@codesourcery.com>
* scripttempl/elf.sc: Add .init_array.* and .fini_array.*. * scripttempl/armbpabi.sc: Make init/fini array consistent with elf.sc. * scripttempl/elf32sh-symbian.sc: Ditto. * scripttempl/elfxtensa.sc: Ditto.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/armbpabi.sc44
-rw-r--r--ld/scripttempl/elf.sc2
-rw-r--r--ld/scripttempl/elf32sh-symbian.sc36
-rw-r--r--ld/scripttempl/elfxtensa.sc23
4 files changed, 66 insertions, 39 deletions
diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc
index dccc8cd..2785812 100644
--- a/ld/scripttempl/armbpabi.sc
+++ b/ld/scripttempl/armbpabi.sc
@@ -211,26 +211,30 @@ cat <<EOF
segment; there is no runtime relocation applied to these
arrays. */
- /* Ensure the __preinit_array_start label is properly aligned. We
- could instead move the label definition inside the section, but
- the linker would then create the section even if it turns out to
- be empty, which isn't pretty. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
- .preinit_array ${RELOCATING-0} : { *(.preinit_array) }
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
-
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
- /* SymbianOS uses this symbol. */
- ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);}
- .init_array ${RELOCATING-0} : { *(.init_array) }
- /* SymbianOS uses this symbol. */
- ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);}
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
-
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
- .fini_array ${RELOCATING-0} : { *(.fini_array) }
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
+ .preinit_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}}
+ 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 (*(.fini_array))
+ KEEP (*(SORT(.fini_array.*)))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
+ }
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index abe4597..3ffc6d1 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -384,6 +384,7 @@ cat <<EOF
.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 = .);}}
}
@@ -391,6 +392,7 @@ cat <<EOF
{
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}}
KEEP (*(.fini_array))
+ KEEP (*(SORT(.fini_array.*)))
${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
}
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
diff --git a/ld/scripttempl/elf32sh-symbian.sc b/ld/scripttempl/elf32sh-symbian.sc
index 1f87c2a..c3f7c90 100644
--- a/ld/scripttempl/elf32sh-symbian.sc
+++ b/ld/scripttempl/elf32sh-symbian.sc
@@ -204,22 +204,26 @@ SECTIONS
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN(128) + (. & (128 - 1));
- /* Ensure the __preinit_array_start label is properly aligned. We
- could instead move the label definition inside the section, but
- the linker would then create the section even if it turns out to
- be empty, which isn't pretty. */
- ${RELOCATING+. = ALIGN(${ALIGNMENT});}
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
- .preinit_array ${RELOCATING-0} : { *(.preinit_array) }
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
-
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
- .init_array ${RELOCATING-0} : { *(.init_array) }
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
-
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
- .fini_array ${RELOCATING-0} : { *(.fini_array) }
- ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
+ .preinit_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}}
+ 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 (*(.fini_array))
+ KEEP (*(SORT(.fini_array.*)))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
+ }
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
index 1d8984f..b51479d 100644
--- a/ld/scripttempl/elfxtensa.sc
+++ b/ld/scripttempl/elfxtensa.sc
@@ -350,9 +350,26 @@ cat <<EOF
.tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
.tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
- .preinit_array ${RELOCATING-0} : { KEEP (*(.preinit_array)) }
- .init_array ${RELOCATING-0} : { KEEP (*(.init_array)) }
- .fini_array ${RELOCATING-0} : { KEEP (*(.fini_array)) }
+ .preinit_array ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}}
+ 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 (*(.fini_array))
+ KEEP (*(SORT(.fini_array.*)))
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}}
+ }
${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}