On 2 Jan 2014 19:50, "Martin Nowak" <code@dawg.eu> wrote:
>
> On 01/02/2014 06:38 PM, Iain Buclaw wrote:
>>
>>
>> The D frontend will generate the mangled symbol (and its initialiser) as:
>>
>> _D6mangle18runModuleUnitTestsUZb7Console6opCallMFxAaZSrunModuleUnitTests7Console
>>
>> _DrunModuleUnitTests7Console6__initZ
>>
>> Instead of the more desired:
>>
>> _D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModuleUnitTestsFZb7Console
>>
>> _D18runModuleUnitTest7Console6__initZ
>>
>>
>> Is this desirable? It makes demangling such symbols difficult.
>
>
> I think we should ignore extern(C) when mangling nested symbols.
> But we should obey the calling convention.
> So according to http://dlang.org/abi.html it's UZb instead of FZb.
I should probably rewrite the message as I did it in an awful hurry. ;)
The main point was getting across was that in the normal scheme of mangling it follows the convention in a nutshell:
TypeStruct QualifiedSymbol (Int Symbol) ...
Eg:
S6foobar5inner...
Should 'foobar' be an extern (C) function, then the initial string count is omitted.
Sfoobar5inner
Causing core.demangler to choke on it.
This affects the demangler I've written for gdb as it follows the same rules to parse the mangled string.