--gc-sections and GDC

David Nadlinger via D.gnu d.gnu at puremagic.com
Thu Jul 17 04:29:56 PDT 2014


On Wednesday, 16 July 2014 at 20:05:37 UTC, Johannes Pfau wrote:
> Please don't start working on a D specific linker script, cause 
> I'm already working on that ;-) I've only done moduleinfo so 
> far, but TLS is next, then shared library support.

Instead of a fully custom linker script, I'd go for extending the 
existing one using the INSERT AFTER/BEFORE commands. This way, 
there should be less potential for breaking any weird 
system-specific stuff. Within limits, such a script would also 
work fine with any custom scripts some weird C libraries might be 
using.

But still, the problem of making this transparent to the user 
remains. There is a bit of trickery you can do with implicit 
linker script, but ultimately I couldn't get it to behave nicely, 
i.e. be consistently linkable using "gcc".

In the end, this seemed far more troublesome than just working 
around the problem, especially since you have to make it work on 
all platforms. Even if you restrict yourself to common x86_64 
Linux distros, you have to support various versions of both 
ld.bfd and ld.gold, and the latter doesn't natively use linker 
scripts (there is an emulation layer, which mostly works, but 
seemed to behave slightly differently in my tests).

David


More information about the D.gnu mailing list