www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Fully statically linked binary

reply Jacob Carlborg <doob me.com> writes:
With LDC it's possible to build a fully statically linked binary using 
the "-static" flag. My question is: is it required to invoke the 
compiler with the "-static" flag or is it enough to invoke the linker 
with the "-static" flag?

I'm not sure if the code generation will be different when doing a fully 
statically linked binary. I think I've read somewhere that different TLS 
models might be used depending on if static or dynamic linking is used.

This is on Linux (and possible on FreeBSD if static linking works there).

-- 
/Jacob Carlborg
Jul 11 2017
parent reply kinke <noone nowhere.com> writes:
On Tuesday, 11 July 2017 at 08:14:59 UTC, Jacob Carlborg wrote:
 With LDC it's possible to build a fully statically linked 
 binary using the "-static" flag. My question is: is it required 
 to invoke the compiler with the "-static" flag or is it enough 
 to invoke the linker with the "-static" flag?
It's only used for linking (in essence, forwarding `-static` to gcc) and doesn't affect the relocation model etc.
Jul 11 2017
parent Jacob Carlborg <doob me.com> writes:
On 2017-07-11 19:40, kinke wrote:

 It's only used for linking (in essence, forwarding `-static` to gcc) and
 doesn't affect the relocation model etc.
Ok, cool, thanks. -- /Jacob Carlborg
Jul 11 2017