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

Sebastian Huber sebh at rtems.org
Fri Dec 20 06:17:18 UTC 2019


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 19 12:05:45 2019 +0100

bsps/powerpc: Support constructors with priority

Close #3339.

---

 bsps/powerpc/gen5200/start/linkcmds.gen5200_base | 19 +++----------
 bsps/powerpc/haleakala/start/linkcmds            | 34 +++++++++---------------
 bsps/powerpc/mpc8260ads/start/linkcmds           | 34 +++++++++---------------
 bsps/powerpc/ss555/start/linkcmds                | 33 +++++++++--------------
 bsps/powerpc/virtex4/start/linkcmds              | 27 +++++++------------
 bsps/powerpc/virtex5/start/linkcmds              | 27 +++++++------------
 6 files changed, 59 insertions(+), 115 deletions(-)

diff --git a/bsps/powerpc/gen5200/start/linkcmds.gen5200_base b/bsps/powerpc/gen5200/start/linkcmds.gen5200_base
index ca9d50e..8c5e97e 100644
--- a/bsps/powerpc/gen5200/start/linkcmds.gen5200_base
+++ b/bsps/powerpc/gen5200/start/linkcmds.gen5200_base
@@ -177,31 +177,20 @@ SECTIONS {
 		/*
 		 * BSP: Moved into .data from .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.  */
+		KEEP (*ecrti.o(.ctors))
 		KEEP (*crtbegin.o(.ctors))
 		KEEP (*crtbegin?.o(.ctors))
-		/* We don't want to include the .ctor section 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 *crtend?.o ) .ctors))
+		KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
 		KEEP (*(SORT(.ctors.*)))
 		KEEP (*(.ctors))
 
 		/*
 		 * BSP: Moved into .data from .dtors
 		 */
+		KEEP (*ecrti.o(.dtors))
 		KEEP (*crtbegin.o(.dtors))
 		KEEP (*crtbegin?.o(.dtors))
-		KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
+		KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
 		KEEP (*(SORT(.dtors.*)))
 		KEEP (*(.dtors))
 
diff --git a/bsps/powerpc/haleakala/start/linkcmds b/bsps/powerpc/haleakala/start/linkcmds
index dad3e5c..a35ac87 100644
--- a/bsps/powerpc/haleakala/start/linkcmds
+++ b/bsps/powerpc/haleakala/start/linkcmds
@@ -77,27 +77,19 @@ SECTIONS
     *(.fini)
     *ecrtn.o(.init)
 
-    /* 
-     *  C++ constructors and destructors for static objects.
-     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
-     *  constructor and destructor lists that begin with the list length
-     *  end terminate with a NULL entry.
-     */
-     
-    PROVIDE (__CTOR_LIST__ = .);	     
-    *crtbegin.o(.ctors)
-    *(.ctors)
-    *crtend.o(.ctors)
-    LONG(0)
-    PROVIDE (__CTOR_END__ = .);
-	
-    PROVIDE (__DTOR_LIST__ = .);
-    *crtbegin.o(.dtors)
-    *(.dtors)
-    *crtend.o(.dtors)
-    LONG(0)
-    PROVIDE (__DTOR_END__ = .);
-	
+    KEEP (*ecrti.o(.ctors))
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    KEEP (*ecrti.o(.dtors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+
     /* Exception frame info */
      *(.eh_frame)
     /* Miscellaneous read-only data */
diff --git a/bsps/powerpc/mpc8260ads/start/linkcmds b/bsps/powerpc/mpc8260ads/start/linkcmds
index 82550d4..984027d 100644
--- a/bsps/powerpc/mpc8260ads/start/linkcmds
+++ b/bsps/powerpc/mpc8260ads/start/linkcmds
@@ -93,28 +93,18 @@ SECTIONS
     *(.fini)
     *ecrtn.o(.init)
 
-    /*
-     *  C++ constructors and destructors for static objects.
-     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
-     *  constructor and destructor lists that begin with the list length
-     *  end terminate with a NULL entry.
-     */
-
-    PROVIDE (__CTOR_LIST__ = .);
-    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
-    *crtbegin.o(.ctors)
-    *(.ctors)
-    *crtend.o(.ctors)
-    LONG(0)
-    PROVIDE (__CTOR_END__ = .);
-
-    PROVIDE (__DTOR_LIST__ = .);
-    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
-    *crtbegin.o(.dtors)
-    *(.dtors)
-    *crtend.o(.dtors)
-    LONG(0)
-    PROVIDE (__DTOR_END__ = .);
+    KEEP (*ecrti.o(.ctors))
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    KEEP (*ecrti.o(.dtors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
 
     /* Exception frame info */
     *(.eh_frame)
diff --git a/bsps/powerpc/ss555/start/linkcmds b/bsps/powerpc/ss555/start/linkcmds
index 04c9556..69e9553 100644
--- a/bsps/powerpc/ss555/start/linkcmds
+++ b/bsps/powerpc/ss555/start/linkcmds
@@ -77,27 +77,18 @@ SECTIONS
     *(.fini)
     *ecrtn.o(.init)
 
-    /*
-     *  C++ constructors and destructors for static objects.
-     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
-     *  constructor and destructor lists that begin with the list length
-     *  end terminate with a NULL entry.
-     */
-    PROVIDE (__CTOR_LIST__ = .);
-    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
-    *crtbegin.o(.ctors)
-    *(.ctors)
-    *crtend.o(.ctors)
-    LONG(0)
-    PROVIDE (__CTOR_END__ = .);
-
-    PROVIDE (__DTOR_LIST__ = .);
-    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
-    *crtbegin.o(.dtors)
-    *(.dtors)
-    *crtend.o(.dtors)
-    LONG(0)
-    PROVIDE (__DTOR_END__ = .);
+    KEEP (*ecrti.o(.ctors))
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    KEEP (*ecrti.o(.dtors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
 
     /*
      * Special FreeBSD sysctl sections.
diff --git a/bsps/powerpc/virtex4/start/linkcmds b/bsps/powerpc/virtex4/start/linkcmds
index d46df2f..097beb6 100644
--- a/bsps/powerpc/virtex4/start/linkcmds
+++ b/bsps/powerpc/virtex4/start/linkcmds
@@ -161,29 +161,20 @@ SECTIONS
 
   .dynamic        : { *(.dynamic)                                      } > RAM
 
-  .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
-                       * 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))
                     } > RAM
 
-  .dtors          : { KEEP (*crtbegin.o(.dtors))
-                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+  .dtors          : {
+                      KEEP (*ecrti.o(.dtors))
+                      KEEP (*crtbegin.o(.dtors))
+                      KEEP (*crtbegin?.o(.dtors))
+                      KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
                       KEEP (*(SORT(.dtors.*)))
                       KEEP (*(.dtors))
                     } > RAM
diff --git a/bsps/powerpc/virtex5/start/linkcmds b/bsps/powerpc/virtex5/start/linkcmds
index 9a5edf7..7bb0eda 100644
--- a/bsps/powerpc/virtex5/start/linkcmds
+++ b/bsps/powerpc/virtex5/start/linkcmds
@@ -161,29 +161,20 @@ SECTIONS
 
   .dynamic        : { *(.dynamic)                                      } > RAM
 
-  .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
-                       * 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))
                     } > RAM
 
-  .dtors          : { KEEP (*crtbegin.o(.dtors))
-                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+  .dtors          : {
+                      KEEP (*ecrti.o(.dtors))
+                      KEEP (*crtbegin.o(.dtors))
+                      KEEP (*crtbegin?.o(.dtors))
+                      KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
                       KEEP (*(SORT(.dtors.*)))
                       KEEP (*(.dtors))
                     } > RAM



More information about the vc mailing list