about summary refs log tree commit diff
path: root/sysdeps/generic/unwind-dw2-fde.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-08 06:28:46 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-08 06:28:46 +0000
commita0dcb6896c35abf88810296367a63da75ebf1828 (patch)
treed2c3fad2eab4eac4f2020866ca36f2cd4a011169 /sysdeps/generic/unwind-dw2-fde.c
parentabd336891bd17071ed166ae536ef381dbafe00b3 (diff)
downloadglibc-a0dcb6896c35abf88810296367a63da75ebf1828.tar.gz
glibc-a0dcb6896c35abf88810296367a63da75ebf1828.tar.xz
glibc-a0dcb6896c35abf88810296367a63da75ebf1828.zip
Update.
2002-01-03  Jakub Jelinek  <jakub@redhat.com>

	* elf/Makefile (routines, shared-only-routines): Add
	unwind-dw2-fde-glibc instead of unwind-dw2-fde.
	* elf/elf.h (PT_GNU_EH_FRAME): Define.
	* sysdeps/generic/unwind-dw2-fde-glibc.c: New file.
	* sysdeps/generic/unwind-dw2-fde.c (__register_frame_info_bases):
	Optimize if .eh_frame section contains no FDEs.
	(__register_frame, __deregister_frame_info_bases,
	__deregister_frame): Likewise.
	* sysdeps/generic/unwind-dw2.c (execute_cfa_program): Fix
	DW_CFA_restore handling.

2002-01-07  Stephen L Moshier  <moshier@mediaone.net>
Diffstat (limited to 'sysdeps/generic/unwind-dw2-fde.c')
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 54a0dc1bd1..3d1931868f 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -101,6 +101,10 @@ void
 __register_frame_info_bases (void *begin, struct object *ob,
 			     void *tbase, void *dbase)
 {
+  /* If .eh_frame is empty, don't register at all.  */
+  if (*(uword *)begin == 0)
+    return;
+
   ob->pc_begin = (void *)-1;
   ob->tbase = tbase;
   ob->dbase = dbase;
@@ -126,7 +130,13 @@ __register_frame_info (void *begin, struct object *ob)
 void
 __register_frame (void *begin)
 {
-  struct object *ob = (struct object *) malloc (sizeof (struct object));
+  struct object *ob;
+
+  /* If .eh_frame is empty, don't register at all.  */
+  if (*(uword *)begin == 0)
+    return;
+
+  ob = (struct object *) malloc (sizeof (struct object));
   __register_frame_info (begin, ob);
 }
 
@@ -186,6 +196,10 @@ __deregister_frame_info_bases (void *begin)
   struct object **p;
   struct object *ob = 0;
 
+  /* If .eh_frame is empty, we haven't registered.  */
+  if (*(uword *)begin == 0)
+    return ob;
+
   init_object_mutex_once ();
   __gthread_mutex_lock (&object_mutex);
 
@@ -235,7 +249,9 @@ __deregister_frame_info (void *begin)
 void
 __deregister_frame (void *begin)
 {
-  free (__deregister_frame_info (begin));
+  /* If .eh_frame is empty, we haven't registered.  */
+  if (*(uword *)begin != 0)
+    free (__deregister_frame_info (begin));
 }
 
 
@@ -968,7 +984,7 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
   __gthread_mutex_lock (&object_mutex);
 
   /* Linear search through the classified objects, to find the one
-     containing the pc.  Note that pc_begin is sorted decending, and
+     containing the pc.  Note that pc_begin is sorted descending, and
      we expect objects to be non-overlapping.  */
   for (ob = seen_objects; ob; ob = ob->next)
     if (pc >= ob->pc_begin)