Add support for PE startup files that want to define their own constructor and desctr...
authorNick Clifton <nickc@redhat.com>
Thu, 10 Aug 2017 12:17:12 +0000 (13:17 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 10 Aug 2017 12:17:12 +0000 (13:17 +0100)
* scripttempl/pep.sc: Enclose __CTOR_LIST__, ___CTOR_LIST__,
__DTOR_LIST__ and ___DTOR_LIST__ in PROVIDE statements so that
they can be overrridden by crt input files.
* scripttempl/pe.sc: Likewise.

ld/ChangeLog
ld/scripttempl/pe.sc
ld/scripttempl/pep.sc

index b0191cfcce855e9920ce4a7284ab55796563a96f..12c3a746015b1a4f8266ca081cfd79c32d13663c 100644 (file)
@@ -1,3 +1,10 @@
+2017-08-10  Nick Clifton  <nickc@redhat.com>
+
+       * scripttempl/pep.sc: Enclose __CTOR_LIST__, ___CTOR_LIST__,
+       __DTOR_LIST__ and ___DTOR_LIST__ in PROVIDE statements so that
+       they can be overrridden by crt input files.
+       * scripttempl/pe.sc: Likewise.
+
 2017-08-09  H.J. Lu  <hongjiu.lu@intel.com>
 
        * testsuite/config/default.exp (LD_CLASS): Check .libs/ld-new
index 9f7b2b220ee283a40a9ee6a3cb2e017ab28bb1a9..5de44e561a0c3a8094ee625f0ac2fbca91f5a816 100644 (file)
@@ -97,10 +97,24 @@ SECTIONS
     ${RELOCATING+ *(.gnu.linkonce.t.*)}
     ${RELOCATING+*(.glue_7t)}
     ${RELOCATING+*(.glue_7)}
-    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
-                       LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0); }
-    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
-                       LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0); }
+    ${CONSTRUCTING+
+       PROVIDE(___CTOR_LIST__ = .);
+       PROVIDE(__CTOR_LIST__ = .);
+       LONG (-1);
+       KEEP(*(.ctors));
+       KEEP(*(.ctor));
+       KEEP(*(SORT_BY_NAME(.ctors.*)));
+       LONG (0);
+     }
+    ${CONSTRUCTING+
+       PROVIDE(___DTOR_LIST__ = .);
+       PROVIDE(__DTOR_LIST__ = .);
+       LONG (-1);
+       KEEP(*(.dtors));
+       KEEP(*(.dtor));
+       KEEP(*(SORT_BY_NAME(.dtors.*)));
+       LONG (0);
+     }
     ${RELOCATING+ KEEP (*(.fini))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}
index 57eb75c51c85d900f2d6dcf73c23712d69938485..e972ec86a60823cc34332b25247497f15b657065 100644 (file)
@@ -98,18 +98,24 @@ SECTIONS
     ${RELOCATING+*(.glue_7t)}
     ${RELOCATING+*(.glue_7)}
     ${CONSTRUCTING+. = ALIGN(8);}
-    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
-                       LONG (-1); LONG (-1);
-                       KEEP (*(.ctors));
-                       KEEP (*(.ctor));
-                       KEEP (*(SORT(.ctors.*)));
-                       LONG (0); LONG (0); }
-    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
-                       LONG (-1); LONG (-1);
-                       KEEP (*(.dtors));
-                       KEEP (*(.dtor));
-                       KEEP (*(SORT(.dtors.*)));
-                       LONG (0); LONG (0); }
+    ${CONSTRUCTING+
+       PROVIDE(___CTOR_LIST__ = .);
+       PROVIDE(__CTOR_LIST__ = .);
+       LONG (-1); LONG (-1);
+       KEEP (*(.ctors));
+       KEEP (*(.ctor));
+       KEEP (*(SORT_BY_NAME(.ctors.*)));
+       LONG (0); LONG (0);
+     }
+    ${CONSTRUCTING+
+       PROVIDE(___DTOR_LIST__ = .);
+       PROVIDE(__DTOR_LIST__ = .);
+       LONG (-1); LONG (-1);
+       KEEP (*(.dtors));
+       KEEP (*(.dtor));
+       KEEP (*(SORT_BY_NAME(.dtors.*)));
+       LONG (0); LONG (0);
+     }
     ${RELOCATING+ KEEP (*(.fini))}
     /* ??? Why is .gcc_exc here?  */
     ${RELOCATING+ *(.gcc_exc)}