This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

An egcs 1.1.2 patch for frame.h and crtstuff.c


> 
>   > I did #2. Now I cannot find a solution for #1, which I like.
> Send it anyway.  It may be the case that you do not like it, but it's still
> a better solution, or it may be the case that someone can tweak it to make
> it better.  We'll never know if you don't actually send the patch.
> 
> Or it may be the case that the pragmas really are better.
> 
> But until you send the attribute based patch we'll never know.
> 

Here it is. BTW, I am working on the libio patch now.


-- 
H.J. Lu (hjl@gnu.org)
---
Thu Feb 25 11:25:13 1999  H.J. Lu  (hjl@gnu.org)

	* frame.h (TARGET_ATTRIBUTE_WEAK): New. Use __attribute__ only
	if SUPPORTS_WEAK is not zero and IN_CRTSTUFF is defined.
	(__register_frame_info): Append TARGET_ATTRIBUTE_WEAK.
	(__deregister_frame_info): Likewise.

	* crtstuff.c (IN_CRTSTUFF): Defined before #include "frame.h".
	(__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.

--- ../../../import/egcs-1.1.x/egcs/gcc/frame.h	Fri Apr  3 08:34:57 1998
+++ ./frame.h	Thu Feb 25 10:45:46 1999
@@ -18,6 +18,14 @@ typedef struct frame_state
 #define REG_SAVED_OFFSET 1
 #define REG_SAVED_REG 2
 
+#ifndef TARGET_ATTRIBUTE_WEAK
+# if SUPPORTS_WEAK && defined(IN_CRTSTUFF)
+#  define TARGET_ATTRIBUTE_WEAK	__attribute__ ((weak))
+# else
+#  define TARGET_ATTRIBUTE_WEAK
+# endif
+#endif
+
 /* The representation for an "object" to be searched for frame unwind info.
    For targets with named sections, one object is an executable or shared
    library; for other targets, one object is one translation unit.
@@ -41,7 +49,8 @@ extern void __deregister_frame (void *);
 /* Called either from crtbegin.o or a static constructor to register the
    unwind info for an object or translation unit, respectively.  */
 
-extern void __register_frame_info (void *, struct object *);
+extern void __register_frame_info (void *, struct object *)
+				  TARGET_ATTRIBUTE_WEAK;
 
 /* Similar, but BEGIN is actually a pointer to a table of unwind entries
    for different translation units.  Called from the file generated by
@@ -50,7 +59,8 @@ extern void __register_frame_info_table 
 
 /* Called from crtend.o to deregister the unwind info for an object.  */
 
-extern void *__deregister_frame_info (void *);
+extern void *__deregister_frame_info (void *)
+				     TARGET_ATTRIBUTE_WEAK;
 
 /* Called from __throw to find the registers to restore for a given
    PC_TARGET.  The caller should allocate a local variable of `struct
--- ../../../import/egcs-1.1.x/egcs/gcc/crtstuff.c	Mon Jun  8 11:30:12 1998
+++ ./crtstuff.c	Thu Feb 25 10:47:16 1999
@@ -54,6 +54,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tm.h"
 #include "defaults.h"
 #include <stddef.h>
+#define IN_CRTSTUFF
 #include "frame.h"
 
 /* Provide default definitions for the pseudo-ops used to switch to the
@@ -142,7 +143,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 +172,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 +260,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 +273,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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]