
On 07/ 8/17 01:33 AM, Ben Gamari wrote:
8.2 will prefer both gold and lld over bfd ld. However two conditions must hold for these to be used,
* The ld.lld/ld.gold executable must be in $PATH (or explicitly named by passing the LD variable to configure)
* $CC must understand the `-fuse-ld={gold,lld}` option. For (IMHO quite silly) political reasons, gcc doesn't support `-fuse-ld=lld`. Debian happens to patch gcc to add support but I don't know how common this is in other distributions.
Unfortunately, some earlier `gcc` versions didn't fail if given a `-fuse-ld` option that they didn't understand. Sadly we have no reliable way to detect this, so in this case we may end up passing a `-fuse-ld` option that gcc simply ignores.
I've run into this issue too, but it looks like the issue is not in gcc, but in ghc's aclocal.m4 (one '$' missing). Attached patch solves this on OpenBSD 6.1-current where HEAD fails building on linker error. It passes build-id option to the gcc's linker (bfd ld) which does not support it as configure detects lld is presented on this system too. Sorry for not being able to push that through usual arc. Thanks, Karel