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]

reduce the exception size


Hi, I am trying to reduce the binary size when the exception is not
used. What I am trying to do is

1. Make __register_frame_info and __deregister_frame_info weak in
crtstuff.c.
2. Move _eh.o from libgcc2.c to frame.c so that when the exception
is used, the real definitons of __register_frame_info and
__deregister_frame_info will be included.

I am enclosing the patch for crtstuff.c. If the idea is workable,
I will submit a complete patch.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
--
Index: crtstuff.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/crtstuff.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 crtstuff.c
--- crtstuff.c	1998/04/05 19:07:15	1.1.1.9
+++ crtstuff.c	1998/04/22 15:30:00
@@ -80,6 +80,11 @@ Boston, MA 02111-1307, USA.  */
 #endif
 #if !defined (EH_FRAME_SECTION_ASM_OP) && defined (DWARF2_UNWIND_INFO) && defined(ASM_OUTPUT_SECTION_NAME)
 #define EH_FRAME_SECTION_ASM_OP	".section\t.eh_frame,\"aw\""
+
+#ifdef HANDLE_SYSV_PRAGMA
+#pragma weak __register_frame_info
+#pragma weak __deregister_frame_info
+#endif
 #endif
 
 #ifdef OBJECT_FORMAT_ELF
@@ -142,8 +147,11 @@ __do_global_dtors_aux ()
     }
 
 #ifdef EH_FRAME_SECTION_ASM_OP
-  __deregister_frame_info (__EH_FRAME_BEGIN__);
+#ifdef HANDLE_SYSV_PRAGMA
+  if (__deregister_frame_info)
 #endif
+    __deregister_frame_info (__EH_FRAME_BEGIN__);
+#endif
   completed = 1;
 }
 
@@ -170,7 +178,10 @@ static void
 frame_dummy ()
 {
   static struct object object;
-  __register_frame_info (__EH_FRAME_BEGIN__, &object);
+#ifdef HANDLE_SYSV_PRAGMA
+  if (__register_frame_info)
+#endif
+    __register_frame_info (__EH_FRAME_BEGIN__, &object);
 }
 
 static void
@@ -254,8 +265,11 @@ __do_global_dtors ()
     (*p) ();
 
 #ifdef EH_FRAME_SECTION_ASM_OP
-  __deregister_frame_info (__EH_FRAME_BEGIN__);
+#ifdef HANDLE_SYSV_PRAGMA
+  if (__deregister_frame_info)
 #endif
+    __deregister_frame_info (__EH_FRAME_BEGIN__);
+#endif
 }
 
 #ifdef EH_FRAME_SECTION_ASM_OP
@@ -266,7 +280,10 @@ void
 __frame_dummy ()
 {
   static struct object object;
-  __register_frame_info (__EH_FRAME_BEGIN__, &object);
+#ifdef HANDLE_SYSV_PRAGMA
+  if (__register_frame_info)
+#endif
+    __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]