[rtems commit] bsps/powerpc: Fix constructors with priority

Sebastian Huber sebh at rtems.org
Tue May 7 08:32:23 UTC 2019


Module:    rtems
Branch:    master
Commit:    30d61a66d96c1aa3f0eda7d364c3900c80db3985
Changeset: http://git.rtems.org/rtems/commit/?id=30d61a66d96c1aa3f0eda7d364c3900c80db3985

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue May  7 10:17:49 2019 +0200

bsps/powerpc: Fix constructors with priority

Update #3339.

---

 bsps/powerpc/shared/start/linkcmds.share | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/bsps/powerpc/shared/start/linkcmds.share b/bsps/powerpc/shared/start/linkcmds.share
index 365a849..deefbe2 100644
--- a/bsps/powerpc/shared/start/linkcmds.share
+++ b/bsps/powerpc/shared/start/linkcmds.share
@@ -182,30 +182,19 @@ SECTIONS
   .got2           :  { *(.got2) }	> CODE
   .dynamic        : { *(.dynamic) }	> CODE
 
-  .ctors          :
-  {
-    /* gcc uses crtbegin.o to find the start of
-       the constructors, so we make sure it is
-       first.  Because this is a wildcard, it
-       doesn't matter if the user does not
-       actually link against crtbegin.o; the
-       linker won't look for a file to match a
-       wildcard.  The wildcard also means that it
-       doesn't matter which directory crtbegin.o
-       is in.  */
+  .ctors          : {
+    KEEP (*ecrti.o(.ctors))
     KEEP (*crtbegin.o(.ctors))
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last */
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+    KEEP (*crtbegin?.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
     KEEP (*(SORT(.ctors.*)))
     KEEP (*(.ctors))
   } > CODE
-  .dtors          :
-  {
+  .dtors          : {
+    KEEP (*ecrti.o(.dtors))
     KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
     KEEP (*(SORT(.dtors.*)))
     KEEP (*(.dtors))
   } > CODE




More information about the vc mailing list