mold
mold copied to clipboard
building with asan broken?
Trying to do an ASAN build of a project that builds its own internal tools for use in the build process seems broken. Easy example here would be to try building mesa with Intel drivers and ASAN enabled: there is an internal mesa_clc utility built which is then invoked later in build. With mold, however invoking mesa_clc errors because the ASAN runtime isn't correctly preloaded.
Do you mind if I ask you to provide a step-by-step instruction to reproduce your issue? I haven't built mesa myself, and it'd be hard to try to reproduce it without your help.
There are comprehensive build instructions here which include dependency info. For the meson configure step, something like meson . build -Dvulkan-drivers=intel -Dgallium-drivers= -Db_sanitize=address is probably sufficient.
Mike CCed me about this issue. Here's the full setup command line I used to get a repro:
meson setup build --buildtype debugoptimized -Db_sanitize=address -Db_lundef=false -Dgallium-drivers= -Dvulkan-drivers=intel -Dmesa-clc=enabled
ninja -C build
The compiler should be GCC. The issue didn't repro with Clang ASan.
FAILED: src/intel/shaders/intel_gfx120_shaders.spv
/tmp/mesa/build/src/compiler/clc/mesa_clc ../src/intel/shaders/libintel_shaders.h ../src/intel/shaders/generate.cl ../src/intel/shaders/generate_draws.cl ../src/intel/shaders/generate_draws_iris.cl ../src/intel/shaders/query_copy.cl ../src/intel/shaders/util.cl -o src/intel/shaders/intel_gfx120_shaders.spv --depfile src/intel/shaders/intel_gfx120_shaders.spv.d -- -DNDEBUG=1 -DGFX_VERx10=120 -I/tmp/mesa/src/intel/shaders/. -I/tmp/mesa/src/compiler/libcl -I/tmp/mesa/src -I/tmp/mesa/src/intel -I/tmp/mesa/build/src/intel -I/tmp/mesa/src/intel/genxml
==1025702==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD
If you get a spirv-tools error, just comment it out. It is OK to bypass the check for reproing the issue.
diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
index 263eba5..3fa1837 100644
--- a/src/compiler/clc/meson.build
+++ b/src/compiler/clc/meson.build
@@ -91,7 +91,7 @@ has_spirv_link_workaround = cpp.has_member(
dependencies : dep_spirv_tools,
)
if dep_llvm.version().version_compare('>= 17.0') and not has_spirv_link_workaround
- error('SPIRV-Tools doesn\'t contain https://github.com/KhronosGroup/SPIRV-Tools/pull/5534\n')
+ # error('SPIRV-Tools doesn\'t contain https://github.com/KhronosGroup/SPIRV-Tools/pull/5534\n')
endif
if has_spirv_link_workaround
I think this is a duplicate of https://github.com/rui314/mold/issues/1415.