Skip to contentSkip to conversation

configure: tighten pie toolchain support test for tls variables

PATCH Superseded Avi Kivity 2 participants 2 messages Nov 22, 2011

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 configure: tighten pie toolchain support test for tls variables

Some toolchains don't support pie properly when tls variables are in use. Disallow pie when such toolchains are detected.

---
 configure |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
configure +4 -1
index 75e1f10..7e6c640 100755
@@ -1120,7 +1120,10 @@ fi
 
 if test "$pie" != "no" ; then
   cat > $TMPC << EOF
-int main(void) { return 0; }
+
+static __thread tls_var;
+
+int main(void) { return tls_var; }
 EOF
   if compile_prog "-fPIE -DPIE" "-pie"; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
Signature · 1 line
1.7.7.1
#1 lore raw
Quoted 14 lines · Avi Kivity

Some toolchains don't support pie properly when tls variables are in use. Disallow pie when such toolchains are detected.

---
 configure |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
configure +0 -0
index 75e1f10..7e6c640 100755
@@ -1120,7 +1120,10 @@ fi
 

configure fi · line 1129

Quoted 10 lines
configure +4 -1
 if test "$pie" != "no" ; then
   cat > $TMPC << EOF
-int main(void) { return 0; }
+
+static __thread tls_var;
+
+int main(void) { return tls_var; }
 EOF
   if compile_prog "-fPIE -DPIE" "-pie"; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"

Survived testbuild.

thanks,
Gerd