Date: Tue, 30 Aug 2022 20:29:36 -0700 From: Mark Millard <marklmi@yahoo.com> To: FreeBSD Toolchain <freebsd-toolchain@freebsd.org> Subject: /usr/local/bin/aarch64-unknown-freebsd14.0-ld vs. system the system toolchain on aarch64 [example]: when found, lld is not used by default Message-ID: <F75F12BA-3405-495F-AA80-D09DCC143A4C@yahoo.com> References: <F75F12BA-3405-495F-AA80-D09DCC143A4C.ref@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
(This happens to be an aarch64 context and example. But is not actually limited to aarch64 or to arm* --and so on. Similarly, I expect, it is not limited to main [so: 14].) I just ran into the following trying to locally build some = standard-C++20 code via the system-toolchain on main. Note the aarch64-binutils ( devel/freebsd-binutils@aarch64 ) related path that automatically shows up, despite not being requested: /usr/local/bin/aarch64-unknown-freebsd14.0-ld Its use, mixed with a deliberate attempt to use LTO, in turn attempts to use /usr/bin/../lib/LLVMgold.so --which is not found, breaking the = build. Plus, I did not request anything but the system ld to be used, so the attempt to use /usr/local/bin/aarch64-unknown-freebsd14.0-ld looks to be just wrong, independent of LTO being involved in my build. The failing command: clang++ -v -std=3Dc++20 -Wpedantic -Wall -Wextra -I../other_src_used = -pedantic -g3 -O3 -mcpu=3Dcortex-a72 -flto=3Dthin -pthread -flto=3Dthin = ../objs/cpp_thousandslocale-clang++_14_O3lto-libc++.o = ../objs/cpp_clockinfo-clang++_14_O3lto-libc++.o -o = ../cpp_clockinfo_main-HoneyComb-65536MiB-threads_16-LP64-FreeBSD_main_n256= 584_5bc926af9fd1_64bit-clang++_14_O3lto-libc++ = -DCPPCLOCKINFO_VERS=3D'"acpphint_0.1.24"' = ../other_src_used/cpp_clockinfo_main.cpp FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git = llvmorg-14.0.5-0-gc12386ae247c) Target: aarch64-unknown-freebsd14.0 Thread model: posix InstalledDir: /usr/bin "/usr/bin/clang++" -cc1 -triple aarch64-unknown-freebsd14.0 = -emit-llvm-bc -flto=3Dthin -flto-unit -disable-free = -clear-ast-before-backend -disable-llvm-verifier -discard-value-names = -main-file-name cpp_clockinfo_main.cpp -mrelocation-model static = -mframe-pointer=3Dnon-leaf -ffp-contract=3Don -fno-rounding-math = -mconstructor-aliases -funwind-tables=3D2 -target-cpu cortex-a72 = -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon = -target-feature +crc -target-feature +crypto -target-feature +sha2 = -target-feature +aes -target-abi aapcs = -fallow-half-arguments-and-returns -mllvm = -treat-scalable-fixed-error-as-warning -debug-info-kind=3Dstandalone = -dwarf-version=3D4 -debugger-tuning=3Dgdb -v = -fcoverage-compilation-dir=3D/root/acpphint/acpphint_src -resource-dir = /usr/lib/clang/14.0.5 -I ../other_src_used -D = "CPPCLOCKINFO_VERS=3D\"acpphint_0.1.24\"" -internal-isystem = /usr/include/c++/v1 -O3 -Wpedantic -Wall -Wextra -pedantic -std=3Dc++20 = -fdeprecated-macro -fdebug-compilation-dir=3D/root/acpphint/acpphint_src = -ferror-limit 19 -pthread -fno-signed-char -fgnuc-version=3D4.2.1 = -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics = -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=3D1 = -o /tmp/cpp_clockinfo_main-56273f.o -x c++ = ../other_src_used/cpp_clockinfo_main.cpp clang -cc1 version 14.0.5 based upon LLVM 14.0.5 default target = aarch64-unknown-freebsd14.0 #include "..." search starts here: #include <...> search starts here: ../other_src_used /usr/include/c++/v1 /usr/lib/clang/14.0.5/include /usr/include End of search list. "/usr/local/bin/aarch64-unknown-freebsd14.0-ld" --eh-frame-hdr = -dynamic-linker /libexec/ld-elf.so.1 --enable-new-dtags -o = ../cpp_clockinfo_main-HoneyComb-65536MiB-threads_16-LP64-FreeBSD_main_n256= 584_5bc926af9fd1_64bit-clang++_14_O3lto-libc++ /usr/lib/crt1.o = /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -plugin = /usr/bin/../lib/LLVMgold.so -plugin-opt=3Dmcpu=3Dcortex-a72 = -plugin-opt=3DO3 -plugin-opt=3Dthinlto = ../objs/cpp_thousandslocale-clang++_14_O3lto-libc++.o = ../objs/cpp_clockinfo-clang++_14_O3lto-libc++.o = /tmp/cpp_clockinfo_main-56273f.o -lc++ -lm -lgcc --as-needed -lgcc_s = --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed = /usr/lib/crtend.o /usr/lib/crtn.o /usr/local/bin/aarch64-unknown-freebsd14.0-ld: = /usr/bin/../lib/LLVMgold.so: error loading plugin: Cannot open = "/usr/bin/../lib/LLVMgold.so" clang++: error: linker command failed with exit code 1 (use -v to see = invocation) *** Error code 1 A workaround is to explicitly use -fuse-ld=3Dlld . =3D=3D=3D Mark Millard marklmi at yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F75F12BA-3405-495F-AA80-D09DCC143A4C>