+Sat Dec 20 13:36:06 1997 Paul Eggert <eggert@twinsun.com>
+ Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ H.J. Lu (hjl@gnu.org)
+
+ * frame.h (__register_frame, __register_frame_table,
+ __deregister_frame): New.
+ * frame.c (__register_frame, __register_frame_table,
+ __deregister_frame): New.
+ * frame.c (__deregister_frame_info): Return void *.
+ * frame.h (__deregister_frame_info): Ditto.
+ * collect2.c (__deregister_frame_info): Ditto.
+
+ * frame.h (__register_frame_info_table): Fix typo in declaration.
+
+ * frame.c (__register_frame_info): Renamed from __register_frame.
+ (__register_frame_info_table, __deregister_frame_info): Similarly.
+ * frame.h (__{,de}register_frame_info): Likewise.
+ (__register_frame_info_table): New declaration.
+ * crtstuff.c (__do_global_dtors{,_aux}): Rename __deregister_frame.
+ (frame_dummy, __do_global_ctors): Likewise for __register_frame.
+ * collect2.c (write_c_file_{stat,glob}): Rename __register_frame
+ to __register_frame_info and similarly for __deregister_frame and
+ __register_frame_table.
+
+ * collect2.c (write_c_file_glob):
+ Allocate initial frame object in static storage and pass its address.
+
+ * crtstuff.c (__do_global_ctors): Fix typo in last change.
+
+ * crtstuff.c (__do_global_ctors): Add missing arg to __register_frame.
+
+ * collect2.c (write_c_file_stat): Fix error in last change;
+ use __SIZE_TYPE__, not size_t.
+
+ Alter C startup code so that it doesn't invoke malloc on Solaris.
+ * frame.h (struct object): Decl moved here from frame.c.
+ * frame.c (struct object): Move decl to frame.h.
+ ("frame.h"): Include after <stddef.h>, so that size_t is defined.
+ (__register_frame, __register_frame_table, __deregister_frame):
+ It's now the caller's responsibility to allocate storage for object.
+ * crtstuff.c (frame_dummy), collect2.c (write_c_file_stat):
+ Allocate initial frame object in static storage and pass its address.
+ * crtstuff.c (<stddef.h>, "frame.h"): Include.
+ * Makefile.in ($(T)crtbegin.o, $(T)crtend.o, stamp-crtS):
+ Depend on defaults.h and frame.h.
+
Fri Dec 19 10:02:57 1997 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* i386.h (INITIAL_ELIMINATION_OFFSET): Correctly test for PIC
write_list (stream, "\t\t&", frame_tables.first);
fprintf (stream, "\t0\n};\n");
- fprintf (stream, "extern void __register_frame_table (void *);\n");
- fprintf (stream, "extern void __deregister_frame (void *);\n");
+ /* This must match what's in frame.h. */
+ fprintf (stream, "struct object {\n");
+ fprintf (stream, " void *pc_begin;\n");
+ fprintf (stream, " void *pc_end;\n");
+ fprintf (stream, " void *fde_begin;\n");
+ fprintf (stream, " void *fde_array;\n");
+ fprintf (stream, " __SIZE_TYPE__ count;\n");
+ fprintf (stream, " struct object *next;\n");
+ fprintf (stream, "};\n");
+
+ fprintf (stream, "extern void __register_frame_info_table (void *, struct object *);\n");
+ fprintf (stream, "extern void *__deregister_frame_info (void *);\n");
fprintf (stream, "static void reg_frame () {\n");
- fprintf (stream, "\t__register_frame_table (frame_table);\n");
+ fprintf (stream, "\tstatic struct object ob;\n");
+ fprintf (stream, "\t__register_frame_info_table (frame_table, &ob);\n");
fprintf (stream, "\t}\n");
fprintf (stream, "static void dereg_frame () {\n");
- fprintf (stream, "\t__deregister_frame (frame_table);\n");
+ fprintf (stream, "\t__deregister_frame_info (frame_table);\n");
fprintf (stream, "\t}\n");
}
write_list (stream, "\t\t&", frame_tables.first);
fprintf (stream, "\t0\n};\n");
- fprintf (stream, "extern void __register_frame_table (void *);\n");
- fprintf (stream, "extern void __deregister_frame (void *);\n");
+ /* This must match what's in frame.h. */
+ fprintf (stream, "struct object {\n");
+ fprintf (stream, " void *pc_begin;\n");
+ fprintf (stream, " void *pc_end;\n");
+ fprintf (stream, " void *fde_begin;\n");
+ fprintf (stream, " void *fde_array;\n");
+ fprintf (stream, " __SIZE_TYPE__ count;\n");
+ fprintf (stream, " struct object *next;\n");
+ fprintf (stream, "};\n");
+
+ fprintf (stream, "extern void __register_frame_info_table (void *, struct object *);\n");
+ fprintf (stream, "extern void *__deregister_frame_info (void *);\n");
fprintf (stream, "static void reg_frame () {\n");
- fprintf (stream, "\t__register_frame_table (frame_table);\n");
+ fprintf (stream, "\tstatic struct object ob;\n");
+ fprintf (stream, "\t__register_frame_info_table (frame_table, &ob);\n");
fprintf (stream, "\t}\n");
fprintf (stream, "static void dereg_frame () {\n");
- fprintf (stream, "\t__deregister_frame (frame_table);\n");
+ fprintf (stream, "\t__deregister_frame_info (frame_table);\n");
fprintf (stream, "\t}\n");
}
#include "tm.h"
#include "defaults.h"
+#include <stddef.h>
+#include "frame.h"
/* Provide default definitions for the pseudo-ops used to switch to the
.ctors and .dtors sections.
}
#ifdef EH_FRAME_SECTION_ASM_OP
- __deregister_frame (__EH_FRAME_BEGIN__);
+ __deregister_frame_info (__EH_FRAME_BEGIN__);
#endif
completed = 1;
}
}
#ifdef EH_FRAME_SECTION_ASM_OP
-/* Stick a call to __register_frame into the .init section. For some reason
- calls with no arguments work more reliably in .init, so stick the call
- in another function. */
+/* Stick a call to __register_frame_info into the .init section. For some
+ reason calls with no arguments work more reliably in .init, so stick the
+ call in another function. */
static void
frame_dummy ()
{
- __register_frame (__EH_FRAME_BEGIN__);
+ static struct object object;
+ __register_frame_info (__EH_FRAME_BEGIN__, &object);
}
static void
(*p) ();
#ifdef EH_FRAME_SECTION_ASM_OP
- __deregister_frame (__EH_FRAME_BEGIN__);
+ __deregister_frame_info (__EH_FRAME_BEGIN__);
#endif
}
#endif
{
func_ptr *p;
#ifdef EH_FRAME_SECTION_ASM_OP
- __register_frame (__EH_FRAME_BEGIN__);
+ static struct object object;
+ __register_frame_info (__EH_FRAME_BEGIN__, &object);
#endif
for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
(*p) ();
On targets that support crtstuff.c, the unwind information
is stored in a section named .eh_frame and the information for the
entire shared object or program is registered with a call to
- __register_frame. On other targets, the information for each
+ __register_frame_info. On other targets, the information for each
translation unit is registered from the file generated by collect2.
- __register_frame is defined in frame.c, and is responsible for
+ __register_frame_info is defined in frame.c, and is responsible for
recording all of the unwind regions into one list (which is kept in a
static variable named unwind_table_list).
typedef struct dwarf_fde fde;
-/* 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. */
-
-struct object {
- void *pc_begin;
- void *pc_end;
- fde *fde_begin;
- fde ** fde_array;
- size_t count;
- struct object *next;
-};
+/* Objects to be searched for frame unwind info. */
static struct object *objects;
/* Called from crtbegin.o to register the unwind info for an object. */
void
-__register_frame (void *begin)
+__register_frame_info (void *begin, struct object *ob)
{
- struct object *ob = (struct object *) malloc (sizeof (struct object));
-
ob->fde_begin = begin;
ob->pc_begin = ob->pc_end = 0;
objects = ob;
}
+void
+__register_frame (void *begin)
+{
+ struct object *ob = (struct object *) malloc (sizeof (struct object));
+ __register_frame_info (begin, ob);
+}
+
/* Similar, but BEGIN is actually a pointer to a table of unwind entries
for different translation units. Called from the file generated by
collect2. */
void
-__register_frame_table (void *begin)
+__register_frame_info_table (void *begin, struct object *ob)
{
- struct object *ob = (struct object *) malloc (sizeof (struct object));
-
ob->fde_begin = begin;
ob->fde_array = begin;
objects = ob;
}
+void
+__register_frame_table (void *begin)
+{
+ struct object *ob = (struct object *) malloc (sizeof (struct object));
+ __register_frame_info_table (begin, ob);
+}
+
/* Called from crtend.o to deregister the unwind info for an object. */
-void
-__deregister_frame (void *begin)
+void *
+__deregister_frame_info (void *begin)
{
- struct object **p = &objects;
+ struct object **p;
+ p = &objects;
while (*p)
{
if ((*p)->fde_begin == begin)
/* If we've run init_frame for this object, free the FDE array. */
if (ob->pc_begin)
free (ob->fde_array);
- free (ob);
- return;
+ return (void *) ob;
}
p = &((*p)->next);
}
+
abort ();
}
+void
+__deregister_frame (void *begin)
+{
+ free (__deregister_frame_info (begin));
+}
+
/* Called from __throw to find the registers to restore for a given
PC_TARGET. The caller should allocate a local variable of `struct
frame_state' (declared in frame.h) and pass its address to STATE_IN. */
#define REG_SAVED_OFFSET 1
#define REG_SAVED_REG 2
+/* 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.
+
+ A copy of this structure declaration is printed by collect2.c;
+ keep the copies synchronized! */
+
+struct object {
+ void *pc_begin;
+ void *pc_end;
+ struct dwarf_fde *fde_begin;
+ struct dwarf_fde **fde_array;
+ size_t count;
+ struct object *next;
+};
+
+extern void __register_frame (void * );
+extern void __register_frame_table (void *);
+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 (void *);
+extern void __register_frame_info (void *, struct object *);
+
+/* Similar, but BEGIN is actually a pointer to a table of unwind entries
+ for different translation units. Called from the file generated by
+ collect2. */
+extern void __register_frame_info_table (void *, struct object *);
/* Called from crtend.o to deregister the unwind info for an object. */
-extern void __deregister_frame (void *);
+extern void *__deregister_frame_info (void *);
/* Called from __throw to find the registers to restore for a given
PC_TARGET. The caller should allocate a local variable of `struct