From: hjl@lucon.org (H.J. Lu)
To: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
Cc: gcc2@cygnus.com, egcs@cygnus.com
Subject: Re: gcc 2.8.0 is broken on linux/x86 and more bug
Date: Thu, 11 Dec 1997 20:29:00 -0000 [thread overview]
Message-ID: <m0xgM3M-0004ecC@ocean.lucon.org> (raw)
In-Reply-To: <9712112330.AA18404@vlsi1.ultra.nyu.edu>
The good news is turn off address-off fixes the bug. The bad news
is I can tell from the asm code what is wrong, but it is hard
to generate a small test case and you may have to look at the
asm code directly to verify the bug if you cannot compile glibc 2.1
on Linux/x86.
__register_frame () change in gcc 2.8.0 causes a big problem.
Since __register_frame () called in crtbegin.o is in libgcc2.c and
gcc -shared includes crtbegin.o and -lgcc, any libc.so built by
previous gcc has __register_frame () in libc.so. Now the ABI for
__register_frame () is changed, that is a big mess for Linux since
shared libraries are used a lot. When the ABI of a function in
shared library is changed like this, it doesn't work too well.
Here is the patch. It should apply to both gcc 2.8.0 and egcs.
Thanks.
H.J.
----
Mon Dec 8 15:42:20 1997 H.J. Lu (hjl@gnu.org)
* crtstuff.c (__register_frame): Changed to __register_frame_new.
(__deregister_frame): Changed to __deregister_frame_new.
* frame.c: Ditto.
* frame.h: Ditto.
* collect2.c: Ditto.
* frame.c (__register_frame_table): Changed to
__register_frame_table_new.
* collect2.c: Ditto.
* frame.c (__register_frame_new, __register_frame_table_new,
__deregister_frame_new): Added.
* frame.h: Ditto.
Index: crtstuff.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/crtstuff.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 crtstuff.c
--- crtstuff.c 1997/12/08 17:04:06 1.1.1.4
+++ crtstuff.c 1997/12/08 23:26:29
@@ -142,7 +142,7 @@
}
#ifdef EH_FRAME_SECTION_ASM_OP
- __deregister_frame (__EH_FRAME_BEGIN__);
+ __deregister_frame_new (__EH_FRAME_BEGIN__);
#endif
completed = 1;
}
@@ -170,7 +170,7 @@
frame_dummy ()
{
static struct object object;
- __register_frame (__EH_FRAME_BEGIN__, &object);
+ __register_frame_new (__EH_FRAME_BEGIN__, &object);
}
static void
@@ -254,7 +254,7 @@
(*p) ();
#ifdef EH_FRAME_SECTION_ASM_OP
- __deregister_frame (__EH_FRAME_BEGIN__);
+ __deregister_frame_new (__EH_FRAME_BEGIN__);
#endif
}
#endif
@@ -395,7 +396,7 @@
func_ptr *p;
#ifdef EH_FRAME_SECTION_ASM_OP
static struct oobject object;
- __register_frame (__EH_FRAME_BEGIN__, &object);
+ __register_frame_new (__EH_FRAME_BEGIN__, &object);
#endif
for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
(*p) ();
Index: frame.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/frame.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 frame.c
--- frame.c 1997/12/08 17:04:32 1.1.1.6
+++ frame.c 1997/12/08 23:29:53
@@ -501,7 +501,7 @@
/* Called from crtbegin.o to register the unwind info for an object. */
void
-__register_frame (void *begin, struct object *ob)
+__register_frame_new (void *begin, struct object *ob)
{
ob->fde_begin = begin;
@@ -513,12 +513,19 @@
objects = ob;
}
+void
+__register_frame (void *begin)
+{
+ struct object *ob = (struct object *) malloc (sizeof (struct object));
+ __register_frame_new (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, struct object *ob)
+__register_frame_table_new (void *begin, struct object *ob)
{
ob->fde_begin = begin;
ob->fde_array = begin;
@@ -530,10 +537,17 @@
objects = ob;
}
+void
+__register_frame_table (void *begin)
+{
+ struct object *ob = (struct object *) malloc (sizeof (struct object));
+ __register_frame_table_new (begin, ob);
+}
+
/* Called from crtend.o to deregister the unwind info for an object. */
-void
-__deregister_frame (void *begin)
+void *
+__deregister_frame_new (void *begin)
{
struct object **p = &objects;
@@ -548,11 +562,17 @@
if (ob->pc_begin)
free (ob->fde_array);
- return;
+ return (void *) ob;
}
p = &((*p)->next);
}
abort ();
+}
+
+void
+__deregister_frame (void *begin)
+{
+ free (__deregister_frame_new (begin));
}
/* Called from __throw to find the registers to restore for a given
Index: frame.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/frame.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 frame.h
--- frame.h 1997/12/08 17:04:33 1.1.1.2
+++ frame.h 1997/12/08 23:31:02
@@ -37,11 +37,16 @@
/* 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 *, struct object *);
+extern void __register_frame_new (void *, struct object *);
+extern void __register_frame (void *);
/* Called from crtend.o to deregister the unwind info for an object. */
+extern void * __deregister_frame_new (void *);
extern void __deregister_frame (void *);
+
+extern void __register_frame_table_new (void *, struct object *);
+extern void __register_frame_table (void *);
/* Called from __throw to find the registers to restore for a given
PC_TARGET. The caller should allocate a local variable of `struct
Index: collect2.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/collect2.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 collect2.c
--- collect2.c 1997/12/08 17:04:00 1.1.1.4
+++ collect2.c 1997/12/12 02:41:38
@@ -1790,16 +1790,16 @@
fprintf (stream, " struct object *next;\n");
fprintf (stream, "};\n");
- fprintf (stream, "extern void __register_frame_table (void *, struct object *);\n");
- fprintf (stream, "extern void __deregister_frame (void *);\n");
+ fprintf (stream, "extern void __register_frame_table_new (void *, struct object *);\n");
+ fprintf (stream, "extern void *__deregister_frame_new (void *);\n");
fprintf (stream, "static void reg_frame () {\n");
fprintf (stream, "\tstatic struct object ob;\n");
- fprintf (stream, "\t__register_frame_table (frame_table, &ob);\n");
+ fprintf (stream, "\t__register_frame_table_new (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_new (frame_table);\n");
fprintf (stream, "\t}\n");
}
@@ -1866,15 +1866,16 @@
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");
+ fprintf (stream, "extern void __register_frame_table_new (void *, struct object *);\n");
+ fprintf (stream, "extern void *__deregister_frame_new (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_table_new (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_new (frame_table);\n");
fprintf (stream, "\t}\n");
}
next parent reply other threads:[~1997-12-11 20:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <9712112330.AA18404@vlsi1.ultra.nyu.edu>
1997-12-11 20:29 ` H.J. Lu [this message]
1997-12-11 23:56 ` Jeffrey A Law
1997-12-12 3:55 ` H.J. Lu
1997-12-12 0:18 ` Jeffrey A Law
1997-12-12 1:52 ` H.J. Lu
1997-12-12 3:55 ` Jeffrey A Law
1997-12-12 3:55 ` H.J. Lu
1997-12-12 3:55 ` Jeffrey A Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m0xgM3M-0004ecC@ocean.lucon.org \
--to=hjl@lucon.org \
--cc=egcs@cygnus.com \
--cc=gcc2@cygnus.com \
--cc=kenner@vlsi1.ultra.nyu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).