This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Does gcc conform to C++ ABI?


On Fri, Feb 13, 2009 at 11:05 AM, Ian Lance Taylor <iant@google.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> It may be a known issue. Does gcc follow Section 5.1.6 Scope Encoding
>> in C++ ABI:
>>
>> http://www.codesourcery.com/public/cxx-abi/abi.html#mangling
>>
>> I tried the example. But it won't compile. I changed it to:
>>
>> [hjl@gnu-6 tmp]$ cat x.cc
>>   namespace N {
>>       inline char f(int i) {
>>          static const char *p = "Itanium C++ ABI";  // p = 1, "..." = 2
>>          {  struct X {                      // X = 3
>>                void g() {}
>>             };   }
>>          return p[i];
>>       }
>>       char
>>       foo (int i)
>>       {
>>         return f (i);
>>       }
>>    }
>> [hjl@gnu-6 tmp]$ gcc -c x.cc
>> [hjl@gnu-6 tmp]$ nm x.o
>> 0000000000000000 W _ZN1N1fEi
>> 0000000000000000 T _ZN1N3fooEi
>> 0000000000000000 V _ZZN1N1fEiE1p
>>                  U __gxx_personality_v0
>> [hjl@gnu-6 tmp]$ nm x.o | c++filt
>> 0000000000000000 W N::f(int)
>> 0000000000000000 T N::foo(int)
>> 0000000000000000 V N::f(int)::p
>>                  U __gxx_personality_v0
>> [hjl@gnu-6 tmp]$
>>
>> It doesn't
>>
>> "_ZZN1N1fEiEs": encoding of N::f::"Itanium C++ ABI" (no discriminator)
>
> The discriminator is optional and is up to the discretion of the
> compiler.  This doesn't matter for interoperability purposes, because
> such names can not be referenced from other translation units anyhow.

If it isn't optional, tools can't depend on it. I was wondering
how useful it was.

Another issue for scope encoding. C++ ABI:

---
Occasionally entities in local scopes must be mangled too
(e.g. because inlining or template compilation causes multiple
translation units to require access to that entity).
---

seems to imply that the local symbols may have external
linkage. Am I wrong?


> What do you think the symbol name should be?
>

Isn't it specified in C++ ABI?


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]