Patchwork [v2,1.0] configure: tighten pie toolchain support test for tls variables

login
register
mail settings
Submitter Avi Kivity
Date Nov. 22, 2011, 12:35 p.m.
Message ID <1321965325-32050-1-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/127073/
State New
Headers show

Comments

Avi Kivity - Nov. 22, 2011, 12:35 p.m.
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>
---

v2: give tls_var a type; avoids invisible warning

 configure |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Brad - Nov. 23, 2011, 2:54 a.m.
On 22/11/11 7:35 AM, Avi Kivity wrote:
> 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>
> ---
>
> v2: give tls_var a type; avoids invisible warning

This breaks the PIE check on OpenBSD since there is no TLS
support and the issue trying to be detected doesn't affect
OpenBSD.

Patch

diff --git a/configure b/configure
index 75e1f10..6158b8f 100755
--- a/configure
+++ b/configure
@@ -1120,7 +1120,10 @@  fi
 
 if test "$pie" != "no" ; then
   cat > $TMPC << EOF
-int main(void) { return 0; }
+
+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"