[PATCH] Fix atomic_full_barrier on x86 and x86_64.

Mike Frysinger vapier@gentoo.org
Thu Mar 5 18:19:00 GMT 2015


On 25 Nov 2014 11:51, Torvald Riegel wrote:
> --- a/sysdeps/i386/i486/bits/atomic.h
> +++ b/sysdeps/i386/i486/bits/atomic.h
> @@ -535,3 +535,12 @@ typedef uintmax_t uatomic_max_t;
>  #define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask)
>  
>  #define catomic_or(mem, mask) __arch_or_body (__arch_cprefix, mem, mask)
> +
> +#ifdef __SSE2__
> +# define atomic_full_barrier() __asm ("mfence" ::: "memory")
> +#else
> +# define atomic_full_barrier() \
> +    __asm __volatile (LOCK_PREFIX "orl $0, (%%esp)" ::: "memory")
> +#endif

so this will kick in only when glibc itself is compiled with -msse2/etc...
support.  then again, these barriers only get used by glibc internal code,
so i guess this is the best answer.  plus it only impacts x86, and it's not
like anyone really cares about that anymore ;).

lgtm
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150305/0a4fb56e/attachment.sig>


More information about the Libc-alpha mailing list