In recent versions, enabling use_thin_lto causes a new linker flag to be
added, which as far as I've seen, Clang <= 15 doesn't recognize. (I have
not tested >= 16)
This is the build error I've observed:
[2789/56743] SOLINK ./libvulkan.so.1
FAILED: libvulkan.so.1 libvulkan.so.1.TOC
"python3" "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf"
--nm="nm" --sofile="./libvulkan.so.1" --tocfile="./libvulkan.so.1.TOC"
--output="./libvulkan.so.1" -- clang++ -shared -Wl,-soname="libvulkan.so.1"
-fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack
-Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics
-Wl,-mllvm,-instcombine-lower-dbg-declare=0 -flto=thin -Wl,--thinlto-jobs=all
-Wl,--thinlto-cache-dir=thinlto-cache
-Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000
-Wl,-mllvm,-import-instr-limit=30 -Wl,-mllvm,-disable-auto-upgrade-debug-info
-fwhole-program-vtables -Wl,--undefined-version
-Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2
-Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,--lto-O0
-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--stats -o
"./libvulkan.so.1" @"./libvulkan.so.1.rsp"
ld.lld: error: -mllvm: ld.lld: Unknown command line argument
'-disable-auto-upgrade-debug-info'. Try: '/usr/bin/ld.lld --help'
ld.lld: Did you mean '--disable-arm-parallel-dsp'?
clang++: error: linker command failed with exit code 1 (use -v to see
invocation)
The following patch fixes the issue:
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -726,14 +726,6 @@ config("compiler") {
}
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
-
- if (!is_chromeos) {
- # TODO(https://crbug.com/972449): turn on for ChromeOS when that
- # toolchain has this flag.
- # We only use one version of LLVM within a build so there's no need to
- # upgrade debug info, which can be expensive since it runs the
verifier.
- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ]
- }
}
# TODO(https://crbug.com/1211155): investigate why this isn't effective on
--Daniel
--
Daniel Richard G. || [email protected]
My ASCII-art .sig got a bad case of Times New Roman.