Removing RTTI from binaries
Mike via D.gnu
d.gnu at puremagic.com
Wed Jan 14 01:04:45 PST 2015
On Wednesday, 14 January 2015 at 08:42:55 UTC, Iain Buclaw via
D.gnu wrote:
> On 14 January 2015 at 04:00, Mike via D.gnu
> <d.gnu at puremagic.com> wrote:
>> On Tuesday, 13 January 2015 at 14:36:15 UTC, Dicebot wrote:
>>>
>>>
>>> I remember speaking about it with Martin and Daniel during
>>> DConf 2014 and
>>> I think it was Daniel who mentioned that by default
>>> TypeInfo/ModuleInfo is
>>> emitted in some weird packed way. When LDC announced using
>>> --gc-sections by
>>> default it was mentioned they had to change ModuleInfo
>>> emitting to make it
>>> actually work.
>>>
>>> Can it be the same issue?
>>
>>
>> Thanks, Dicebot, for bringing this to my attention. That would
>> explain what I'm seeing.
>>
>> Is this something unique to GDC, or is it an artifact inherited
>> from DMD?
>>
>> Mike
>
> It's an artifact inherited from DMD.
>
> ModuleInfo is of a dynamic size, depending on what is
> implemented in the module.
>
> See:
> https://github.com/D-Programming-Language/druntime/blob/081591237ee7d666ffd81463dac1b7f38e7d9798/src/object_.d#L1589
>
> However it's size is correctly recorded before being sent to be
> written.
>
> The ModuleInfo symbols themselves aren't put into any particular
> section, they also can't go in rodata because of how the D
> runtime
> start-up works, so they end up in the same section as __gshared
> data.
>
> The same is also true with TypeInfo_Class (alias ClassInfo)
> where
> interface vtables are written packed immediately after the data
> structure ends. Again, it's size is treated as dynamic and is
> correctly recorded before being written, and again it cannot be
> in
> rodata because the __monitor field is directly written to.
>
Ok, but I have a mess of classes generated by templates (and I
love it). Their `name` properties [1] should go in .rodata,
right? But why aren't they being put in their own sections when
compiling with -fdata-sections?
[1] -
https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/object_.d#L81
Mike
More information about the D.gnu
mailing list