* scripttempl/elf.sc (.init_array, .fini_array): Don't sort all
authorAlan Modra <amodra@gmail.com>
Thu, 21 Feb 2013 05:10:28 +0000 (05:10 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 21 Feb 2013 05:10:28 +0000 (05:10 +0000)
.init_array/.fini_array input sections before .ctors/.dtors input
sections.
(CTORS_IN_INIT_ARRAY, DTORS_IN_INIT_ARRAY): Adjust to suit.

ld/ChangeLog
ld/scripttempl/elf.sc

index 95d466daea70ed257da65b3d20480767c3099cce..ff9f1455e63fb4af10ae4d06b34d0c56666a80d1 100644 (file)
@@ -1,3 +1,10 @@
+2013-02-21  Alan Modra  <amodra@gmail.com>
+
+       * scripttempl/elf.sc (.init_array, .fini_array): Don't sort all
+       .init_array/.fini_array input sections before .ctors/.dtors input
+       sections.
+       (CTORS_IN_INIT_ARRAY, DTORS_IN_INIT_ARRAY): Adjust to suit.
+
 2013-02-21  Alan Modra  <amodra@gmail.com>
 
        * emultempl/elf32.em (write_build_id, setup_build_id): Adjust
index bbff2337e45f836fa626405c8c69858541879ed2..9491995eae8ba4e5a0300ba0fd7dc0464ae9749b 100644 (file)
@@ -233,8 +233,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
 if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
   SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
   SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
-  CTORS_IN_INIT_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))"
-  DTORS_IN_FINI_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))"
+  CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
+  DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
 else
   SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
   SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
@@ -245,16 +245,14 @@ INIT_ARRAY=".init_array   ${RELOCATING-0} :
   {
     ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
     ${SORT_INIT_ARRAY}
-    KEEP (*(.init_array))
-    ${CTORS_IN_INIT_ARRAY}
+    KEEP (*(.init_array ${CTORS_IN_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 = .);}}
     ${SORT_FINI_ARRAY}
-    KEEP (*(.fini_array))
-    ${DTORS_IN_FINI_ARRAY}
+    KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
     ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
   }"
 CTOR=".ctors        ${CONSTRUCTING-0} :