Sponsored by: Klara, Inc.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 65086 Build 61969: arc lint + arc unit
Event Timeline
share/mk/bsd.compiler.mk | ||
---|---|---|
302 | No, I'd have to use :Mpowerpc* to catch both. |
I've had a chance to test this while cross-building an aarch64 world and the build failed because it tries to look for the aarch64 address sanitizer library on the host instead of in the object tree:
cc -target aarch64-unknown-freebsd15.0 --sysroot=/usr/obj/usr/src/arm64.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common -DTEST_LONG_DOUBLE -D__HAVE_LONG_DOUBLE -I/usr/src/lib/libc/tests/gen -fPIE -g -gz=zlib -std=gnu17 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-time -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -fsanitize=address -Wl,-zrelro -pie -o realpath2_test.full realpath2_test.pieo -lprivateatf-c ld: error: cannot open /usr/lib/clang/19/lib/aarch64-unknown-freebsd15.0/libclang_rt.asan_static.a: No such file or directory ld: error: cannot open /usr/lib/clang/19/lib/aarch64-unknown-freebsd15.0/libclang_rt.asan.a: No such file or directory cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Stop.
The library does exist (with a different name and in a different location) in the cross-toolchain:
% find /usr/obj/usr/src/arm64.aarch64/tmp -name '*asan*.a' /usr/obj/usr/src/arm64.aarch64/tmp/usr/lib/clang/19/lib/freebsd/libclang_rt.asan-preinit-aarch64.a /usr/obj/usr/src/arm64.aarch64/tmp/usr/lib/clang/19/lib/freebsd/libclang_rt.asan_cxx-aarch64.a /usr/obj/usr/src/arm64.aarch64/tmp/usr/lib/clang/19/lib/freebsd/libclang_rt.asan-aarch64.a /usr/obj/usr/src/arm64.aarch64/tmp/usr/lib/clang/19/lib/freebsd/libclang_rt.asan_static-aarch64.a
For the cross-build error, it seems like clang isn't honoring --sysroot when looking for the libraries. This can be correct in some cases (it would be correct for the LLVM port cross-building a binary as the port should use the sanitizer libs shipped as part of the port). We may want a local patch for the version of LLVM in the base system to honor --sysroot for the sanitizer runtimes though. Perhaps @dim has thoughts?
share/mk/bsd.compiler.mk | ||
---|---|---|
302 | Hmm, then the check for 32-bit arm is wrong (MACHINE_ARCH is armv7). Probably want to test MACHINE_CPUARCH instead for arm. For powerpc you need to also omit powerpcspe, not just plain "powerpc". |