Choosing a non-default linker for dmd (via dub)

Jacob Carlborg doob at me.com
Wed Jul 15 11:38:47 UTC 2020


On 2020-07-12 18:36, Per Nordlöw wrote:
> The line
> 
> dflags "-linker=gold" platform="linux-ldc" # use GNU gold linker
> 
> in dub.sdl
> 
> enables me to change linker for LDC.
> 
> Is it possible to choose a specific linker for DMD aswell in a similar way?
> 
> I only find the flag `-L` that sets flags but no linker executable.
> 
> One way is to link
> 
>      /usr/bin/ld
> 
> to either
> 
>      /usr/bin/ld.gold
> 
> or
> 
>      /usr/bin/ld.lld
> 
> but it would be nice to be able to do this from the dub.sdl or the 
> command-line call to dub.

There's an environment variable "CC" that can be used to select which C 
compiler is used. Is there any equivalence for selecting the linker, 
"LD" perhaps?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list