configure: fix --enable-fuzzing linker failures
PATCH 1/1 configure: fix --enable-fuzzing linker failures
With --enable-fuzzing, QEMU_CFLAGS include -fsanitize=fuzzer-no-link. This should allow us to build non-fuzzer binaries using objects instrumented for fuzzing. However, to do that, we also need to link with -fsanitize=fuzzer-no-link. We were not doing that.
--- configure | 1 + 1 file changed, 1 insertion(+)
configure +1 -0
@@ -6097,6 +6097,7 @@ if test "$fuzzing" = "yes" ; then # needed CFLAGS have already been provided if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" + QEMU_LDFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer" else FUZZ_EXE_LDFLAGS="$LIB_FUZZING_ENGINE"
Signature · 1 line
2.27.0
Quoted 17 lines · Alexander Bulekov
With --enable-fuzzing,
QEMU_CFLAGSinclude -fsanitize=fuzzer-no-link. This should allow us to build non-fuzzer binaries using objects instrumented for fuzzing. However, to do that, we also need to link with -fsanitize=fuzzer-no-link. We were not doing that.Reported-by Li Qiang <[email protected]>Signed-off-by Alexander Bulekov <[email protected]>--- configure | 1 + 1 file changed, 1 insertion(+)configure +0
-0
configure if test "$fuzzing" = "yes" ; then · line 6100
Quoted 4 lines
configure +1
-0@@ -6097,6 +6097,7 @@ if test "$fuzzing" = "yes" ; then # needed CFLAGS have already been provided if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" + QEMU_LDFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link"
Did you mean ="$QEMU_LDFLAGS ... ?
configure if test "$fuzzing" = "yes" ; then · line 6101
Quoted 1 line
configure +0
-0FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer"
-- PMM
Quoted 13 lines · Peter Maydell
Quoted 12 lines · Alexander Bulekov
With --enable-fuzzing,
QEMU_CFLAGSinclude -fsanitize=fuzzer-no-link. This should allow us to build non-fuzzer binaries using objects instrumented for fuzzing. However, to do that, we also need to link with -fsanitize=fuzzer-no-link. We were not doing that.Reported-by Li Qiang <[email protected]>Signed-off-by Alexander Bulekov <[email protected]>--- configure | 1 + 1 file changed, 1 insertion(+)
Quoted 11 lines
configure if test "$fuzzing" = "yes" ; then · line 6100
Quoted 9 lines
configure +1
-0@@ -6097,6 +6097,7 @@ if test "$fuzzing" = "yes" ; then # needed CFLAGS have already been provided if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" + QEMU_LDFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link"Did you mean ="$QEMU_LDFLAGS ... ?
Yes... It somehow passed my build-test. Should I send a v2?
Quoted 4 lines
configure if test "$fuzzing" = "yes" ; then · line 6101
Quoted 2 lines
configure +0
-0FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer"-- PMM
Quoted 27 lines · Alexander Bulekov
Quoted 13 lines · Peter Maydell
Quoted 12 lines · Alexander Bulekov
With --enable-fuzzing,
QEMU_CFLAGSinclude -fsanitize=fuzzer-no-link. This should allow us to build non-fuzzer binaries using objects instrumented for fuzzing. However, to do that, we also need to link with -fsanitize=fuzzer-no-link. We were not doing that.Reported-by Li Qiang <[email protected]>Signed-off-by Alexander Bulekov <[email protected]>--- configure | 1 + 1 file changed, 1 insertion(+)Quoted 11 lines
configure if test "$fuzzing" = "yes" ; then · line 6100
Quoted 9 lines
configure +1
-0@@ -6097,6 +6097,7 @@ if test "$fuzzing" = "yes" ; then # needed CFLAGS have already been provided if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" + QEMU_LDFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link"Did you mean ="$QEMU_LDFLAGS ... ?
Quoted 1 line
Yes... It somehow passed my build-test. Should I send a v2?
Yes, please.
Quoted 1 line
Quoted 1 line
configure if test "$fuzzing" = "yes" ; then · line 6101
Quoted 1 line
configure +0
-0FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer"
It might also be helpful to have a brief comment explaining why we need to set fuzzing related options in all three of QEMU_CFLAGS, QEMU_LDFLAGS and FUZZ_EXE_LDFLAGS (ie what the difference between them is).
-- PMM