Open clan opened 1 year ago
in commit 6f532b72c85e38880cf7953098bb91e8f3feb696, when compile program w/ thinLTO and ld.bfd, it said:
LLVM's thinLTO only works with gnu gold, lld, lld-link, and ld64, not ld.bfd.
I did a test, does it mean that thinLTO is supported by ld.bfd now? Thanks.
int main() { return 0; }
0beab180c1e2b39ed9f03c8542e9250f /usr/bin/x86_64-pc-linux-gnu-ld 0beab180c1e2b39ed9f03c8542e9250f /usr/bin/x86_64-pc-linux-gnu-ld.bfd 927de201606fa7dc40434e6a6564dbda /usr/bin/x86_64-pc-linux-gnu-ld.gold
clang version 13.0.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/13/bin Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/lib/llvm/13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-llvm-bc -flto=thin -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name a.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/var/tmp/portage -resource-dir /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1 -internal-isystem /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/var/tmp/portage -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/a-ed3c17.o -x c a.c clang -cc1 version 13.0.1 based upon LLVM 13.0.1 default target x86_64-pc-linux-gnu ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/include" ignoring nonexistent directory "/include"
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1/include /usr/include End of search list. "/usr/bin/x86_64-pc-linux-gnu-ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/llvm/13/bin/../lib -L/lib -L/usr/lib -plugin /usr/lib/llvm/13/bin/../lib64/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=thinlto /tmp/a-ed3c17.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crtn.o
That looks like you’re using gold to me
in commit 6f532b72c85e38880cf7953098bb91e8f3feb696, when compile program w/ thinLTO and ld.bfd, it said:
LLVM's thinLTO only works with gnu gold, lld, lld-link, and ld64, not ld.bfd.
I did a test, does it mean that thinLTO is supported by ld.bfd now? Thanks.
cat a.c
int main() { return 0; }
md5sum /usr/bin/x86_64-pc-linux-gnu-ld*
0beab180c1e2b39ed9f03c8542e9250f /usr/bin/x86_64-pc-linux-gnu-ld 0beab180c1e2b39ed9f03c8542e9250f /usr/bin/x86_64-pc-linux-gnu-ld.bfd 927de201606fa7dc40434e6a6564dbda /usr/bin/x86_64-pc-linux-gnu-ld.gold
clang -v -flto=thin a.c
clang version 13.0.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/13/bin Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/lib/llvm/13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-llvm-bc -flto=thin -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name a.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/var/tmp/portage -resource-dir /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1 -internal-isystem /usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/var/tmp/portage -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/a-ed3c17.o -x c a.c clang -cc1 version 13.0.1 based upon LLVM 13.0.1 default target x86_64-pc-linux-gnu ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/include" ignoring nonexistent directory "/include"
include "..." search starts here:
include <...> search starts here:
/usr/lib/llvm/13/bin/../../../../lib/clang/13.0.1/include /usr/include End of search list. "/usr/bin/x86_64-pc-linux-gnu-ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/llvm/13/bin/../lib -L/lib -L/usr/lib -plugin /usr/lib/llvm/13/bin/../lib64/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=thinlto /tmp/a-ed3c17.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/crtn.o