If for example you want to use the thread sanitizer you want to ensure all binaries have the extra linker flags applied:
./configure ${TARGETS} --cc=gcc-5 --cxx=g++-5 \ --extra-cflags="-fsanitize=thread" --extra-ldflags="-fsanitize=thread" Or possibly: ./configure ${TARGETS} --extra-cflags="-fsanitize=thread -fPIC" \ --extra-ldflags="-fsanitize=thread -pie" Unlike CFLAGS we don't have a QEMU_LDFLAGS which would be appropriate if we only ever needed to affect ${TARGET} binaries. Signed-off-by: Alex Bennée <alex.ben...@linaro.org> --- v1 - new for v1 - --extra-ldflags alternative to -ltsan - yet another example invocation (gcc 4.9/Gentoo) --- Makefile | 4 ++-- configure | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d0de2d4..d30532f 100644 --- a/Makefile +++ b/Makefile @@ -329,9 +329,9 @@ qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI) endif ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) - $(call LINK, $^) + $(call LINK, $^, $(ldflags)) ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a - $(call LINK, $^) + $(call LINK, $^, $(ldflags)) clean: # avoid old build problems by removing potentially incorrect old files diff --git a/configure b/configure index bd29ba7..148b79a 100755 --- a/configure +++ b/configure @@ -5871,7 +5871,7 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then ldflags="$ldflags $textseg_ldflags" fi -echo "LDFLAGS+=$ldflags" >> $config_target_mak +echo "LDFLAGS+=$ldflags" >> $config_host_mak echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak done # for target in $targets -- 2.7.0