qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, famz@redhat.com,
	Don Slutz <dslutz@verizon.com>,
	aliguori@amazon.com
Subject: [Qemu-devel] [PULL 11/12] configure: Disable libtool if -fPIE does not work with it (bug #1257099)
Date: Thu, 20 Feb 2014 13:29:02 +0100	[thread overview]
Message-ID: <1392899343-5226-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1392899343-5226-1-git-send-email-pbonzini@redhat.com>

From: Don Slutz <dslutz@verizon.com>

Adjust TMPO and added TMPB, TMPL, and TMPA.  libtool needs the names
to be fixed (TMPB).

Add new functions do_libtool and libtool_prog.

Add check for broken gcc and libtool.

Signed-off-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 66d7633..46b5b6d 100755
--- a/configure
+++ b/configure
@@ -12,7 +12,10 @@ else
 fi
 
 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
-TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
+TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}"
+TMPO="${TMPDIR1}/${TMPB}.o"
+TMPL="${TMPDIR1}/${TMPB}.lo"
+TMPA="${TMPDIR1}/lib${TMPB}.la"
 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
 
 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
@@ -86,6 +89,38 @@ compile_prog() {
   do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
 }
 
+do_libtool() {
+    local mode=$1
+    shift
+    # Run the compiler, capturing its output to the log.
+    echo $libtool $mode --tag=CC $cc "$@" >> config.log
+    $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
+    # Test passed. If this is an --enable-werror build, rerun
+    # the test with -Werror and bail out if it fails. This
+    # makes warning-generating-errors in configure test code
+    # obvious to developers.
+    if test "$werror" != "yes"; then
+        return 0
+    fi
+    # Don't bother rerunning the compile if we were already using -Werror
+    case "$*" in
+        *-Werror*)
+           return 0
+        ;;
+    esac
+    echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
+    $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
+    error_exit "configure test passed without -Werror but failed with -Werror." \
+        "This is probably a bug in the configure script. The failing command" \
+        "will be at the bottom of config.log." \
+        "You can run configure with --disable-werror to bypass this check."
+}
+
+libtool_prog() {
+    do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
+    do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
+}
+
 # symbolically link $1 to $2.  Portable version of "ln -sf".
 symlink() {
   rm -rf "$2"
@@ -1406,6 +1441,32 @@ EOF
   fi
 fi
 
+# check for broken gcc and libtool in RHEL5
+if test -n "$libtool" -a "$pie" != "no" ; then
+  cat > $TMPC <<EOF
+
+void *f(unsigned char *buf, int len);
+void *g(unsigned char *buf, int len);
+
+void *
+f(unsigned char *buf, int len)
+{
+    return (void*)0L;
+}
+
+void *
+g(unsigned char *buf, int len)
+{
+    return f(buf, len);
+}
+
+EOF
+  if ! libtool_prog; then
+    echo "Disabling libtool due to broken toolchain support"
+    libtool=
+  fi
+fi
+
 ##########################################
 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
 # use i686 as default anyway, but for those that don't, an explicit
-- 
1.8.3.1

  parent reply	other threads:[~2014-02-20 12:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 12:28 [Qemu-devel] [PULL respin 00/12] Build system changes for 2014-02-20 Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 01/12] util: Split out exec_dir from os_find_datadir Paolo Bonzini
2014-03-13 13:08   ` Andreas Färber
2014-02-20 12:28 ` [Qemu-devel] [PULL 02/12] rules.mak: fix $(obj) to a real relative path Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 03/12] rules.mak: allow per object cflags and libs Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 04/12] block: use per-object " Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 05/12] darwin: do not use -mdynamic-no-pic Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 06/12] rules.mak: introduce DSO rules Paolo Bonzini
2014-02-20 12:28 ` [Qemu-devel] [PULL 07/12] module: implement module loading Paolo Bonzini
2014-02-25 16:13   ` Peter Maydell
2014-02-20 12:28 ` [Qemu-devel] [PULL 08/12] Makefile: install modules with "make install" Paolo Bonzini
2014-02-20 12:29 ` [Qemu-devel] [PULL 09/12] Makefile: introduce common-obj-m and block-obj-m for DSO Paolo Bonzini
2014-02-20 12:29 ` [Qemu-devel] [PULL 10/12] block: convert block drivers linked with libs to modules Paolo Bonzini
2014-02-20 12:29 ` Paolo Bonzini [this message]
2014-02-20 12:29 ` [Qemu-devel] [PULL 12/12] build: softmmu targets do not have a "main.o" file Paolo Bonzini
2014-02-24 16:11 ` [Qemu-devel] [PULL respin 00/12] Build system changes for 2014-02-20 Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2014-02-17 17:35 [Qemu-devel] [PULL 00/12] Build system changes for 2014-02-17 Paolo Bonzini
2014-02-17 17:35 ` [Qemu-devel] [PULL 11/12] configure: Disable libtool if -fPIE does not work with it (bug #1257099) Paolo Bonzini

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=1392899343-5226-12-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=dslutz@verizon.com \
    --cc=famz@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 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).