Peter Maydell <[email protected]> writes:

> On 25 January 2016 at 16:49, Alex Bennée <[email protected]> wrote:
>> If for example you want to use the thread sanitizer you want to ensure all
>> binaries are linked with the library:
>>
>>   ./configure ${TARGETS} --cc=gcc-5 --cxx=g++-5 \
>>     --extra-cflags="-fsanitize=thread" --extra-libs="-ltsan"
>>
>> This is more explicit than just specifying --extra-ldflags which might
>> not get applied in the right place all the time.
>
> When would they differ? The commit message makes this sound like
> it's working around a bug in the code that uses LDFLAGS...

Well LDFLAGS doesn't get applied everywhere so with:

--cc=gcc-5 --cxx=g++-5 --extra-cflags="-fsanitize=thread"
  --extra-ldflags="-ltsan" --with-coroutine=gthread

You get compile failures in the ancillary binaries that are used during
testing.

  LINK  tests/qemu-iotests/socket_scm_helper
tests/qemu-iotests/socket_scm_helper.o: In function `main':
/home/alex/lsrc/qemu/qemu.git/tests/qemu-iotests/socket_scm_helper.c:95: 
undefined reference to `__tsan_func_entry'
/home/alex/lsrc/qemu/qemu.git/tests/qemu-iotests/socket_scm_helper.c:106: 
undefined reference to `__tsan_read8'
/home/alex/lsrc/qemu/qemu.git/tests/qemu-iotests/socket_scm_helper.c:106: 
undefined reference to `__tsan_read8'
...

I think this stems from my confusion from exactly which binaries are
meant to be affected by which flags. QEMU_CFLAGS seems to imply it's
QEMU only, but we don't have a QEMU_LDFLAGS so should LDFLAGS be shared
with all binaries we build?

--
Alex Bennée

Reply via email to