If I build curl with gold, I can't use it. spotify
/opt/spotify/spotify-client/spotify: /usr/lib64/libcurl.so.4: versionCURL_GNUTLS_3' not found (required by /opt/spotify/spotify-client/spotify)` With bfd no problem.
is known by almost everybody , patchelf and curl cant be linked with ld.gold , use ld.bfd instead if you want spotify to work
Yes, I do it. But at the moment I build everything with the bfd-linker.
not me i built everything with ld.gold linker , clang things with ld.lld
Back from the honeymoon now and back into GentooLTO. Looking into this.
OK -- can confirm -fuse-ld=bfd fixes it. I'll check the ebuild to see if it can be worked around there.
In general, I'd advise to use ld.bfd or ld.lld as ld.gold has bugs and is not really maintained now.
Does ld.lld support LTO plugins yet?
Does
ld.lldsupport LTO plugins yet?
I use it system-wide on clang/musl/libstdc++ with thin lto and without gcc or binutils:
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -march=native -O3 -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ -Wl,-lto-O3 -Wl,--build-id -Wl,--error-limit=0 -Wl,--icf=all -Wl,--thinlto-jobs=8 -Wl,--threads"
You said there is a graphite-like clang lib option, maybe I can try this too.
Yeah, AFAIK ld.lld does LTO just fine for Clang, but not via the same plugin mechanism GCC uses. I know it supports the --plugin option, but it seemed like last time I checked it was ignored for compatibility (i.e it would accept the option to not error out, but wouldn't actually do anything with it). It's too bad, because I'd love to try it out.
Despite using it system-wide for a while, I have been losing faith in Gold as well. Between being rarely used (leading to nothing being tested with it) and being hardly worked on as well, likely will just keep running into new issues with little to show for it (Edit: well, gold does produce generally slightly smaller binaries than bfd still -- but I went back to bfd anyway, lld sounds nice if ever switch to clang but I'm personally not doing that anytime soon except for some select packages).
Based on what has been said here and some more digging around, it sounds like we should revert back to ld.bfd for GentooLTO default. It looks like Google has basically abandoned GCC and is focusing nearly all their efforts on LLVM and friends, which is a real shame. If no bugs we find will be fixed upstream in ld.gold, it makes the effort kind of moot.
I'll make it official today and switch my own system back over to ld.bfd, and close this issue when I do so.
OK, we are back on ld.bfd by default now.
Most helpful comment
Based on what has been said here and some more digging around, it sounds like we should revert back to
ld.bfdfor GentooLTO default. It looks like Google has basically abandoned GCC and is focusing nearly all their efforts on LLVM and friends, which is a real shame. If no bugs we find will be fixed upstream inld.gold, it makes the effort kind of moot.