linkonce and exceptions on Solaris

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Thu Feb 19 12:42:00 GMT 1998


Jason, Bruno,

Thanks for your patches. I have not tried them, yet, but I will.

Meanwhile, I produced my own patch. It is a two-pass algorithm, and
guesses the border between normal and linkonce entries by choosing
a symbol from libgcc. This gives a reasonable speed-up on the Ultra
I use.

In any case, I think it is important that one of these approaches is
implemented in egcs, and also 2.8.1.

Martin

1998-02-19 Martin von Loewis <loewis@informatik.hu-berlin.de>

	* frame.c (add_fdes, frame_init): Insert FDEs in two passes.

--- frame.c	1998/02/19 14:18:18	1.1
+++ frame.c	1998/02/19 20:29:15
@@ -219,9 +233,13 @@
   return count;
 }
 
+/* Ideally, this should come from crtend */
+extern void __empty();
+static void* last_text_function = __empty;
+
 static void
 add_fdes (fde *this_fde, fde **array, size_t *i_ptr,
-	  void **beg_ptr, void **end_ptr)
+	  void **beg_ptr, void **end_ptr, int skiponce, int *skip_ptr)
 {
   size_t i = *i_ptr;
   void *pc_begin = *beg_ptr;
@@ -233,6 +251,14 @@
       if (this_fde->CIE_delta == 0 || this_fde->pc_begin == 0)
 	continue;
 
+      if(skiponce && this_fde->pc_begin > last_text_function)
+        {
+          *skip_ptr = 1;
+          continue;
+        }
+      else if(!skiponce && this_fde->pc_begin <= last_text_function)
+        continue;
+
       fde_insert (array, i++, this_fde);
 
       if (this_fde->pc_begin < pc_begin)
@@ -254,7 +280,7 @@
 frame_init (struct object* ob)
 {
   fde *this_fde;
-  size_t count;
+  size_t count, skipped;
   fde **array;
   void *pc_begin, *pc_end;
 
@@ -273,15 +299,23 @@
   pc_begin = (void*)(uaddr)-1;
   pc_end = 0;
   count = 0;
+  skipped = 0;
 
   if (ob->fde_array)
     {
       fde **p = ob->fde_array;
       for (; *p; ++p)
-	add_fdes (*p, array, &count, &pc_begin, &pc_end);
+	add_fdes (*p, array, &count, &pc_begin, &pc_end, 1, &skipped);
+      if (skipped)
+        for (; *p; ++p)
+          add_fdes (*p, array, &count, &pc_begin, &pc_end, 0, &skipped);        
     }
   else
-    add_fdes (ob->fde_begin, array, &count, &pc_begin, &pc_end);
+    {
+      add_fdes (ob->fde_begin, array, &count, &pc_begin, &pc_end, 1, &skipped);
+      if (skipped)
+        add_fdes (ob->fde_begin, array, &count, &pc_begin, &pc_end, 0, &skipped);
+    }
 
   ob->fde_array = array;
   ob->pc_begin = pc_begin;



More information about the Gcc mailing list