This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] collect2 ctor name mismatch
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 21 Jul 2002 18:16:29 -0400
- Subject: Re: [PATCH] collect2 ctor name mismatch
>>>>> Mark Mitchell writes:
>> * collect2.c (is_ctor_dtor): Remove trailing underscore from ctor
>> and dtor special strings.
Mark> This patch is OK.
Actually, sigh, it's not :-(. The problem is that collect2 also
defines _GLOBAL__DI() and _GLOBAL__DD() as public names for functions to
call the init and fini functions in shared objects. Those names match
"GLOBAL__D".
The two choices seem to be to compare against all three possible
joiner variants or change the C++ ABI and always use '_' as the joiner.
It's too bad that Manfred didn't pay attention to the existing naming
convention when he added initp support.
One could duplicate the JOINER logic to reduce the comparisons to
JOINER ('$' or '.') and '_'. Is that worth it?
David
* collect2.c (is_ctor_dtor): Compare against all three JOINER
variants.
Index: collect2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/collect2.c,v
retrieving revision 1.135
diff -c -p -r1.135 collect2.c
*** collect2.c 29 Jun 2002 22:51:11 -0000 1.135
--- collect2.c 21 Jul 2002 22:04:00 -0000
*************** is_ctor_dtor (s)
*** 577,583 ****
--- 577,587 ----
const char *orig_s = s;
static const struct names special[] = {
+ { "GLOBAL__I$", sizeof ("GLOBAL__I$")-1, 1, 0 },
+ { "GLOBAL__I.", sizeof ("GLOBAL__I.")-1, 1, 0 },
{ "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, 1, 0 },
+ { "GLOBAL__D$", sizeof ("GLOBAL__D$")-1, 2, 0 },
+ { "GLOBAL__D.", sizeof ("GLOBAL__D.")-1, 2, 0 },
{ "GLOBAL__D_", sizeof ("GLOBAL__D_")-1, 2, 0 },
{ "GLOBAL__F_", sizeof ("GLOBAL__F_")-1, 5, 0 },
{ "GLOBAL__FI_", sizeof ("GLOBAL__FI_")-1, 3, 0 },