Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
GNU ld appears to have such a behavior but I am not sure ld.lld ever has a need for this.
In addition, ld.lld doesn't support various emulations available in ld.bfd but we seem to live well without that.
The inferred default emulation seems to work in almost all cases.
@MaskRay The use case which led to this for me is building gmp. Its configure script uses ld --help to look for the auto-import string to determine if the linker supports shared linking, which doesn't work as the linker defaults to the elf driver. With this patch, I can just set LDEMULATION for the build and have configure detect correctly.
Note that in nixpkgs we already do set LDEMULATION in our builds, it's just been ignored by lld up until now.
FWIW the default build of gmp works with lld and that's many distributions are already using.
If there is a missing feature, ISTM the right way is to fix the gmp build system.
Many linkers don't have the emulation concept of GNU ld. They just provide some simulation and that simulation works quite well in practice (tens of thousands of FreeBSD / Gentoo packages are buildable without LDEMULATION).
Ah to be clear I only see this issue when cross-compiling to Windows with shared libs. I'd be curious to see how other setups are successfully doing that with gmp's build system.
Anyway will close if this is not wanted.