enable-build-with-cxx bootstrap compare broken by r149964

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, folks,

Building with --enable-build-with-cxx fails to bootstrap as follows:

Comparing stages 2 and 3
warning: gcc/cc1plus-checksum.o differs
warning: gcc/cc1-checksum.o differs
Bootstrap comparison failure!
x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/eh_alloc.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/vec.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/eh_globals.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/guard.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/mt_allocator.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/locale.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/pool_allocator.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/basic_file.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/system_error.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/locale_init.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/debug.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/mt_allocator.o
differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/locale.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/pool_allocator.o
differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/basic_file.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/system_error.o
differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/locale_init.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/debug.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/atomic.o differs
x86_64-unknown-linux-gnu/32/libstdc++-v3/src/atomic.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/eh_alloc.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/vec.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/eh_globals.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/mt_allocator.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/locale.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/pool_allocator.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/basic_file.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/system_error.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/locale_init.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/debug.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/mt_allocator.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/locale.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/pool_allocator.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/basic_file.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/system_error.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/locale_init.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/debug.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/future.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/atomic.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/future.o differs
x86_64-unknown-linux-gnu/libstdc++-v3/src/atomic.o differs
make[2]: *** [compare] Error 1
make[2]: Leaving directory `/home/jlquinn/gcc/dev/build/trunk-cxx'
make[1]: *** [stage3-bubble] Error 2
make[1]: Leaving directory `/home/jlquinn/gcc/dev/build/trunk-cxx'
make: *** [all] Error 2
jlquinn@cerberus:~/gcc/dev/build/trunk-cxx$



After bisecting the svn repository, I tracked the problem down to
r149964:

XXXXXXXXXXXXXXX Try C++ bootstrap here FAIL
------------------------------------------------------------------------
r149964 | jason | 2009-07-22 19:03:22 -0400 (Wed, 22 Jul 2009) | 8 lines

        * mangle.c (mangle_type_string_for_rtti): Rename to be clearer.
        (needs_fake_anon): New.
        (write_name): Check it.
        (write_nested_name): Add a fake anonymous namespace scope if
true.
        * name-lookup.c (get_anonymous_namespace_name): No longer
static.
        * rtti.c, cp-tree.h: Adjust.

        * libsupc++/typeinfo (__GXX_MERGED_TYPEINFO_NAMES): Default to
0.



XXXXXXXXXXXXXXX Try C++ bootstrap here  SUCCESS
------------------------------------------------------------------------
r149962 | vmakarov | 2009-07-22 18:00:17 -0400 (Wed, 22 Jul 2009) | 22
lines

2009-07-22  Vladimir Makarov  <vmakarov@...>

PR target/37488
* ira-lives.c (bb_has_abnormal_call_pred): New function.
(process_bb_node_lives): Use it.





Can someone take a look at this please?

I came across this while trying to solve why enable-build-with-cxx
didn't build on Fedora 11. (I have a patch, but I was waiting to track
this down first).  Having checked in some of the configure patches for
it, I thought I should isolate the actual broken checkin to make sure it
wasn't me :-)


Thanks,
Jerry





Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jason Merrill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/15/2009 10:12 AM, Jerry Quinn wrote:
> Bootstrap comparison failure!
 >[...]
>          (write_nested_name): Add a fake anonymous namespace scope if
> true.

What I assume is going on here is that use of anonymous namespaces can
break bitwise comparison, because get_file_function_name uses a random
number if it doesn't know a non-weak symbol to use in the name.

One thing that would help would be to defer all mangling, or at least
all mangling that depends on the anonymous namespace name, until end of
file so that first_global_object_name is usually set.

I'm not sure why GCC sources would need to mangle function-local
structs, though.

Jason

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-08-17 at 16:16 -0400, Jason Merrill wrote:

> On 08/15/2009 10:12 AM, Jerry Quinn wrote:
> > Bootstrap comparison failure!
>  >[...]
> >          (write_nested_name): Add a fake anonymous namespace scope if
> > true.
>
> What I assume is going on here is that use of anonymous namespaces can
> break bitwise comparison, because get_file_function_name uses a random
> number if it doesn't know a non-weak symbol to use in the name.
>
> One thing that would help would be to defer all mangling, or at least
> all mangling that depends on the anonymous namespace name, until end of
> file so that first_global_object_name is usually set.
>
> I'm not sure why GCC sources would need to mangle function-local
> structs, though.

I'm not sure if the following is relevant, but I found it in
cp/mangle.c:

/* Since we now use strcmp to compare typeinfos on all targets because
of
   the RTLD_LOCAL problem, we need to munge the typeinfo name used for
   local classes of static functions to fix g++.dg/abi/local1.C.  We do
   that by pretending that the function is in an anonymous namespace.
*/

static bool
needs_fake_anon (const_tree decl)


Jery



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Richard Henderson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/17/2009 07:40 PM, Jerry Quinn wrote:

> On Mon, 2009-08-17 at 16:16 -0400, Jason Merrill wrote:
>> I'm not sure why GCC sources would need to mangle function-local
>> structs, though.
>
> I'm not sure if the following is relevant, but I found it in
> cp/mangle.c:
>
> /* Since we now use strcmp to compare typeinfos on all targets because
> of
>     the RTLD_LOCAL problem, we need to munge the typeinfo name used for
>     local classes of static functions to fix g++.dg/abi/local1.C.  We do
>     that by pretending that the function is in an anonymous namespace.
> */
>
> static bool
> needs_fake_anon (const_tree decl)

Would it be helpful to reserve a leading character (say, "*") that means
that strcmp should not apply, but rather pointer identity?  Thus a class
foo that is intended to be local, as opposed to forced local via
RTLD_LOCAL, can just use "*foo" and not have to bother with mangling?


r~

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jason Merrill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/18/2009 11:43 AM, Richard Henderson wrote:
> Would it be helpful to reserve a leading character (say, "*") that means
> that strcmp should not apply, but rather pointer identity? Thus a class
> foo that is intended to be local, as opposed to forced local via
> RTLD_LOCAL, can just use "*foo" and not have to bother with mangling?

Interesting idea.

Jason

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-08-18 at 08:43 -0700, Richard Henderson wrote:
> On 08/17/2009 07:40 PM, Jerry Quinn wrote:
> > On Mon, 2009-08-17 at 16:16 -0400, Jason Merrill wrote:
> >> I'm not sure why GCC sources would need to mangle function-local
> >> structs, though.
> >
> Would it be helpful to reserve a leading character (say, "*") that means
> that strcmp should not apply, but rather pointer identity?  Thus a class
> foo that is intended to be local, as opposed to forced local via
> RTLD_LOCAL, can just use "*foo" and not have to bother with mangling?

I took a (very naive) swing at implementing this.  I made the change in
my copy of r149964 to avoid the possibility of other issues interfering.
Apparently my change is too naive, because the assembler doesn't like a
name with '*' in it.  Are there any chars that can pass muster with
assemblers but not be a valid namespace identifier?

The patch I tried is below.

Thanks,
Jerry


libtool: compile:  /home/jlquinn/gcc/dev/build/trunk/./gcc/xgcc
-shared-libgcc -B/home/jlquinn/gcc/dev/build/trunk/./gcc -nostdinc++
-L/home/jlquinn/gcc/dev/build/trunk/x86_64-unknown-linux-gnu/libstdc
++-v3/src
-L/home/jlquinn/gcc/dev/build/trunk/x86_64-unknown-linux-gnu/libstdc
++-v3/src/.libs -B/usr/local/x86_64-unknown-linux-gnu/bin/
-B/usr/local/x86_64-unknown-linux-gnu/lib/
-isystem /usr/local/x86_64-unknown-linux-gnu/include
-isystem /usr/local/x86_64-unknown-linux-gnu/sys-include
-I/home/jlquinn/gcc/dev/gcc-in-cxx/libstdc++-v3/../gcc
-I/home/jlquinn/gcc/dev/build/trunk/x86_64-unknown-linux-gnu/libstdc
++-v3/include/x86_64-unknown-linux-gnu
-I/home/jlquinn/gcc/dev/build/trunk/x86_64-unknown-linux-gnu/libstdc
++-v3/include -I/home/jlquinn/gcc/dev/gcc-in-cxx/libstdc++-v3/libsupc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g
-O2 -D_GNU_SOURCE -c ../../../../../gcc-in-cxx/libstdc++-v3/libsupc
++/eh_alloc.cc  -fPIC -DPIC -o eh_alloc.o
/tmp/ccbRNQMb.s: Assembler messages:
/tmp/ccbRNQMb.s:1384: Error: unrecognized symbol type ""
/tmp/ccbRNQMb.s:1384: Error: junk at end of line, first unrecognized
character is `*'
/tmp/ccbRNQMb.s:1385: Error: expected comma after name `_ZN12' in .size
directive
/tmp/ccbRNQMb.s:1386: Error: invalid character '*' in mnemonic
make[5]: *** [eh_alloc.lo] Error 1



Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c (revision 149964)
+++ gcc/cp/name-lookup.c (working copy)
@@ -69,7 +69,8 @@
     {
       /* The anonymous namespace has to have a unique name
  if typeinfo objects are being compared by name.  */
-      anonymous_namespace_name = get_file_function_name ("N");
+      //      anonymous_namespace_name = get_file_function_name ("N");
+      anonymous_namespace_name = get_identifier ("*cxx_anon_ns");
     }
   return anonymous_namespace_name;
 }
Index: libstdc++-v3/libsupc++/tinfo2.cc
===================================================================
--- libstdc++-v3/libsupc++/tinfo2.cc (revision 149964)
+++ libstdc++-v3/libsupc++/tinfo2.cc (working copy)
@@ -37,7 +37,9 @@
 #if __GXX_MERGED_TYPEINFO_NAMES
   return name () < arg.name ();
 #else
-  return __builtin_strcmp (name (), arg.name ()) < 0;
+  return (name ()[0] == '*' && arg.name()[0] == '*')
+    ? name () < arg.name ()
+    :  __builtin_strcmp (name (), arg.name ()) < 0;
 #endif
 }
 
Index: libstdc++-v3/libsupc++/typeinfo
===================================================================
--- libstdc++-v3/libsupc++/typeinfo (revision 149964)
+++ libstdc++-v3/libsupc++/typeinfo (working copy)
@@ -110,12 +110,15 @@
     // we can run into cases where type_info names aren't merged,
     // so we still need to do string comparison.
     bool before(const type_info& __arg) const
-    { return __builtin_strcmp (__name, __arg.__name) < 0; }
+    { return (__name[0] == '*' && __arg.__name[0] == '*')
+ ? __name < __arg.__name
+ : __builtin_strcmp (__name, __arg.__name) < 0; }
 
     bool operator==(const type_info& __arg) const
     {
       return ((__name == __arg.__name)
-      || __builtin_strcmp (__name, __arg.__name) == 0);
+      || (__name[0] != '*' && __arg.__name[0] != '*' &&
+  __builtin_strcmp (__name, __arg.__name) == 0));
     }
   #else
     // On some targets we can rely on type_info's NTBS being unique,
Index: libstdc++-v3/libsupc++/tinfo.cc
===================================================================
--- libstdc++-v3/libsupc++/tinfo.cc (revision 149964)
+++ libstdc++-v3/libsupc++/tinfo.cc (working copy)
@@ -41,7 +41,9 @@
 #if __GXX_MERGED_TYPEINFO_NAMES
   return name () == arg.name ();
 #else
-  return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) ==
0);
+  return (&arg == this)
+    || (name ()[0] != '*' && arg.name ()[0] != '*'
+ && (__builtin_strcmp (name (), arg.name ()) == 0));
 #endif
 }
 





Re: enable-build-with-cxx bootstrap compare broken by r149964

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jerry Quinn wrote:

> On Tue, 2009-08-18 at 08:43 -0700, Richard Henderson wrote:
>> On 08/17/2009 07:40 PM, Jerry Quinn wrote:
>>> On Mon, 2009-08-17 at 16:16 -0400, Jason Merrill wrote:
>>>> I'm not sure why GCC sources would need to mangle function-local
>>>> structs, though.
>> Would it be helpful to reserve a leading character (say, "*") that means
>> that strcmp should not apply, but rather pointer identity?  Thus a class
>> foo that is intended to be local, as opposed to forced local via
>> RTLD_LOCAL, can just use "*foo" and not have to bother with mangling?
>
> I took a (very naive) swing at implementing this.  I made the change in
> my copy of r149964 to avoid the possibility of other issues interfering.
> Apparently my change is too naive, because the assembler doesn't like a
> name with '*' in it.  Are there any chars that can pass muster with
> assemblers but not be a valid namespace identifier?

  Don't you just want to arrange things so that the asterisk ends up in the
typeinfo name string but not in the asm name?

    cheers,
      DaveK


Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-08-20 at 11:12 +0100, Dave Korn wrote:

> Jerry Quinn wrote:
> > On Tue, 2009-08-18 at 08:43 -0700, Richard Henderson wrote:
> >> On 08/17/2009 07:40 PM, Jerry Quinn wrote:
> >>> On Mon, 2009-08-17 at 16:16 -0400, Jason Merrill wrote:
> >>>> I'm not sure why GCC sources would need to mangle function-local
> >>>> structs, though.
> >> Would it be helpful to reserve a leading character (say, "*") that means
> >> that strcmp should not apply, but rather pointer identity?  Thus a class
> >> foo that is intended to be local, as opposed to forced local via
> >> RTLD_LOCAL, can just use "*foo" and not have to bother with mangling?
> >
> > I took a (very naive) swing at implementing this.  I made the change in
> > my copy of r149964 to avoid the possibility of other issues interfering.
> > Apparently my change is too naive, because the assembler doesn't like a
> > name with '*' in it.  Are there any chars that can pass muster with
> > assemblers but not be a valid namespace identifier?
>
>   Don't you just want to arrange things so that the asterisk ends up in the
> typeinfo name string but not in the asm name?

Well, it WAS a very naive attack on the problem :-)

Where can I look to set the typeinfo name without setting the asm name?

Thanks,
Jerry



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jerry Quinn wrote:
> On Thu, 2009-08-20 at 11:12 +0100, Dave Korn wrote:
>> Jerry Quinn wrote:

>>> Apparently my change is too naive, because the assembler doesn't like a
>>> name with '*' in it.  Are there any chars that can pass muster with
>>> assemblers but not be a valid namespace identifier?
>>   Don't you just want to arrange things so that the asterisk ends up in the
>> typeinfo name string but not in the asm name?
>
> Well, it WAS a very naive attack on the problem :-)
>
> Where can I look to set the typeinfo name without setting the asm name?

  I think you want to just modify the NTBS name, rather than the internal
identifier used to refer to it.  Take a look at tinfo_base_init() in
gcc/cp/rtti.c, and how it calls tinfo_name.

    cheers,
      DaveK

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-08-20 at 14:05 +0100, Dave Korn wrote:

> Jerry Quinn wrote:
> > On Thu, 2009-08-20 at 11:12 +0100, Dave Korn wrote:
> >> Jerry Quinn wrote:
>
> >>> Apparently my change is too naive, because the assembler doesn't like a
> >>> name with '*' in it.  Are there any chars that can pass muster with
> >>> assemblers but not be a valid namespace identifier?
> >>   Don't you just want to arrange things so that the asterisk ends up in the
> >> typeinfo name string but not in the asm name?
> >
> > Well, it WAS a very naive attack on the problem :-)
> >
> > Where can I look to set the typeinfo name without setting the asm name?
>
>   I think you want to just modify the NTBS name, rather than the internal
> identifier used to refer to it.  Take a look at tinfo_base_init() in
> gcc/cp/rtti.c, and how it calls tinfo_name.

OK, I'm now confused.  How does this dovetail with anonymous
namespaces?  

Richard's suggestion was to avoid mangling the name at all and relying
on pointers being different to distinguish between the anonymous
namespaces in different translation units.

If I understand correctly, the main thing we want is for libstdc++ to
consider two typeinfos the same if they are the same type in the same
file's anonymous namespace, but different if they have the same name but
came from different files.

I'm unclear how the symbols in the asm get turned into typeinfos, and
thus how the transform needs to be done.

Jerry



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jerry Quinn wrote:
>
> OK, I'm now confused.  How does this dovetail with anonymous
> namespaces?  

  We're talking about typeinfo strings.  The namespace is part of the typeinfo
name string (the so-called NTBS name), and it's the random number in the
anonymous namespace name used for these local definitions that is varying
between stages 2 and 3 and causing the bootstrap comparison failure, if I've
been following the thread correctly.

> Richard's suggestion was to avoid mangling the name at all and relying
> on pointers being different to distinguish between the anonymous
> namespaces in different translation units.

  Yep, and to put an asterisk at the start of the NTBS name to indicate that
it can only be used for pointer comparison.

> If I understand correctly, the main thing we want is for libstdc++ to
> consider two typeinfos the same if they are the same type in the same
> file's anonymous namespace, but different if they have the same name but
> came from different files.

  Yep, that's the idea.

> I'm unclear how the symbols in the asm get turned into typeinfos, and
> thus how the transform needs to be done.

  It's the other way round.  The typeinfo names and structs are constructed
based on the C++ decl tree structs for the type in question, and then assigned
an asm name according to the cxx-abi rules.

  Your patch puts the asterisk into the namespace identifier decl, so it ends
up in both the rtti NTBS name string, and also in the generated asm name for
the objects.  What I think you need to do is use an identifier for the
anonymous namespace without an asterisk, but prefix the asterisk when
generating the corresponding NTBS name string; then your changes to the name
comparison routines in libsupc++ should work, but the typeinfo name string
won't have any funny chars in it.

  You might also need to take steps to ensure that the typeinfo gets emitted
as non-COMDAT with local symbols, so that each object does indeed end up with
its own separate copy.

    cheers,
      DaveK


Re: enable-build-with-cxx bootstrap compare broken by r149964

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:
> What I think you need to do is use an identifier for the
> anonymous namespace without an asterisk, but prefix the asterisk when
> generating the corresponding NTBS name string; then your changes to the name
> comparison routines in libsupc++ should work, but the typeinfo name string
> won't have any funny chars in it.

  Bah, that was confusing of me.  I meant to say that the asm label for the
typeinfo name string won't have any funny chars in it; the name string itself
will of course still contain the asterisk.  Sorry.

    cheers,
      DaveK



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-08-20 at 15:22 +0100, Dave Korn wrote:
>   Your patch puts the asterisk into the namespace identifier decl, so it ends
> up in both the rtti NTBS name string, and also in the generated asm name for
> the objects.  What I think you need to do is use an identifier for the
> anonymous namespace without an asterisk, but prefix the asterisk when
> generating the corresponding NTBS name string; then your changes to the name
> comparison routines in libsupc++ should work, but the typeinfo name string
> won't have any funny chars in it.

OK, I've gotten almost this far and can bootstrap (the asterisk is
actually not the very first char and I have to figure that out).
However, in the referenced test case, both typeinfos are apparently
merged, thus returning the same pointer for their name strings, so
pointer comparison still wouldn't work.

Therefore, I guess I'll need to do the following:

>   You might also need to take steps to ensure that the typeinfo gets emitted
> as non-COMDAT with local symbols, so that each object does indeed end up with
> its own separate copy.

Where should I look to do this?

Thanks,
Jerry



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Richard Henderson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/21/2009 02:37 PM, Jerry Quinn wrote:

> OK, I've gotten almost this far and can bootstrap (the asterisk is
> actually not the very first char and I have to figure that out).
> However, in the referenced test case, both typeinfos are apparently
> merged, thus returning the same pointer for their name strings, so
> pointer comparison still wouldn't work.
>
> Therefore, I guess I'll need to do the following:
>
>>    You might also need to take steps to ensure that the typeinfo gets emitted
>> as non-COMDAT with local symbols, so that each object does indeed end up with
>> its own separate copy.
>
> Where should I look to do this?

First thing you should do is make sure you're emitting a VAR_DECL
with the string contents, rather than a STRING_CST constant.  The
later will be merged within an object file within the compiler.

Second, make sure the VAR_DECL for the typeinfo is no DECL_ONE_ONLY.
That flag sets up COMDAT sections, which will be merged by the linker.


r~

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-08-21 at 15:25 -0700, Richard Henderson wrote:

> On 08/21/2009 02:37 PM, Jerry Quinn wrote:
> > OK, I've gotten almost this far and can bootstrap (the asterisk is
> > actually not the very first char and I have to figure that out).
> > However, in the referenced test case, both typeinfos are apparently
> > merged, thus returning the same pointer for their name strings, so
> > pointer comparison still wouldn't work.
> >
> > Therefore, I guess I'll need to do the following:
> >
> >>    You might also need to take steps to ensure that the typeinfo gets emitted
> >> as non-COMDAT with local symbols, so that each object does indeed end up with
> >> its own separate copy.
> >
> > Where should I look to do this?
>
> First thing you should do is make sure you're emitting a VAR_DECL
> with the string contents, rather than a STRING_CST constant.  The
> later will be merged within an object file within the compiler.
>
> Second, make sure the VAR_DECL for the typeinfo is no DECL_ONE_ONLY.
> That flag sets up COMDAT sections, which will be merged by the linker.

It looks like I"ve got a working patch now.  It bootstraps and has no
reqressions from make check, nor from make check in the libstdc++
directory.

Any thoughts?

Jerry


2009-08-22  Jerry Quinn  <jlquinn@...>

        * name-lookup.c (get_anonymous_namespace_name): Use fixed
        namespace "cxx_anon_ns".
        * mangle.c (write_nested_name): Insert '*' to mark fake anonymous
        namespace.
        (get_mangled_string_length): New function.
        (mangle_type_string_for_rtti): Put '*' at start of mangled namestring.
        * rtti.c (tinfo_base_init): Disable DECL_COMDAT for fake
        anonymous namespaces.

2009-08-22  Jerry Quinn  <jlquinn@...>

        * libsupc++/tinfo.cc (typeinfo::operator==): Compare names
        starting with '*' by pointer.
        * libsupc++/tinfo2.cc (typeinfo::before): Same.
        * libsupc++/typeinfo (typeinfo::operator==): Same.
        * libsupc++/typeinfo (typeinfo::before): Same.


Index: gcc/cp/rtti.c
===================================================================
--- gcc/cp/rtti.c (revision 151008)
+++ gcc/cp/rtti.c (working copy)
@@ -862,9 +862,12 @@
     DECL_TINFO_P (name_decl) = 1;
     set_linkage_according_to_type (target, name_decl);
     import_export_decl (name_decl);
+    /* Disable DECL_COMDAT if we have an anonymous namspace here. */
+    if (TREE_STRING_POINTER (name_string)[0] == '*')
+      DECL_COMDAT (name_decl) = 0;
     DECL_INITIAL (name_decl) = name_string;
     mark_used (name_decl);
     pushdecl_top_level_and_finish (name_decl, name_string);
 2009-08-21  Jakub Jelinek  <jakub@...>
 
  PR c++/41131
Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c (revision 151008)
+++ gcc/cp/mangle.c (working copy)
@@ -935,8 +935,14 @@
       /* No, just use <prefix>  */
       write_prefix (DECL_CONTEXT (decl));
       if (needs_fake_anon (decl))
- /* Pretend this static function is in an anonymous namespace.  */
- write_source_name (get_anonymous_namespace_name ());
+ {
+  /* Add a * to mark fake anonymous namespaces in typeinfos as
+     compare-by-pointer.  This * is used to put another one at the
+     front when done building the string. */
+  write_char ('*');
+  /* Pretend this static function is in an anonymous namespace.  */
+  write_source_name (get_anonymous_namespace_name ());
+ }
       write_unqualified_name (decl);
     }
   write_char ('E');
@@ -2755,6 +2761,14 @@
   name_base = obstack_alloc (&name_obstack, 0);
 }
 
+/*  Returns the length of the mangled string array.  */
+
+static inline int
+get_mangled_string_length (void)
+{
+  return obstack_object_size (mangle_obstack);
+}
+
 /* Done with mangling. If WARN is true, and the name of G.entity will
    be mangled differently in a future version of the ABI, issue a
    warning.  */
@@ -2851,13 +2865,20 @@
 mangle_type_string_for_rtti (const tree type)
 {
   const char *result;
+  int result_len;
 
   start_mangling (type);
   /* Mangle in a fake anonymous namespace if necessary.  */
   fake_anon_scope = true;
+  /* Place marker to be removed if not dealing with a nested name.  */
+  write_char('*');
   write_type (type);
   fake_anon_scope = false;
+  result_len = get_mangled_string_length ();
   result = finish_mangling (/*warn=*/false);
+  /* Remove the marker if not needed.  */
+  if (!strchr(result + 1, '*'))
+    result++;
   if (DEBUG_MANGLE)
     fprintf (stderr, "mangle_type_string = '%s'\n\n", result);
   return result;
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c (revision 151008)
+++ gcc/cp/name-lookup.c (working copy)
@@ -69,7 +69,7 @@
     {
       /* The anonymous namespace has to have a unique name
  if typeinfo objects are being compared by name.  */
-      anonymous_namespace_name = get_file_function_name ("N");
+      anonymous_namespace_name = get_identifier ("cxx_anon_ns");
     }
   return anonymous_namespace_name;
 }
Index: libstdc++-v3/libsupc++/tinfo2.cc
===================================================================
--- libstdc++-v3/libsupc++/tinfo2.cc (revision 151008)
+++ libstdc++-v3/libsupc++/tinfo2.cc (working copy)
@@ -37,7 +37,9 @@
 #if __GXX_MERGED_TYPEINFO_NAMES
   return name () < arg.name ();
 #else
-  return __builtin_strcmp (name (), arg.name ()) < 0;
+  return (name ()[0] == '*' && arg.name()[0] == '*')
+    ? name () < arg.name ()
+    :  __builtin_strcmp (name (), arg.name ()) < 0;
 #endif
 }
 
Index: libstdc++-v3/libsupc++/typeinfo
===================================================================
--- libstdc++-v3/libsupc++/typeinfo (revision 151008)
+++ libstdc++-v3/libsupc++/typeinfo (working copy)
@@ -110,12 +110,15 @@
     // we can run into cases where type_info names aren't merged,
     // so we still need to do string comparison.
     bool before(const type_info& __arg) const
-    { return __builtin_strcmp (__name, __arg.__name) < 0; }
+    { return (__name[0] == '*' && __arg.__name[0] == '*')
+ ? __name < __arg.__name
+ : __builtin_strcmp (__name, __arg.__name) < 0; }
 
     bool operator==(const type_info& __arg) const
     {
       return ((__name == __arg.__name)
-      || __builtin_strcmp (__name, __arg.__name) == 0);
+      || (__name[0] != '*' && __arg.__name[0] != '*' &&
+  __builtin_strcmp (__name, __arg.__name) == 0));
     }
   #else
     // On some targets we can rely on type_info's NTBS being unique,
Index: libstdc++-v3/libsupc++/tinfo.cc
===================================================================
--- libstdc++-v3/libsupc++/tinfo.cc (revision 151008)
+++ libstdc++-v3/libsupc++/tinfo.cc (working copy)
@@ -41,7 +41,9 @@
 #if __GXX_MERGED_TYPEINFO_NAMES
   return name () == arg.name ();
 #else
-  return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) ==
0);
+  return (&arg == this)
+    || (name ()[0] != '*' && arg.name ()[0] != '*'
+ && (__builtin_strcmp (name (), arg.name ()) == 0));
 #endif
 }
 





Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jason Merrill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/15/2009 10:12 AM, Jerry Quinn wrote:
> Building with --enable-build-with-cxx fails to bootstrap as follows:
>
> Comparing stages 2 and 3
> warning: gcc/cc1plus-checksum.o differs
> warning: gcc/cc1-checksum.o differs
> Bootstrap comparison failure!
> x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/eh_alloc.o differs
 >...

Do you know why r149964 makes a difference?  The only objects that are
listed as differing here are from libstdc++, and changing
needs_fake_anon to abort rather than return true doesn't cause any
problems building libstdc++.  We used anonymous namespaces in the
library before this...

I tried doing the bootstrap myself, but build-with-cxx doesn't currently
work with glibc 2.10.  I guess I could try on a box with an older
install, but haven't yet.

Jason

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jerry Quinn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-08-27 at 00:24 -0400, Jason Merrill wrote:

> On 08/15/2009 10:12 AM, Jerry Quinn wrote:
> > Building with --enable-build-with-cxx fails to bootstrap as follows:
> >
> > Comparing stages 2 and 3
> > warning: gcc/cc1plus-checksum.o differs
> > warning: gcc/cc1-checksum.o differs
> > Bootstrap comparison failure!
> > x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/eh_alloc.o differs
>  >...
>
> Do you know why r149964 makes a difference?  The only objects that are
> listed as differing here are from libstdc++, and changing
> needs_fake_anon to abort rather than return true doesn't cause any
> problems building libstdc++.  We used anonymous namespaces in the
> library before this...

I don't know.  I didn't try to debug, I only did the bootstraps
narrowing down the offending patch.

> I tried doing the bootstrap myself, but build-with-cxx doesn't currently
> work with glibc 2.10.  I guess I could try on a box with an older
> install, but haven't yet.

The following patch solved bootstrapping for Pedro on Fedora 11.  It's
got the new glibc.  Tackling that issue is what got me onto this one to
begin with.  I was holding off on submitting it because I wouldn't be
able to claim that the patch bootstrapped successfully against the head
of the trunk.

Jerry


Index: gcc/configure
===================================================================
--- gcc/configure (revision 149964)
+++ gcc/configure (working copy)
@@ -10650,8 +10650,9 @@
 
 
 
+
 for ac_func in times clock kill getrlimit setrlimit atoll atoq \
- sysconf strsignal getrusage nl_langinfo \
+ sysconf strsignal getrusage nl_langinfo basename \
  gettimeofday mbstowcs wcswidth mmap mincore setlocale \
  clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked
fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked
fputc_unlocked fputs_unlocked   fread_unlocked fwrite_unlocked
getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked
 do
@@ -12673,11 +12674,10 @@
 
 
 
-
 for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
  strsignal strstr strverscmp \
  errno snprintf vsnprintf vasprintf malloc realloc calloc \
- free basename getopt clock getpagesize clearerr_unlocked feof_unlocked
ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked
fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked
putchar_unlocked putc_unlocked
+ free getopt clock getpagesize clearerr_unlocked feof_unlocked
ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked
fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked
putchar_unlocked putc_unlocked
 do
   ac_tr_decl=`echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
 echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5
Index: gcc/config.in
===================================================================
--- gcc/config.in (revision 149964)
+++ gcc/config.in (working copy)
@@ -321,6 +321,12 @@
 #endif
 
 
+/* Define if your assembler supports LWSYNC instructions. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_LWSYNC
+#endif
+
+
 /* Define if your assembler supports mfcr field. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_MFCRF
@@ -351,23 +357,18 @@
 #endif
 
 
-/* Define if your assembler supports popcntb instruction. */
+/* Define if your assembler supports popcntb field. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_POPCNTB
 #endif
 
 
-/* Define if your assembler supports popcntd instruction. */
+/* Define if your assembler supports POPCNTD instructions. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_POPCNTD
 #endif
 
-/* Define if your assembler supports lwsync instruction. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_LWSYNC
-#endif
 
-
 /* Define if your assembler supports .register. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_REGISTER_PSEUDO_OP
@@ -430,6 +431,12 @@
 #endif
 
 
+/* Define to 1 if you have the `basename' function. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_BASENAME
+#endif
+
+
 /* Define to 1 if you have the `clearerr_unlocked' function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_CLEARERR_UNLOCKED
@@ -480,13 +487,6 @@
 #endif
 
 
-/* Define to 1 if we found a declaration for 'basename', otherwise
define to
-   0. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_DECL_BASENAME
-#endif
-
-
 /* Define to 1 if we found a declaration for 'calloc', otherwise define
to 0.
    */
 #ifndef USED_FOR_TARGET
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 149964)
+++ gcc/configure.ac (working copy)
@@ -1016,7 +1016,7 @@
   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
   putchar_unlocked putc_unlocked)
 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
- sysconf strsignal getrusage nl_langinfo \
+ sysconf strsignal getrusage nl_langinfo basename \
  gettimeofday mbstowcs wcswidth mmap mincore setlocale \
  gcc_UNLOCKED_FUNCS)
 
@@ -1068,7 +1068,7 @@
 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
  strsignal strstr strverscmp \
  errno snprintf vsnprintf vasprintf malloc realloc calloc \
- free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
+ free getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
 #include "ansidecl.h"
 #include "system.h"])
 
Index: include/libiberty.h
===================================================================
--- include/libiberty.h (revision 149964)
+++ include/libiberty.h (working copy)
@@ -100,7 +100,7 @@
    declaration without arguments.  If it is 0, we checked and failed
    to find the declaration so provide a fully prototyped one.  If it
    is 1, we found it so don't provide any declaration at all.  */
-#if !HAVE_DECL_BASENAME
+#if !HAVE_BASENAME
 #if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined
(__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined
(__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) ||
defined (HAVE_DECL_BASENAME)
 extern char *basename (const char *);
 #else
Index: libcpp/configure
===================================================================
--- libcpp/configure (revision 149964)
+++ libcpp/configure (working copy)
@@ -4330,7 +4330,109 @@
 
 done
 
+
+for ac_func in basename
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares
$ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+else
    ac_ext=cc
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4730,8 +4832,110 @@
 
 done
 
+
+for ac_func in basename
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares
$ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
 fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
+fi
+done
+
+fi
+
 # Checks for typedefs, structures, and compiler characteristics.
 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
@@ -6341,76 +6545,6 @@
 
 
 fi
-echo "$as_me:$LINENO: checking whether basename is declared" >&5
-echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6
-if test "${ac_cv_have_decl_basename+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-#ifndef basename
-  char *p = (char *) basename;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_have_decl_basename=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_have_decl_basename=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5
-echo "${ECHO_T}$ac_cv_have_decl_basename" >&6
-if test $ac_cv_have_decl_basename = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_BASENAME 1
-_ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_BASENAME 0
-_ACEOF
-
-
-fi
 echo "$as_me:$LINENO: checking whether errno is declared" >&5
 echo $ECHO_N "checking whether errno is declared... $ECHO_C" >&6
 if test "${ac_cv_have_decl_errno+set}" = set; then
Index: libcpp/configure.ac
===================================================================
--- libcpp/configure.ac (revision 149964)
+++ libcpp/configure.ac (working copy)
@@ -59,10 +59,12 @@
    AC_LANG(C)
    AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
  stdlib.h strings.h string.h sys/file.h unistd.h)
+   AC_CHECK_FUNCS(basename)
 else
    AC_LANG(C++)
    AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
  stdlib.h strings.h string.h sys/file.h unistd.h)
+   AC_CHECK_FUNCS(basename)
 fi
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -81,7 +83,7 @@
   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
   putchar_unlocked putc_unlocked)
 AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
-AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno
getopt \
+AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf errno getopt \
   libcpp_UNLOCKED_FUNCS vasprintf)))
 
 # Checks for library functions.
Index: libcpp/config.in
===================================================================
--- libcpp/config.in (revision 149964)
+++ libcpp/config.in (working copy)
@@ -22,6 +22,9 @@
    */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the `basename' function. */
+#undef HAVE_BASENAME
+
 /* Define to 1 if you have the `clearerr_unlocked' function. */
 #undef HAVE_CLEARERR_UNLOCKED
 
@@ -33,10 +36,6 @@
    don't. */
 #undef HAVE_DECL_ASPRINTF
 
-/* Define to 1 if you have the declaration of `basename', and to 0 if
you
-   don't. */
-#undef HAVE_DECL_BASENAME
-
 /* Define to 1 if you have the declaration of `clearerr_unlocked', and
to 0 if
    you don't. */
 #undef HAVE_DECL_CLEARERR_UNLOCKED



Re: enable-build-with-cxx bootstrap compare broken by r149964

by Alexandre Oliva-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Aug 27, 2009, Jason Merrill <jason@...> wrote:

> On 08/15/2009 10:12 AM, Jerry Quinn wrote:
>> Building with --enable-build-with-cxx fails to bootstrap as follows:
>>
>> x86_64-unknown-linux-gnu/32/libstdc++-v3/libsupc++/eh_alloc.o differs
>> ...

> Do you know why r149964 makes a difference?

No idea if it's related, but I started getting -fcompare-debug failures
a while ago, and eventually I tracked it down to -frandom-seed -derived
mangled symbol names.

--
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jason Merrill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/31/2009 12:57 AM, Jerry Quinn wrote:
> On Thu, 2009-08-27 at 00:24 -0400, Jason Merrill wrote:
>> Do you know why r149964 makes a difference?

I understand now.  The patch changed the anonymous namespace name to use
get_file_function_name in all cases, where previously we were using the
same name in all translation units.  This was necessary to avoid
treating types in the anonymous namespace in two different translation
units as equivalent for typeinfo comparison.

Your patch deals with the fake anonymous namespace inserted for
mangling, but doesn't deal with real anonymous namespaces, which will be
incorrectly treated as identical with your patch.

I think the way to go with this is to revert the compiler bits of
r149964, not mess with mangle.c at all, and insert the initial * if the
typeinfo name won't have TREE_PUBLIC set, since that's precisely the
property we want to mirror in comparison.

Jason

Re: enable-build-with-cxx bootstrap compare broken by r149964

by Jason Merrill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09/14/2009 11:54 AM, Jason Merrill wrote:
> I think the way to go with this is to revert the compiler bits of
> r149964, not mess with mangle.c at all, and insert the initial * if the
> typeinfo name won't have TREE_PUBLIC set, since that's precisely the
> property we want to mirror in comparison.

Thoughts?  Another concern I have is that adding an initial * breaks
simple demangling of type_info::name(), so I'd like to find another way
of marking it for pointer comparison.

Jason
< Prev | 1 - 2 | Next >