Fix ASan build on FreeBSD#10
Conversation
Introduce two fixes to CMake to support ASan-enabled builds on FreeBSD: 1. Move add_subdirectory(test) inside if(LUAJIT_USE_TEST) block. Previously, the test directory was configured unconditionally even when LUAJIT_USE_TEST was OFF, wasting configuration time and potentially triggering errors in the test setup. 2. Skip libstdc++ LD_PRELOAD workaround on FreeBSD. The workaround for google/sanitizers#934 assumes GCC's libstdc++, but FreeBSD uses LLVM's libc++ and doesn't require this workaround. Signed-off-by: Vladimir Krivopalov <argenet@yandex.ru>
|
Hi @Buristan, I looked at another PR currently opened in this repo and found you reply that patches for Tarantool's LuaJIT should go into the mailing list. |
|
Hi, Vladimir! Patch LGTM, but I ask for a minor fixup: to separate it into 2 commits: You may then send the patchset to the mailing lists like the following: git format-patch --cover-letter --thread=shallow --subject-prefix="PATCH luajit" HEAD~2
# Update 0000-cover-letter.patch header and description.
git send-email --cc=tarantool-patches@dev.tarantool.org --to="Sergey Kaplun <skaplun@tarantool.org>" --to="Sergey Bronnikov <sergeyb@tarantool.org>" 000*Before using For mail.ru (or yandex.ru with the corresponding changes) users, the configuration will be slightly different: |
This MR fixes LuaJIT ASan-instrumented builds on FreeBSD, which currently fail with:
Two issues combine to cause this failure:
add_subdirectory(test)is called unconditionally in the rootCMakeLists.txt, even whenLUAJIT_USE_TEST=OFF.This means test configuration runs regardless of whether tests are needed.
LUAJIT_USE_ASAN=ON,test/LuaJIT-tests/CMakeLists.txtsearches forlibstdc++.soto set up anLD_PRELOADworkaround for AddressSanitizer CHECK failed: ../../../sanitizer/asan/asan_interceptors.cc:384 "((__interception::real___cxa_throw)) when using --as-needed and dynamically loaded .so google/sanitizers#934. This workaround is GCC-specific, but FreeBSD uses clang withlibc++, notlibstdc++.Verified on FreeBSD 15.0 with clang 19: