[cxx-abi-dev] Re: Mistake in C++ ABI substitution rules?

Christophe de Dinechin ddd at cup.hp.com
Sun Feb 24 07:15:33 UTC 2002


Mark,


I believe that the "may" here (and the whole sentence) was intended to 
cover the internal data structures used for mangling, rather than the 
result. In other words, the result must be compressed ("If a component 
has been encountered, it IS substituted as described below"). But the 
spec doesn't force you to recognize the structure internally ahead of 
time.

As I remember it, an ordering problem arose when we discussed 
implementations. For instance, aCC has a unique internal "type token" 
that it builds quite early. We wanted to make it possible for aCC to use 
the type token as the key in the dictionary, which would correspond to 
the optimization of "considering large structures for substitution 
before their components". But we did not want to impose such a "type 
token" on other compilers just for mangling reasons.


Regards,
Christophe

On Wednesday, February 20, 2002, at 06:42 AM, Mark Mitchell wrote:

> Stan --
>
>  I've forwarded your mail to the C++ ABI mailing list:
>
>    cxx-abi-dev at codesourcery.com
>
> --On Tuesday, February 19, 2002 02:42:02 PM -0800 Stan Shebs 
> <shebs at apple.com> wrote:
>
>> One of our tasks in migrating Darwin / Mac OS X to use GCC 3.x is
>> to provide a way to load I/O drivers written in C++ and compiled
>> with GCC 2.95.  (Yeah yeah, bad idea, but the deed is done, and
>> alternative is to compile the kernel's I/O subsystem with 2.95
>> forever, I'll work hard to avoid that fate.)
>>
>> Anyway, to translate the symbols we have a homemade 2.95 compat
>> demangler (written using a spec I handed to the kernel hacker,
>> poor guy) feeding into a remangler written using the spec at
>> http://www.codesourcery.com/cxx-abi/abi.html#mangling.  So far
>> so good, we have something that actually does the right thing
>> most of the time.  However, there is a troublesome point in the
>> substitution rules for the new C++ ABI, where it says
>>
>> "Logically, the substitutable components of a mangled name are
>> considered left-to-right, components before the composite structure
>> of which they are a part. If a component has been encountered
>> before, it is substituted as described below. This decision is
>> independent of whether its components have been substituted,
>> so an implementation MAY OPTIMIZE by considering large structures
>> for substitution before their components. If a component has not
>> been encountered before, its mangling is identified, and it is
>> added to a dictionary of substitution candidates. No entity is
>> added to the dictionary twice." (emphasis mine)
>
> I think that "may" should be "must".
>
> Thoughts?
>
> --
> Mark Mitchell                   mark at codesourcery.com
> CodeSourcery, LLC               http://www.codesourcery.com
>
>




More information about the cxx-abi-dev mailing list