--gc-sections and GDC

Daniel Murphy via D.gnu d.gnu at puremagic.com
Thu Jul 17 03:32:35 PDT 2014


"Mike"  wrote in message news:cqzazaqxpwezignixuds at forum.dlang.org...

> If my theory is correct, GDC may have to make an internal linker script 
> specifically for D's code generation that marks such code as KEEP.

There was some discussion of this at dconf, and a custom linker script is 
both straightforward and correct.

However, it is non-portable (AIUI) and non-scalable (ie you can't link with 
c/c++ code that has its own custom linker script).

An alternative solution was to emit dummy references to the D symbols (that 
would otherwise be marked with KEEP) from one of the existing KEEP sections. 
(eg init_array)

This is what LDC is already using and what was attempted with DMD.

It may be possible to do in a nice way with linker scripts, but I would not 
personally go down that road.  I know others on here have a better 
understandings of this area and might be able to find a way. 



More information about the D.gnu mailing list