diff mbox

[1/8] tls: require compiler support for __thread

Message ID 20150428210457.GA12653@flamenco
State New
Headers show

Commit Message

Emilio Cota April 28, 2015, 9:04 p.m. UTC
On Tue, Jan 13, 2015 at 22:07:19 +0000, Peter Maydell wrote:
> On 13 January 2015 at 20:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
> > On 13/01/2015 21:00, Peter Maydell wrote:
> >> Hmm. That's a chunk of users who are now going to have to
> >> change the way they've been building QEMU. Does configure
> >> at least blow up on the old gcc, or will we just silently
> >> build a non-working QEMU?
> >
> > At least the build, if not configure, should blow up.
> 
> Yeah, it does:
> qemu-coroutine.c:29: error: thread-local storage not supported for this target
> (that's gcc 4.2.1 20070719 on OpenBSD 5.5.)
> 
> As a new requirement it might be polite to make configure
> insist on it rather than failing the build later, maybe.

Just noticed that this patch was eventually dropped.

Would the appended be the missing piece to have this patch finally merged?

Thanks,

		Emilio

commit ad45e590025c1197a7aef5164e1ae174894b0969
Author: Emilio G. Cota <cota@braap.org>
Date:   Tue Apr 28 16:54:44 2015 -0400

    configure: require __thread support
    
    The codebase doesn't build without __thread support.
    Formalise this requirement by adding a check for it in the
    configure script.
    
    Signed-off-by: Emilio G. Cota <cota@braap.org>

Comments

Paolo Bonzini April 29, 2015, 11:09 a.m. UTC | #1
On 28/04/2015 23:04, Emilio G. Cota wrote:
> 
> commit ad45e590025c1197a7aef5164e1ae174894b0969
> Author: Emilio G. Cota <cota@braap.org>
> Date:   Tue Apr 28 16:54:44 2015 -0400
> 
>     configure: require __thread support
>     
>     The codebase doesn't build without __thread support.
>     Formalise this requirement by adding a check for it in the
>     configure script.
>     
>     Signed-off-by: Emilio G. Cota <cota@braap.org>
> 
> diff --git a/configure b/configure
> index 6969f6f..3d6591f 100755
> --- a/configure
> +++ b/configure
> @@ -1549,6 +1549,17 @@ if test "$static" = "yes" ; then
>    fi
>  fi
>  
> +# Unconditional check for compiler __thread support
> +  cat > $TMPC << EOF
> +static __thread int tls_var;
> +int main(void) { return tls_var; }
> +EOF
> +
> +if ! compile_prog "-Werror" "" ; then
> +    error_exit "Your compiler does not support the __thread specifier for " \
> +	"Thread-Local Storage (TLS). Please upgrade to a version that does."
> +fi
> +
>  if test "$pie" = ""; then
>    case "$cpu-$targetos" in
>      i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)

Yes, thanks.  I'll include the patch in my next pull request.

Paolo
diff mbox

Patch

diff --git a/configure b/configure
index 6969f6f..3d6591f 100755
--- a/configure
+++ b/configure
@@ -1549,6 +1549,17 @@  if test "$static" = "yes" ; then
   fi
 fi
 
+# Unconditional check for compiler __thread support
+  cat > $TMPC << EOF
+static __thread int tls_var;
+int main(void) { return tls_var; }
+EOF
+
+if ! compile_prog "-Werror" "" ; then
+    error_exit "Your compiler does not support the __thread specifier for " \
+	"Thread-Local Storage (TLS). Please upgrade to a version that does."
+fi
+
 if test "$pie" = ""; then
   case "$cpu-$targetos" in
     i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)