All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, John Snow <jsnow@redhat.com>,
	pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH] configure: workaround for Clang 3.5.0
Date: Thu, 29 Oct 2015 16:22:48 -0400	[thread overview]
Message-ID: <1446150168-9632-1-git-send-email-jsnow@redhat.com> (raw)

Clang++ 3.5 on Fedora 22 appears to have difficulty tolerating
D_FORTIFY_SOURCE for certain glibc headers, such as stdio.

This interferes, currently, with any arm target build.

Work around this by disabling FORTIFY_SOURCE for clang builds
if a problem is observed.

Newer versions of clang such as 3.5.2 (As seen in debian-testing)
or 3.7.0 (As seen in Fedora 23 Beta) are unaffected and will not
trigger this workaround.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 configure | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7a1d08d..7abfcc3 100755
--- a/configure
+++ b/configure
@@ -107,6 +107,11 @@ compile_object() {
   do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
 }
 
+compile_cxx_object() {
+  local_cflags="$1"
+  do_cxx $QEMU_CXXFLAGS $local_cflags -c -o $TMPO $TMPC
+}
+
 compile_prog() {
   local_cflags="$1"
   local_ldflags="$2"
@@ -4436,13 +4441,31 @@ if ! compile_object "-Werror"; then
 fi
 
 ##########################################
+# Test that we can use FORTIFY_SOURCE,
+# which might break Clang.
+
+if test "$debug" = "no"; then
+  cat > $TMPC << EOF
+#include <cstdio>
+int main(int argc, char*argv[]) {
+  fprintf(stdout, "Hello World\n");
+  return 0;
+}
+EOF
+
+  if ! compile_cxx_object "-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"; then
+      fortify_source="no";
+  fi
+fi
+
+##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
 
 if test "$gcov" = "yes" ; then
   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
-elif test "$debug" = "no" ; then
+elif test "$debug" = "no" && test "$fortify_source" != "no" ; then
   CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
 fi
 
-- 
2.4.3

             reply	other threads:[~2015-10-29 20:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 20:22 John Snow [this message]
2015-10-29 20:29 ` [Qemu-devel] [PATCH] configure: workaround for Clang 3.5.0 John Snow
2015-10-29 21:20   ` Laszlo Ersek
2015-10-29 21:25     ` Peter Maydell
2015-10-29 21:28       ` John Snow

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=1446150168-9632-1-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.