configure: tighten pie toolchain support test for tls variables
authorAvi Kivity <avi@redhat.com>
Wed, 23 Nov 2011 09:24:25 +0000 (11:24 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 28 Nov 2011 22:20:52 +0000 (16:20 -0600)
Some toolchains don't support pie properly when tls variables are
in use.  Disallow pie when such toolchains are detected.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
configure

index f03343821030581730bad3d74d1473a3b5123998..a7caf1e1901b207e465b22d8524213497eb918e7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1120,7 +1120,17 @@ fi
 
 if test "$pie" != "no" ; then
   cat > $TMPC << EOF
-int main(void) { return 0; }
+
+#ifdef __linux__
+#  define THREAD __thread
+#else
+#  define THREAD
+#endif
+
+static THREAD int tls_var;
+
+int main(void) { return tls_var; }
+
 EOF
   if compile_prog "-fPIE -DPIE" "-pie"; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"