Add SORT_NONE to .init and .fini in scripts
authorAlan Modra <amodra@gmail.com>
Thu, 21 Mar 2019 04:28:35 +0000 (14:58 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 21 Mar 2019 11:49:20 +0000 (22:19 +1030)
The special case for .init and .fini in update_wild_statements is
ineffective for .init or .fini wildcards inside other output sections.
The special case needs to be on the wildcard, not the output section.
This patch is belt and braces, both fixing update_wild_statements and
the scripts.

* scripttempl/alpha.sc, * scripttempl/armbpabi.sc,
* scripttempl/crisaout.sc, * scripttempl/elf32cr16.sc,
* scripttempl/elf32crx.sc, * scripttempl/elf32xc16x.sc,
* scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc,
* scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc,
* scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc,
* scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc,
* scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc,
* scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc,
* scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc,
* scripttempl/ft32.sc, * scripttempl/i386beos.sc,
* scripttempl/iq2000.sc, * scripttempl/mcorepe.sc,
* scripttempl/mep.sc, * scripttempl/mips.sc, * scripttempl/moxie.sc,
* scripttempl/pe.sc, * scripttempl/pep.sc, * scripttempl/ppcpe.sc,
* scripttempl/tic4xcoff.sc, * scripttempl/tic80coff.sc,
* scripttempl/v850.sc, * scripttempl/v850_rh850.sc,
* scripttempl/visium.sc, * scripttempl/xstormy16.sc: Add KEEP and
SORT_NONE to .init and .fini wildcards.
* scripttempl/elf32xc16x.sc,
* scripttempl/elf32xc16xl.sc,
* scripttempl/elf32xc16xs.sc: Add .fini wildcard.
* scripttempl/elf_chaos.sc: Add .init output section.
* scripttempl/elfd30v.sc: Remove duplicate .init.
* scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc,
* scripttempl/elfm9s12z.sc, * scripttempl/elfxgate.sc: Remove
duplicate .init, and add .fini wildcard.
* scripttempl/ppcpe.sc (INIT, FINI): Delete.
* ldlang.c (update_wild_statements): Special case .init and
.fini in the wildcard, not the output section.

38 files changed:
ld/ChangeLog
ld/ldlang.c
ld/scripttempl/alpha.sc
ld/scripttempl/armbpabi.sc
ld/scripttempl/crisaout.sc
ld/scripttempl/elf32cr16.sc
ld/scripttempl/elf32crx.sc
ld/scripttempl/elf32xc16x.sc
ld/scripttempl/elf32xc16xl.sc
ld/scripttempl/elf32xc16xs.sc
ld/scripttempl/elf64hppa.sc
ld/scripttempl/elf_chaos.sc
ld/scripttempl/elfarc.sc
ld/scripttempl/elfarcv2.sc
ld/scripttempl/elfd30v.sc
ld/scripttempl/elfm68hc11.sc
ld/scripttempl/elfm68hc12.sc
ld/scripttempl/elfm9s12z.sc
ld/scripttempl/elfmicroblaze.sc
ld/scripttempl/elfxgate.sc
ld/scripttempl/elfxtensa.sc
ld/scripttempl/epiphany_4x4.sc
ld/scripttempl/ft32.sc
ld/scripttempl/i386beos.sc
ld/scripttempl/iq2000.sc
ld/scripttempl/mcorepe.sc
ld/scripttempl/mep.sc
ld/scripttempl/mips.sc
ld/scripttempl/moxie.sc
ld/scripttempl/pe.sc
ld/scripttempl/pep.sc
ld/scripttempl/ppcpe.sc
ld/scripttempl/tic4xcoff.sc
ld/scripttempl/tic80coff.sc
ld/scripttempl/v850.sc
ld/scripttempl/v850_rh850.sc
ld/scripttempl/visium.sc
ld/scripttempl/xstormy16.sc

index 37688808c92c07efa3f6291e492707b573a1431b..a8f8e306f84fb2e34481f013b860b6b90432749d 100644 (file)
@@ -1,3 +1,35 @@
+2019-03-21  Alan Modra  <amodra@gmail.com>
+
+       * scripttempl/alpha.sc, * scripttempl/armbpabi.sc,
+       * scripttempl/crisaout.sc, * scripttempl/elf32cr16.sc,
+       * scripttempl/elf32crx.sc, * scripttempl/elf32xc16x.sc,
+       * scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc,
+       * scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc,
+       * scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc,
+       * scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc,
+       * scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc,
+       * scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc,
+       * scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc,
+       * scripttempl/ft32.sc, * scripttempl/i386beos.sc,
+       * scripttempl/iq2000.sc, * scripttempl/mcorepe.sc,
+       * scripttempl/mep.sc, * scripttempl/mips.sc, * scripttempl/moxie.sc,
+       * scripttempl/pe.sc, * scripttempl/pep.sc, * scripttempl/ppcpe.sc,
+       * scripttempl/tic4xcoff.sc, * scripttempl/tic80coff.sc,
+       * scripttempl/v850.sc, * scripttempl/v850_rh850.sc,
+       * scripttempl/visium.sc, * scripttempl/xstormy16.sc: Add KEEP and
+       SORT_NONE to .init and .fini wildcards.
+       * scripttempl/elf32xc16x.sc,
+       * scripttempl/elf32xc16xl.sc,
+       * scripttempl/elf32xc16xs.sc: Add .fini wildcard.
+       * scripttempl/elf_chaos.sc: Add .init output section.
+       * scripttempl/elfd30v.sc: Remove duplicate .init.
+       * scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc,
+       * scripttempl/elfm9s12z.sc, * scripttempl/elfxgate.sc: Remove
+       duplicate .init, and add .fini wildcard.
+       * scripttempl/ppcpe.sc (INIT, FINI): Delete.
+       * ldlang.c (update_wild_statements): Special case .init and
+       .fini in the wildcard, not the output section.
+
 2019-03-21  Alan Modra  <amodra@gmail.com>
 
        * emulparams/elf32lm32fd.sh (DYNAMIC_LINK): Undef.
index 77d890eb704c02033acae80eff67c4212c30846f..1952d4a475c26b1728da8c3426b00eafc7b7da35 100644 (file)
@@ -3744,7 +3744,9 @@ update_wild_statements (lang_statement_union_type *s)
            case lang_wild_statement_enum:
              for (sec = s->wild_statement.section_list; sec != NULL;
                   sec = sec->next)
-               {
+               /* Don't sort .init/.fini sections.  */
+               if (strcmp (sec->spec.name, ".init") != 0
+                   && strcmp (sec->spec.name, ".fini") != 0)
                  switch (sec->spec.sorted)
                    {
                    case none:
@@ -3761,7 +3763,6 @@ update_wild_statements (lang_statement_union_type *s)
                    default:
                      break;
                    }
-               }
              break;
 
            case lang_constructors_statement_enum:
@@ -3769,11 +3770,8 @@ update_wild_statements (lang_statement_union_type *s)
              break;
 
            case lang_output_section_statement_enum:
-             /* Don't sort .init/.fini sections.  */
-             if (strcmp (s->output_section_statement.name, ".init") != 0
-                 && strcmp (s->output_section_statement.name, ".fini") != 0)
-               update_wild_statements
-                 (s->output_section_statement.children.head);
+             update_wild_statements
+               (s->output_section_statement.children.head);
              break;
 
            case lang_group_statement_enum:
index d0c7c71d3acb5aaa0388d60c4ff26f7a6c529c1d..d1d978d7ec50be017438704089179fdca24026bb 100644 (file)
@@ -34,12 +34,12 @@ SECTIONS
   .text : {
     ${RELOCATING+ _ftext = .;}
     ${RELOCATING+ __istart = .;}
-    ${RELOCATING+ *(.init)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
     ${RELOCATING+ LONG (0x6bfa8001)}
     ${RELOCATING+ eprol = .;}
     *(.text)
     ${RELOCATING+ __fstart = .;}
-    ${RELOCATING+ *(.fini)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+ LONG (0x6bfa8001)}
     ${RELOCATING+ _etext = .;}
   }
index a573a1db0828d7e722ef6392636162b1d86cbd1d..cb71b557d3ff2a623c60a843d0a1e8a338248d40 100644 (file)
@@ -208,7 +208,7 @@ cat <<EOF
   .init         ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } =${NOP-0}
   .text         ${RELOCATING-0} :
@@ -222,7 +222,7 @@ cat <<EOF
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   /* The SymbianOS kernel requires that the PLT go at the end of the
index 5cb59e141c4e017fdab31a94624296bdda936f87..9a9cf78d81593ff39ee9fb4da86c220ed239beb5 100644 (file)
@@ -42,7 +42,7 @@ SECTIONS
     ${CONSTRUCTING+ PROVIDE (___do_global_ctors = .);}
     ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
     ${CONSTRUCTING+ SHORT (0xbe7e);}
-    ${CONSTRUCTING+ *(.init)}
+    ${CONSTRUCTING+ KEEP (*(SORT_NONE(.init)))}
     ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
     ${CONSTRUCTING+ PROVIDE (__init__end = .);}
     ${CONSTRUCTING+ PROVIDE (___init__end = .);}
@@ -52,7 +52,7 @@ SECTIONS
     ${CONSTRUCTING+ PROVIDE (___do_global_dtors = .);}
     ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
     ${CONSTRUCTING+ SHORT (0xbe7e);}
-    ${CONSTRUCTING+ *(.fini)}
+    ${CONSTRUCTING+ KEEP (*(SORT_NONE(.fini)))}
     ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
     ${CONSTRUCTING+ PROVIDE (__fini__end = .);}
     ${CONSTRUCTING+  ___fini__end = .;}
index 9ae6bc255712501eaab35b882a5e390bdb097718..0da4603618c8742819c4562b60643858c2dedf1c 100644 (file)
@@ -62,14 +62,14 @@ SECTIONS
   .init :
   {
     __INIT_START = .;
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     __INIT_END = .;
   }${RELOCATING+ > rom}
 
   .fini :
   {
     __FINI_START = .;
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     __FINI_END = .;
   }${RELOCATING+ > rom}
 
index 46acea1799a019c7f96d8bfaefa05f9a247d58f6..64fefda1206bf91825bdf67340f12a047a4a570e 100644 (file)
@@ -58,14 +58,14 @@ SECTIONS
   .init :
   {
     __INIT_START = .;
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     __INIT_END = .;
   } > rom
 
   .fini :
   {
     __FINI_START = .;
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     __FINI_END = .;
   } > rom
 
index b4325585fd50e19b622594882c01b179c76fda76..a451d41b9aa6dfb04a37f3af4887a11321cda73f 100644 (file)
@@ -38,7 +38,8 @@ SECTIONS
 {
 .init :
        {
-         *(.init)
+         KEEP (*(SORT_NONE(.init)))
+         ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
        } ${RELOCATING+ >introm}
 
 .text :
index 3b6a5164ad48e29e5b2d82f67a2a8ed12a9a311a..9dca52d9f5ba6275ce500a471d9cae127c095e8a 100644 (file)
@@ -40,7 +40,8 @@ SECTIONS
        } ${RELOCATING+ > vectarea} */
 .init :
        {
-         *(.init)
+         KEEP (*(SORT_NONE(.init)))
+         ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
        } ${RELOCATING+ >introm}
 
 .text :
index 856991827ff8bec0c43966324902aea60b6ddfc8..d3eec11ad3f8a4bb5028049a9d4d5ba8c14d2364 100644 (file)
@@ -41,7 +41,8 @@ SECTIONS
        } ${RELOCATING+ > vectarea} */
 .init :
        {
-         *(.init)
+         KEEP (*(SORT_NONE(.init)))
+         ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
        } ${RELOCATING+ >introm}
 
 .text :
index 89271bbca8fc5a913673eaf2129f889210b09dac..ee8fb93bba3201c1b48cb537ea87322fd98d6841 100644 (file)
@@ -403,7 +403,7 @@ cat <<EOF
   .init         ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } =${NOP-0}
 
@@ -420,7 +420,7 @@ cat <<EOF
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
index c26c508b9e6d91eb5cf26dabd2896277c6855f58..1cc63b63ddc2af55ea3feae124d4d4583c3a9f36 100644 (file)
@@ -251,10 +251,16 @@ cat <<EOF
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
   } =${NOP-0}
+  .init         ${RELOCATING-0} :
+  {
+    ${RELOCATING+${INIT_START}}
+    KEEP (*(SORT_NONE(.init)))
+    ${RELOCATING+${INIT_END}}
+  } =${NOP-0}
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   ${RELOCATING+PROVIDE (__etext = .);}
index 5738de31d104f558308338f60f2b3e1f045cb6ad..79d9924092aa2f62536a4de42d270c013b0ffe9a 100644 (file)
@@ -257,7 +257,7 @@ cat <<EOF
   .init         ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } =${NOP-0}
 
@@ -283,7 +283,7 @@ cat <<EOF
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   ${RELOCATING+PROVIDE (__etext = .);}
index 1027123eec6c6a3617a3f6a9545f38cd22eed7e1..9b55333dc1369d6f2aa8c42c703412ccca8237b5 100644 (file)
@@ -196,7 +196,7 @@ SECTIONS
   .init         ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } ${RELOCATING+ > ${TEXT_MEMORY}}  =${NOP-0}
 
@@ -215,7 +215,7 @@ SECTIONS
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
 
     ${RELOCATING+PROVIDE (__etext = .);}
index c2b3ebabdbf620724919f00e1bcf3612626473e1..e324c601095b87eda4c718141f8bab51dd138753 100644 (file)
@@ -116,7 +116,7 @@ SECTIONS
   .rel.plt             ${RELOCATING-0} : { *(.rel.plt) }
   .rela.plt            ${RELOCATING-0} : { *(.rela.plt) }
 
-  .init                        ${RELOCATING-0} : { *(.init) } =${NOP-0}
+  .init                        ${RELOCATING-0} : { KEEP (*(SORT_NONE(.init))) } =${NOP-0}
   ${DATA_PLT-${PLT}}
 
   /* Internal text space */
@@ -127,8 +127,7 @@ SECTIONS
   {
     *(.text)
     ${RELOCATING+*(.gnu.linkonce.t*)
-    *(SORT_NONE(.init))
-    *(SORT_NONE(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     _etext = . ;}
   } ${RELOCATING+ > ${TEXT_MEMORY}}
 
index f5406f40c2efb7bd7c6bc92bea76d4f88da5828a..dc3f14eae53fee8b4a5a266be16d0811644f8c20 100644 (file)
@@ -307,7 +307,7 @@ SECTIONS
 
   .init        ${RELOCATING-0} :
   {
-    *(.init)
+    KEEP (*(SORT_NONE(.init)))
   } ${RELOCATING+=${NOP-0}}
 
   ${RELOCATING-${INSTALL_RELOC}}
@@ -318,7 +318,6 @@ SECTIONS
     /* Put startup code at beginning so that _start keeps same address.  */
     ${RELOCATING+${STARTUP_CODE}}
 
-    ${RELOCATING+*(.init)}
     *(.text)
     ${RELOCATING+*(.text.*)}
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -327,6 +326,7 @@ SECTIONS
     ${RELOCATING+*(.tramp)}
     ${RELOCATING+*(.tramp.*)}
 
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+${FINISH_CODE}}
 
     ${RELOCATING+_etext = .;}
index 5c68ffffa58f0f08437a6dcfeb8db82857057f89..9f8d92aeae85735beefb0244fb59a25fb01b7547 100644 (file)
@@ -306,7 +306,7 @@ SECTIONS
 
   .init        ${RELOCATING-0} :
   {
-    *(.init)
+    KEEP (*(SORT_NONE(.init)))
   } ${RELOCATING+=${NOP-0}}
 
   ${RELOCATING-${INSTALL_RELOC}}
@@ -317,7 +317,6 @@ SECTIONS
     /* Put startup code at beginning so that _start keeps same address.  */
     ${RELOCATING+${STARTUP_CODE}}
 
-    ${RELOCATING+*(.init)}
     *(.text)
     ${RELOCATING+*(.text.*)}
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -326,6 +325,7 @@ SECTIONS
     ${RELOCATING+*(.tramp)}
     ${RELOCATING+*(.tramp.*)}
 
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+${FINISH_CODE}}
 
     ${RELOCATING+_etext = .;}
index 3fd14e93f6eeba850899568129a65976a813af1a..d640882c173e73c1045160490cbf45b5cce9b95c 100644 (file)
@@ -292,7 +292,7 @@ SECTIONS
 
   .init        ${RELOCATING-0} :
   {
-    *(.init)
+    KEEP (*(SORT_NONE(.init)))
   } ${RELOCATING+=${NOP-0}}
 
   ${RELOCATING-${INSTALL_RELOC}}
@@ -303,7 +303,6 @@ SECTIONS
     /* Put startup code at beginning so that _start keeps same address.  */
     ${RELOCATING+${STARTUP_CODE}}
 
-    ${RELOCATING+*(.init)}
     *(.text)
     ${RELOCATING+*(.text.*)}
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -312,6 +311,7 @@ SECTIONS
     ${RELOCATING+*(.tramp)}
     ${RELOCATING+*(.tramp.*)}
 
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+${FINISH_CODE}}
 
     ${RELOCATING+_etext = .;}
index 30b9c2867077980a2040eaf9230e0ac7fc1ea69b..989b7fd9ae1c60a7550d40de8c7ce05e88ad8f92 100644 (file)
@@ -85,8 +85,8 @@ SECTIONS
   }
   ${RELOCATING+ _etext  =  .;}
 
-  .init : { KEEP (*(.init))    } =0
-  .fini : { KEEP (*(.fini))    } =0
+  .init : { KEEP (*(SORT_NONE(.init))) } =0
+  .fini : { KEEP (*(SORT_NONE(.fini))) } =0
 
   ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
   ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);}
index fe16e814df6785abd4c4816a72202760009bde9d..fd6c0738e467b23056b8bcec8555ceca69bf4a4d 100644 (file)
@@ -306,7 +306,7 @@ SECTIONS
 
   .init        ${RELOCATING-0} :
   {
-    *(.init)
+    KEEP (*(SORT_NONE(.init)))
   } ${RELOCATING+=${NOP-0}}
 
   ${RELOCATING-${INSTALL_RELOC}}
@@ -317,7 +317,6 @@ SECTIONS
     /* Put startup code at beginning so that _start keeps same address.  */
     ${RELOCATING+${STARTUP_CODE}}
 
-    ${RELOCATING+*(.init)}
     *(.text)
     ${RELOCATING+*(.text.*)}
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -326,6 +325,7 @@ SECTIONS
     ${RELOCATING+*(.tramp)}
     ${RELOCATING+*(.tramp.*)}
 
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+${FINISH_CODE}}
 
     ${RELOCATING+_etext = .;}
index ef1eee258b0c871e1861915bf8187faadf9aa678..e81cb98375d811059646f5715e7dd05b0e9fae7e 100644 (file)
@@ -147,9 +147,9 @@ RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.
 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
 DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
 INIT_LIT=".init.literal 0 : { *(.init.literal) }"
-INIT=".init         0 : { *(.init)             }"
+INIT=".init         0 : { KEEP (*(SORT_NONE(.init))) }"
 FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
-FINI=".fini         0 : { *(.fini)             }"
+FINI=".fini         0 : { KEEP (*(SORT_NONE(.fini))) }"
 if test -z "${NO_SMALL_DATA}"; then
   SBSS=".sbss         ${RELOCATING-0} :
   {
index 315692634228ea93ce3a75cc6c18fa6b66c214e9..f86ce89dd3c8877b04cd568e406570d5576e110f 100644 (file)
@@ -472,7 +472,7 @@ cat <<EOF
   .init  ${RELOCATING-0}${RELOCATING+__init_start}  :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0}
 
@@ -482,7 +482,7 @@ cat <<EOF
   .fini ${RELOCATING-0}${RELOCATING+ADDR(.init)+SIZEOF(.init)} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0}
 
index 2d7d64769437840bca4bbcf082d72664ce1a55e6..ef7f332aa504382111cea22e17e335a01e57c351 100644 (file)
@@ -35,8 +35,8 @@ SECTIONS
     *(.text${RELOCATING+*})
     ${RELOCATING+*(.strings)
     *(._pm*)
-    *(.init)
-    *(.fini)
+    KEEP (*(SORT_NONE(.init)))
+    KEEP (*(SORT_NONE(.fini)))
     _etext = .;
     . = ALIGN(4);}
   } ${RELOCATING+ > flash}
index 47da2742ef3f8fe2cd80632926230d1c56b44ef9..f4ce42ccded5a11bbefc737194448167d5ed906c 100644 (file)
@@ -59,7 +59,7 @@ SECTIONS
   .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
   {
     ${RELOCATING+ __text_start__ = . ;}
-    ${RELOCATING+ *(.init)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
     *(.text)
     ${R_TEXT}
     *(.glue_7t)
@@ -68,7 +68,7 @@ SECTIONS
                        LONG (-1); *(.ctors); *(.ctor); LONG (0); }
     ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
                        LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
-    ${RELOCATING+ *(.fini)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}
     ${RELOCATING+ etext = .;}
index f2ee794a3fc3051971e228ee31a67dd102989642..2f988ec4aa585633171c2fd52f6e91335d0df300 100644 (file)
@@ -289,7 +289,7 @@ cat <<EOF
   .init        ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } =${NOP-0}
 
@@ -308,7 +308,7 @@ cat <<EOF
   .fini    ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   ${RELOCATING+PROVIDE (__etext = .);}
index 45285dc1819cfaac7c7f87c11454664a0c8916bf..e7cf3d3544531388e90fdf78d2be89b57f284347 100644 (file)
@@ -65,7 +65,7 @@ SECTIONS
 {
   .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
   {
-    ${RELOCATING+ *(.init)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
     *(.text)
     ${R_TEXT}
     ${RELOCATING+ *(.text.*)}
@@ -75,7 +75,7 @@ SECTIONS
                        LONG (-1); *(.ctors); *(.ctor); LONG (0); }
     ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
                        LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
-    ${RELOCATING+ *(.fini)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}
     ${RELOCATING+ etext = .;}
index 3ce39ff2128cdcd3c94a73e22ce545d6a31017a5..139d1b83b100af2aefeb8a0c5f29c3aa80514886 100644 (file)
@@ -302,7 +302,7 @@ cat <<EOF
   .init         ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   } =${NOP-0}
 
@@ -318,7 +318,7 @@ cat <<EOF
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   } =${NOP-0}
   ${RELOCATING+PROVIDE (__etext = .);}
index 3b080d3da67d0f5320d34e5aab315299d9a098c2..7de30bdc74c4f99b922a51474e6f538287272dae 100644 (file)
@@ -40,13 +40,13 @@ SECTIONS
 {
   ${RELOCATING+. = ${TEXT_START_ADDR};}
   .text : {
-    ${RELOCATING+ _ftext = . };
-    *(.init)
-    ${RELOCATING+ eprol  =  .};
+    ${RELOCATING+_ftext = .;
+    KEEP (*(SORT_NONE(.init)))
+    eprol  =  .;}
     *(.text)
-    *(.fini)
-    ${RELOCATING+ etext  =  .};
-    ${RELOCATING+ _etext  =  .};
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))
+    etext  =  .;
+    _etext  =  .;}
   }
   ${RELOCATING+. = ${DATA_ADDR};}
   .rdata : {
index bdb63277d1ee963a5aabff767396941409764a44..fbfc832ca52e98965ef968fc91af113bb89db523 100644 (file)
@@ -29,10 +29,10 @@ SECTIONS
   .text :
   {
     *(.text)
-      .init : { KEEP (*(.init)) } =0
-      .fini : { KEEP (*(.fini)) } =0
+    ${RELOCATING+KEEP (*(SORT_NONE(.init)))
+    KEEP (*(SORT_NONE(.fini)))
     *(.strings)
-    ${RELOCATING+ _etext = . ; }
+    _etext = . ; }
   } ${RELOCATING+ > ram}
   ${CONSTRUCTING+${TORS}}
   .data :
index a9e64f663198cc83429e2f42665195ac35ed906d..865ee58d919c3a159661737f1dcd0e9ac10819bd 100644 (file)
@@ -90,7 +90,7 @@ SECTIONS
   ${RELOCATING+. = ALIGN(__section_alignment__);}
   .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
   {
-    ${RELOCATING+ KEEP(*(.init))}
+    ${RELOCATING+KEEP (*(SORT_NONE(.init)))}
     *(.text)
     ${R_TEXT}
     ${RELOCATING+ *(.text.*)}
@@ -133,7 +133,7 @@ SECTIONS
        KEEP(*(SORT_BY_NAME(.dtors.*)));
        LONG (0);
      }
-    ${RELOCATING+ KEEP (*(.fini))}
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}
     ${RELOCATING+PROVIDE (etext = .);}
index 41e7962c3f7cc9e674fedefd167df4ee6b5f6fea..e6d594c2bbe267827bf6837b743e8b3fccca3f87 100644 (file)
@@ -90,7 +90,7 @@ SECTIONS
   ${RELOCATING+. = ALIGN(__section_alignment__);}
   .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
   {
-    ${RELOCATING+ KEEP(*(.init))}
+    ${RELOCATING+KEEP (*(SORT_NONE(.init)))}
     *(.text)
     ${R_TEXT}
     ${RELOCATING+ *(.text.*)}
@@ -134,7 +134,7 @@ SECTIONS
        KEEP (*(SORT_BY_NAME(.dtors.*)));
        LONG (0); LONG (0);
      }
-    ${RELOCATING+ KEEP (*(.fini))}
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}
     ${RELOCATING+PROVIDE (etext = .);}
index bb2a093047ec52082b27a10241a5ff6c98c1bb41..38920a17b6f8d79fafeea7ba9852e0fd4b528989 100644 (file)
@@ -8,11 +8,6 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.
 #
-# These are substituted in as variables in order to get '}' in a shell
-# conditional expansion.
-
-INIT='.init : { *(.init) }'
-FINI='.fini : { *(.fini) }'
 
 cat <<EOF
 /* Copyright (C) 2014-2019 Free Software Foundation, Inc.
@@ -44,7 +39,7 @@ SECTIONS
   /* text - the usual meaning */
   .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
        {
-           ${RELOCATING+ *(.init);}
+           ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
            *(.text)
            ${RELOCATING+ *(.text.*)}
            *(.gcc_except_table)
@@ -52,7 +47,7 @@ SECTIONS
                        LONG (-1); *(.ctors); *(.ctor); LONG (0); }
            ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
                        LONG (-1); *(.dtors); *(.dtor); LONG (0); }
-           ${RELOCATING+ *(.fini);}
+           ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
            ${RELOCATING+ etext = .};
        }
 
index f610f44fd5efc586a298a6b42d8da50ce267b3db..2607a68fd7ec381d444df0865b2b0ff05f1114e9 100644 (file)
@@ -109,7 +109,7 @@ SECTIONS
   /* Program code.  */
   .text : {
     ${RELOCATING+  __text =  .;}
-    ${RELOCATING+ *(.init)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
     *(.text)
     ${CONSTRUCTING+ ___CTOR_LIST__ = .;}
     ${CONSTRUCTING+ LONG(___CTOR_END__ - ___CTOR_LIST__ - 2)}
@@ -121,7 +121,7 @@ SECTIONS
     ${CONSTRUCTING+ *(.dtors)}
     ${CONSTRUCTING+ LONG(0)}
     ${CONSTRUCTING+ ___DTOR_END__  = .;}
-    ${RELOCATING+ *(.fini)}
+    ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+  __etext =  .;}
   } ${RELOCATING+ > ${TEXT_MEMORY}}
   /* Global initialised variables.  */
index 9c0798ac5b0b1d6590aa1ef471b9af8249830c07..692227a8b433e43b730ddb38db739d1fb6deb11b 100644 (file)
@@ -40,8 +40,8 @@ ${RELOCATING+ENTRY (${ENTRY})}
 SECTIONS
 {
   .text ${RELOCATING+ $TEXT_START_ADDR} : {
-    *(.init)
-    *(.fini)
+    ${RELOCATING+KEEP (*(SORT_NONE(.init)))
+    KEEP (*(SORT_NONE(.fini)))}
     *(.text)
   }
   .const ALIGN(4) : {
index 2a87e6dedad1d0b19c423de2f405c83ca2274b36..f961530d9c557a8d0e49161b4d38229893dd36e7 100644 (file)
@@ -71,7 +71,7 @@ SECTIONS
   .rela.bss    : { *(.rela.bss) }
   .rel.plt     : { *(.rel.plt) }
   .rela.plt    : { *(.rela.plt) }
-  .init                : { KEEP (*(.init)) } =0
+  .init                : { KEEP (*(SORT_NONE(.init))) } =0
   .plt         : { *(.plt) }
 
   .text                :
@@ -102,7 +102,7 @@ SECTIONS
     *(.call_table_text)
   }
 
-  .fini                : { KEEP (*(.fini)) } =0
+  .fini                : { KEEP (*(SORT_NONE(.fini))) } =0
   .rodata      : { *(.rodata) ${RELOCATING+*(.rodata.*) *(.gnu.linkonce.r*)} }
   .rodata1     : { *(.rodata1) }
 
index 3d594d87b6e307de48b5e54ecaa0b8ff038ae48f..fc1a383e195b817b7e906e7b76ecf35a6bd997eb 100644 (file)
@@ -75,7 +75,7 @@ SECTIONS
   .rela.bss    : { *(.rela.bss) }
   .rel.plt     : { *(.rel.plt) }
   .rela.plt    : { *(.rela.plt) }
-  .init                : { KEEP (*(.init)) } =0
+  .init                : { KEEP (*(SORT_NONE(.init))) } =0
   .plt         : { *(.plt) }
 
   .text                :
@@ -106,7 +106,7 @@ SECTIONS
     *(.call_table_text)
   }
 
-  .fini                : { KEEP (*(.fini)) } =0
+  .fini                : { KEEP (*(SORT_NONE(.fini))) } =0
   .rodata      :
   {
        *(.rodata)
index 9e98429e0ab513dc6eb7854c1859a087dc4b1b33..dfbe2c1c4ad665d7617416daddbb9b152866dc39 100644 (file)
@@ -60,8 +60,8 @@ cat <<EOF
 SECTIONS
 {
   .init ${RELOCATING-0} : {
-    KEEP (*(.init))
-    ${RELOCATING+KEEP (*(.fini))}
+    KEEP (*(SORT_NONE(.init)))
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
     ${RELOCATING+ _einit  =  .;}
   } ${RELOCATING+ > init}
 
index 820676720c4c89ead01a23574e2ef05ca79046ce..757e0b8feab49f55dfe22b0821199c15815661c9 100644 (file)
@@ -189,13 +189,13 @@ SECTIONS
   .init        ${RELOCATING-0} :
   {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
   }${RELOCATING+ > ROM =${NOP-0}}
   .fini    ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
   }${RELOCATING+ > ROM =${NOP-0}}
   ${RELOCATING+PROVIDE (__etext = .);}
This page took 0.046001 seconds and 4 git commands to generate.