__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;
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);
}
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);
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));
}
\f
/* Comparison routines. Three variants of increasing complexity. */
-static saddr
+static int
fde_unencoded_compare (struct object *ob __attribute__((unused)),
fde *x, fde *y)
{
- return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
+ _Unwind_Ptr x_ptr = *(_Unwind_Ptr *) x->pc_begin;
+ _Unwind_Ptr y_ptr = *(_Unwind_Ptr *) y->pc_begin;
+
+ if (x_ptr > y_ptr)
+ return 1;
+ if (x_ptr < y_ptr)
+ return -1;
+ return 0;
}
-static saddr
+static int
fde_single_encoding_compare (struct object *ob, fde *x, fde *y)
{
_Unwind_Ptr base, x_ptr, y_ptr;
read_encoded_value_with_base (ob->s.b.encoding, base, x->pc_begin, &x_ptr);
read_encoded_value_with_base (ob->s.b.encoding, base, y->pc_begin, &y_ptr);
- return x_ptr - y_ptr;
+ if (x_ptr > y_ptr)
+ return 1;
+ if (x_ptr < y_ptr)
+ return -1;
+ return 0;
}
-static saddr
+static int
fde_mixed_encoding_compare (struct object *ob, fde *x, fde *y)
{
int x_encoding, y_encoding;
read_encoded_value_with_base (y_encoding, base_from_object (y_encoding, ob),
y->pc_begin, &y_ptr);
- return x_ptr - y_ptr;
+ if (x_ptr > y_ptr)
+ return 1;
+ if (x_ptr < y_ptr)
+ return -1;
+ return 0;
}
-typedef saddr (*fde_compare_t) (struct object *, fde *, fde *);
+typedef int (*fde_compare_t) (struct object *, fde *, fde *);
/* This is a special mix of insertion sort and heap sort, optimized for
__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)