]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
frame.h: Update some comments.
authorH.J. Lu <hjl@gnu.org>
Sat, 27 Feb 1999 21:54:23 +0000 (21:54 +0000)
committerJeff Law <law@gcc.gnu.org>
Sat, 27 Feb 1999 21:54:23 +0000 (14:54 -0700)
        * frame.h: Update some comments.
        * crtstuff.c (TARGET_ATTRIBUTE_WEAK): Define.
        (__register_frame_info, __deregister_frame_info): Declare using
        TARGET_WEAK_ATTRIBUTE.
        (__do_global_dtors_aux): Check if __deregister_frame_info is
        zero before calling it.
        (__do_global_dtors): Likewise.
        (frame_dummy): Check if __register_frame_info is zero before
        calling it.
        (__frame_dummy): Likewise.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r25486

gcc/ChangeLog
gcc/crtstuff.c
gcc/frame.h

index e8cb1929738b5cddd71d12d13aa28df62c1600d3..c2e7878ace0d1130a84154d2531392e5eb2cde27 100644 (file)
@@ -1,3 +1,17 @@
+Sat Feb 27 22:48:38 1999  H.J. Lu  (hjl@gnu.org)
+                         Jeffrey A Law  (law@cygnus.com)
+
+       * frame.h: Update some comments.
+       * crtstuff.c (TARGET_ATTRIBUTE_WEAK): Define.
+       (__register_frame_info, __deregister_frame_info): Declare using
+       TARGET_WEAK_ATTRIBUTE.
+       (__do_global_dtors_aux): Check if __deregister_frame_info is
+       zero before calling it.
+       (__do_global_dtors): Likewise.
+       (frame_dummy): Check if __register_frame_info is zero before
+       calling it.
+       (__frame_dummy): Likewise.
+       
 Sat Feb 27 19:47:39 1999  Marc Espie <espie@openbsd.org>
 
        * config/t-openbsd (T_CFLAGS): Add -Dmkstemps=my_mkstemps.
index 8e50ac740d7150e72a6812f1378b993af3acdc15..a1b9ef8706e7f741b2e01b8edc4f5bd9e55ccee2 100644 (file)
@@ -56,6 +56,45 @@ Boston, MA 02111-1307, USA.  */
 #include <stddef.h>
 #include "frame.h"
 
+/* This really belongs in gansidecl.h, but for the egcs-1.1.x branch, the
+   only code which uses weak attributes is in this file and this file does
+   not include gansidecl.h.  */
+#ifndef TARGET_ATTRIBUTE_WEAK
+# if SUPPORTS_WEAK
+#  define TARGET_ATTRIBUTE_WEAK       __attribute__ ((weak))
+# else
+#  define TARGET_ATTRIBUTE_WEAK
+# endif
+#endif
+
+/* We do not want to add the weak attribute to the declarations of these
+   routines in frame.h because that will cause the definition of these
+   symbols to be weak as well.
+
+   This exposes a core issue, how to handle creating weak references vs
+   how to create weak definitions.  Either we have to have the definition
+   of TARGET_WEAK_ATTRIBUTE be conditional in the shared header files or
+   have a second declaration if we want a function's references to be weak,
+   but not its definition.
+
+   Making TARGET_WEAK_ATTRIBUTE conditional seems like a good solution until
+   one thinks about scaling to larger problems -- ie, the condition under
+   which TARGET_WEAK_ATTRIBUTE is active will eventually get far too
+   complicated.
+
+   So, we take an approach similar to #pragma weak -- we have a second
+   declaration for functions that we want to have weak references.
+
+   Neither way is particularly good.  */
+   
+/* References to __register_frame_info and __deregister_frame_info should
+   be weak in this file if at all possible.  */
+extern void __register_frame_info (void *, struct object *)
+                                 TARGET_ATTRIBUTE_WEAK;
+
+extern void *__deregister_frame_info (void *)
+                                    TARGET_ATTRIBUTE_WEAK;
+
 /* Provide default definitions for the pseudo-ops used to switch to the
    .ctors and .dtors sections.
  
@@ -142,7 +181,8 @@ __do_global_dtors_aux ()
     }
 
 #ifdef EH_FRAME_SECTION_ASM_OP
-  __deregister_frame_info (__EH_FRAME_BEGIN__);
+  if (__deregister_frame_info)
+    __deregister_frame_info (__EH_FRAME_BEGIN__);
 #endif
   completed = 1;
 }
@@ -170,7 +210,8 @@ static void
 frame_dummy ()
 {
   static struct object object;
-  __register_frame_info (__EH_FRAME_BEGIN__, &object);
+  if (__register_frame_info)
+    __register_frame_info (__EH_FRAME_BEGIN__, &object);
 }
 
 static void __attribute__ ((__unused__))
@@ -254,7 +295,8 @@ __do_global_dtors ()
     (*p) ();
 
 #ifdef EH_FRAME_SECTION_ASM_OP
-  __deregister_frame_info (__EH_FRAME_BEGIN__);
+  if (__deregister_frame_info)
+    __deregister_frame_info (__EH_FRAME_BEGIN__);
 #endif
 }
 
@@ -266,7 +308,8 @@ void
 __frame_dummy ()
 {
   static struct object object;
-  __register_frame_info (__EH_FRAME_BEGIN__, &object);
+  if (__register_frame_info)
+    __register_frame_info (__EH_FRAME_BEGIN__, &object);
 }
 #endif
 #endif
index 7493d92f80bd5e558675b3f4188e97be099b59eb..9d0d693975b34a7d4ae70140a50b1c6f9a61dfa9 100644 (file)
@@ -34,6 +34,11 @@ struct object {
   struct object *next;
 };
 
+/* Note the following routines are exported interfaces from libgcc; do not
+   change these interfaces.  Instead create new interfaces.  Also note
+   references to these functions may be made weak in files where they
+   are referenced.  */
+
 extern void __register_frame (void * );
 extern void __register_frame_table (void *);
 extern void __deregister_frame (void *);