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>
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"