<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Mesa fails to build with gcc address sanitizer (-fsanitize=address -lasan)"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100120#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Mesa fails to build with gcc address sanitizer (-fsanitize=address -lasan)"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100120">bug 100120</a>
              from <span class="vcard"><a class="email" href="mailto:emil.l.velikov@gmail.com" title="Emil Velikov <emil.l.velikov@gmail.com>"> <span class="fn">Emil Velikov</span></a>
</span></b>
        <pre>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"</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>