Removing RTTI from binaries

Johannes Pfau via D.gnu d.gnu at puremagic.com
Thu Jan 15 04:01:04 PST 2015


Am Thu, 15 Jan 2015 11:42:30 +0000
schrieb "Dicebot" <public at dicebot.lv>:

> On Thursday, 15 January 2015 at 11:04:37 UTC, Mike wrote:
> > If you can explain the mechanics causing this, please enlighten 
> > me.  Bug? Enhancement? By design?
> 
> Random guess: can it possibly confuse template-based variadics 
> with runtime variadics? Latter require RTTI to work. If something 
> like that happens it is surely a bug.
> 
> I don't see any obvious legitimate reason for this behavior.

That'd be quite weird.

My best guess is that the strings are always placed in rodata, never in
separate sections. If you do write("x"), "x" is also in rodata, the
rodata section can't be removed. If you delete the write call there's
no reference to rodata and it's possible to remove the complete
section.

After some google-fu:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=192
Considering this was filed in 2000 I'd say it's not very likely to get
fixed soon :-(

So the best option is probably to get rid of this problem by patching
the compiler (@notypeinfo or -fnortti).


More information about the D.gnu mailing list