qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@163.com>
To: pbonzini@redhat.com, f4bug@amsat.org, thuth@redhat.com, alxndr@bu.edu
Cc: Li Qiang <liq3ea@163.com>, liq3ea@gmail.com, qemu-devel@nongnu.org
Subject: [PATCH] configure: force enable-sanitizers together with enable-fuzzing
Date: Sun, 21 Feb 2021 04:59:00 -0800	[thread overview]
Message-ID: <20210221125900.425495-1-liq3ea@163.com> (raw)

If we execute configure with --enable-fuzzing but without
--enable-sanitizers, we will have a lot of 'undefined reference'
build error such as following:

clang-10  -o subprojects/libvhost-user/link-test subprojects/libvhost-user/link-test.p/link-test.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--whole-archive -Wl,--start-group subprojects/libvhost-user/libvhost-user.a -Wl,--end-group -Wl,--no-whole-archive -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -m64 -fstack-protector-strong -pthread
/usr/bin/ld: subprojects/libvhost-user/link-test.p/link-test.c.o: in function `main':
/home/test/qemu/build/../subprojects/libvhost-user/link-test.c:34: undefined reference to `__sancov_lowest_stack'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/link-test.c:(.text.main[main]+0x55): undefined reference to `__sancov_lowest_stack'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/link-test.c:41: undefined reference to `__sanitizer_cov_trace_const_cmp4'
/usr/bin/ld: subprojects/libvhost-user/link-test.p/link-test.c.o: in function `sancov.module_ctor_8bit_counters':
link-test.c:(.text.sancov.module_ctor_8bit_counters[sancov.module_ctor_8bit_counters]+0x16): undefined reference to `__sanitizer_cov_8bit_counters_init'
/usr/bin/ld: link-test.c:(.text.sancov.module_ctor_8bit_counters[sancov.module_ctor_8bit_counters]+0x2f): undefined reference to `__sanitizer_cov_pcs_init'
/usr/bin/ld: subprojects/libvhost-user/libvhost-user.a(libvhost-user.c.o): in function `vu_gpa_to_va':
/home/test/qemu/build/../subprojects/libvhost-user/libvhost-user.c:182: undefined reference to `__sanitizer_cov_trace_const_cmp8'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/libvhost-user.c:187: undefined reference to `__sanitizer_cov_trace_cmp4'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/libvhost-user.c:190: undefined reference to `__sanitizer_cov_trace_cmp8'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/libvhost-user.c:190: undefined reference to `__sanitizer_cov_trace_cmp8'
/usr/bin/ld: /home/test/qemu/build/../subprojects/libvhost-user/libvhost-user.c:191: undefined reference to `__sanitizer_cov_trace_cmp8'

Let's avoid this error by enforcing fuzzing and sanitizers together.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index a34f91171d..9f00a1d887 100755
--- a/configure
+++ b/configure
@@ -6083,6 +6083,9 @@ if test "$have_mlockall" = "yes" ; then
   echo "HAVE_MLOCKALL=y" >> $config_host_mak
 fi
 if test "$fuzzing" = "yes" ; then
+  if test "$sanitizers" = "no"; then
+    error_exit "enable-fuzzing also needs enable-sanitizers"
+  fi
   # If LIB_FUZZING_ENGINE is set, assume we are running on OSS-Fuzz, and the
   # needed CFLAGS have already been provided
   if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then
-- 
2.25.1




             reply	other threads:[~2021-02-21 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-21 12:59 Li Qiang [this message]
2021-02-21 15:37 ` [PATCH] configure: force enable-sanitizers together with enable-fuzzing Alexander Bulekov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210221125900.425495-1-liq3ea@163.com \
    --to=liq3ea@163.com \
    --cc=alxndr@bu.edu \
    --cc=f4bug@amsat.org \
    --cc=liq3ea@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).