handle <local-source-name> in demangler

Mark Mitchell mark@codesourcery.com
Fri Nov 10 03:13:00 GMT 2006

Geoffrey Keating wrote:

[cxx-abi-dev removed from CC: as this subthread is not ABI-related.]

>> Since you've complained in the past that people have objected to some
>> of your changes only after you have checked in patches, I want to make
>> it clear that I'm objecting now.
> Thank you for making it clear that you're objecting now!
> I don't think I can commit to doing any work on GAS.

I'm sorry to hear that.

> make IMA use the new feature; this may or may not be useful for LTO.  If
> the new assembler is not available then, what I have implemented now is
> that on ELF systems, if the compiler ever tries to put out a name in the
> new mangling then it will call sorry().  Is this acceptable?

That's effectively an end-run, in that IMA's presumed usefulness will
put pressure on us to just remove the sorry, resulting in the
unnecessary new mangling appearing on GNU/Linux systems.  This is one
way that partially-finished features escape from GCC into the wild.

I think it would be courteous of you to invest in the GAS work, even
though Mach-O can't take advantage of the feature, just as others have
done work to help Darwin, even though they don't necessarily use it.  I
would think that the GAS work would be a small fraction of the total
effort required for C++ IMA and doing this work would demonstrate your
willingness to help users on other systems.

I'd also like to understand why it's impossible to handle this without
mangling changes on OS X.  I know that Mach-O doesn't presently support
it, but is there some reason it can't be made to do so in a
backwards-compatible way?  Even PE/COFF can do it (as evidenced by ld -r
working there), which means that if not for OS X we mightn't need this
at all.  (In fairness, I don't know about SOM or XCOFF, but I'm assuming
that ld -r works there too, and generates a single object file.)

Do we really need another mangling even for March-O, even if it
inherently can never have two local symbols with the same name?  GCC
already has machinery to uniquify assembler names (with ".1", ".2",
etc., IIRC); why not do that here too, since "." cannot appear in a
valid mangled name?  The demangler can get to the "." and just ignore
whatever comes after that.

On all systems, we could do a simple uniquification in GCC and get
object files that worked.  The only benefit of any mangling changes is
to get demangling support for the names.  But, on systems with (the
enhanced) GAS, we could get ABI-compliant names in the .o files anyhow.
 And the GAS feature would be useful to LTO for all languages, to IMA
for C, and, potentially to assembly language programmers directly.

Mark Mitchell
(650) 331-3385 x713

More information about the Binutils mailing list