<p dir="ltr"><br>
On 30 Nov 2014 09:20, "Johannes Pfau via D.gnu" <<a href="mailto:d.gnu@puremagic.com">d.gnu@puremagic.com</a>> wrote:<br>
><br>
> Am Sun, 30 Nov 2014 01:52:57 +0000<br>
> schrieb "Mike" <<a href="mailto:none@none.com">none@none.com</a>>:<br>
><br>
> > This has been brought up before:<br>
> > [1]<br>
> > <a href="http://forum.dlang.org/post/cqzazaqxpwezignixuds@forum.dlang.org">http://forum.dlang.org/post/cqzazaqxpwezignixuds@forum.dlang.org</a><br>
> > [2]<br>
> > <a href="http://forum.dlang.org/post/zapxhodqmotriapuefvm@forum.dlang.org">http://forum.dlang.org/post/zapxhodqmotriapuefvm@forum.dlang.org</a><br>
> ><br>
> > But I'd like to know what GDC's long term plans are to enable<br>
> > removing dead code from executables.<br>
> ><br>
> > (1) Adding a D-specific linker script in GDC that gets<br>
> > automagically passed to the linker?<br>
><br>
> AFAIK that's almost impossible. You can't replicate the complete linker<br>
> scripts for all architectures with all their special cases etc. It<br>
> could be possible to place all ModuleInfos in a special section then<br>
> pass a implicit linker script which extends the standard script and<br>
> only handles this section.<br>
><br>
> > (2) Adding a D-specific linker script to binutils?<br>
> > (3) LTO in GCC/binutils?<br>
><br>
> LTO is certainly a long-time (though low priority) goal. AFAIK it's<br>
> mostly about speed optimization though, not size.<br>
><br>
> > (2) sounds a little weird, but I got the impression from<br>
> > discussion [1] that that was part of the plan. I don't<br>
> > understand why binutils should have to know about D's codegen,<br>
> > but there's a lot of things I don't understand.<br>
><br>
> The linker scripts also know about some details of the C/C++ codegen.<br>
> For example attribute(constructor) needs support from linker scripts.<br>
> (KEEP, SORT_NONE, PROVIDE_HIDDEN or similar) Without this support<br>
> constructor calls would be eliminated by these optimization flags as<br>
> well. So it's kinda reasonable.<br>
></p>
<p dir="ltr">To contrast with another young language. Go/Android has linker support in binutils when I last looked. Heck, Go runtime even has Linux kernel support code somewhere (though I don't think the core Linux devs liked it).</p>