diff mbox

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

Message ID 1322040265-14530-1-git-send-email-avi@redhat.com
State New
Headers show

Commit Message

Avi Kivity Nov. 23, 2011, 9:24 a.m. UTC
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>
---

v3: only check __thread on Linux, where we require it, and where the
    toolchain fails

v2: give tls_var a type; avoids invisible warning

 configure |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

Comments

Brad Smith Nov. 23, 2011, 9:02 p.m. UTC | #1
On 23/11/11 4:24 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>

Thanks. Works as expected now.
Anthony Liguori Nov. 28, 2011, 10:36 p.m. UTC | #2
On 11/23/2011 03:24 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>

Applied. Thanks.

Regards,

Anthony Liguori

> ---
>
> v3: only check __thread on Linux, where we require it, and where the
>      toolchain fails
>
> v2: give tls_var a type; avoids invisible warning
>
>   configure |   12 +++++++++++-
>   1 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/configure b/configure
> index 75e1f10..1a2c55f 100755
> --- 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"
diff mbox

Patch

diff --git a/configure b/configure
index 75e1f10..1a2c55f 100755
--- 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"