Thread overview
Fully statically linked binary
Jul 11, 2017
Jacob Carlborg
Jul 11, 2017
kinke
Jul 11, 2017
Jacob Carlborg
July 11, 2017
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
July 11, 2017
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.
July 11, 2017
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