[Mesa-dev] [Bug 100120] Mesa fails to build with gcc address sanitizer (-fsanitize=address -lasan)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Mar 13 17:43:10 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=100120

--- Comment #10 from Emil Velikov <emil.l.velikov at gmail.com> ---
Right, if we set CFLAGS/CC or friends at autogen.sh/configure stage interacts
strange with the test in configure - now sure who's to "blame" there.

On the other hand, overriding the CC/CXX at make times proves of little worth
since, the compiler (seems deliberately) leaves out the -lasan link (be that
static or shared).

Overriding LDFLAGS="-Wl,-fsanitize=address" makes things even worse since a)
the static objects (nouveau compiler, gen_matypes) error at link time, and as
we side stepping this, a ton of nir related unresolved symbols even on targets
which do not use NIR. Plus we still get the unresolved asan symbols.


For example:
$ ../autogen.sh --without-dri-drivers --without-vulkan-drivers --disable-egl
--disable-gbm --disable-gles1 --disable-gles2
--with-gallium-drivers=nouveau,swrast --disable-vdpau --disable-xvmc
--disable-va --enable-nine

$ make V=1 CC="gcc -fsanitize=address" CXX="g++ -fsanitize=address"
LDFLAGS="-Wl,-fsanitize=address" LIBS="-lasan"


.../src/gallium/auxiliary/.libs/libgallium.a(tgsi_to_nir.o): In function
`nir_build_imm':
.../src/compiler/nir/nir_builder.h:196: undefined reference to
`nir_load_const_instr_create'
.../src/gallium/auxiliary/.libs/libgallium.a(tgsi_to_nir.o): In function
`nir_builder_instr_insert':
.../src/compiler/nir/nir_builder.h:65: undefined reference to
`nir_instr_insert'
.../src/gallium/auxiliary/.libs/libgallium.a(tgsi_to_nir.o): In function
`nir_imov_alu':

and so on.

Hence I'm thinking about:
 - why/how we don't get the NIR related issues w/o the sanitizer ? Seems like
gcc/clang is having some strange change of behaviour.
 - we might want to track and build the ttn (tgsi to nir) parts only as needed,
but it will be very fragile
 - gcc/clang should really have a way to pull the asan symbols into the final
object without the special LIBS="-lasan"

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170313/833deaf0/attachment.html>


More information about the mesa-dev mailing list