This patch is about compile world with -DWITH_ASAN.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
The problem is found when I was looking at this issue.
Currently, -DWITH_ASAN cannot compile successfully before and after this patch.
After applying this patch, the error becomes:
ld: error: duplicate symbol: hexdump >>> defined at sanitizer_common_interceptors.inc:10361 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:10361) >>> asan_interceptors.o:(__interceptor_hexdump) in archive /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/clang/16/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at mpsutil.c:166 (/usr/src/usr.sbin/mpsutil/mpsutil.c:166) >>> mpsutil.o:(.text+0x1350)
I think this is because userland has their own hexdump and also hexdump is a library call catched by asan.
I have no idea how to fix it. Maybe add blacklist on program defined their hexdump?
Hope anyone can give me some idea. Thanks!
Add/copy more details here, in https://github.com/llvm/llvm-project/issues/65532#issuecomment-1754817792 , when building with:
make -DWITH_ASAN -DWITH_UBSAN KERNCONF=GENERIC-NODEBUG buildworld buildkernel -j4
The error message is:
ld: error: cannot open /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/clang/16/lib/freebsd/libclang_rt.asan_static-x86_64.a: No such file or directory
I think it's reasonable to have this patch, and revise the interception of hexdump on FreeBSD?
https://github.com/llvm/llvm-project/commit/b4c840e70b630532325267a3dd81550569c5f0f9
https://reviews.llvm.org/D110471
ld: error: cannot open /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/clang/16/lib/freebsd/libclang_rt.asan_static-x86_64.a: No such file or directory
libclang_rt.asan_static.a is linked when linking an executable (i.e. no -shared). This patch looks reasonable.
clang/16/lib/freebsd/libclang_rt.asan_static-x86_64.a instead of clang/16/lib/$triple/libclang_rt.asan_static.a indicates that FreeBSD does not use LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on. FreeBSD may want to change it. See https://reviews.llvm.org/D140011
Yes, looks reasonable.
Yes, this is on one of my long TODO lists. I will get to it at some point... :)