dim added a comment.

In https://reviews.llvm.org/D28213#639397, @hfinkel wrote:

> LGTM. This seems consistent with what GCC does. On x86 it also sets 
> __GCC_ATOMIC_LLONG_LOCK_FREE to 2.


Hmm, unfortunately on i386-freebsd, it does not:

  $ gcc6 -v
  Using built-in specs.
  COLLECT_GCC=gcc6
  
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc6/gcc/i386-portbld-freebsd12.0/6.3.0/lto-wrapper
  Target: i386-portbld-freebsd12.0
  Configured with: /wrkdirs/usr/ports/lang/gcc6/work/gcc-6.3.0/configure 
--disable-multilib --disable-bootstrap --disable-nls 
--enable-gnu-indirect-function --libdir=/usr/local/lib/gcc6 
--libexecdir=/usr/local/libexec/gcc6 --program-suffix=6 
--with-as=/usr/local/bin/as --with-gmp=/usr/local 
--with-gxx-include-dir=/usr/local/lib/gcc6/include/c++/ 
--with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' 
--with-system-zlib --disable-libgcj --enable-languages=c,c++,objc,fortran 
--prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man 
--infodir=/usr/local/info/gcc6 --build=i386-portbld-freebsd12.0
  Thread model: posix
  gcc version 6.3.0 (FreeBSD Ports Collection)
  
  $ gcc6 -dM -E -x c /dev/null | grep __GCC_ATOMIC_LLONG_LOCK_FREE
  #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
  
  $ clang -v
  FreeBSD clang version 4.0.0 (branches/release_40 293807) (based on LLVM 4.0.0)
  Target: i386-unknown-freebsd12.0
  Thread model: posix
  InstalledDir: /usr/bin
  
  $ clang -dM -E -x c /dev/null | grep __GCC_ATOMIC_LLONG_LOCK_FREE
  #define __GCC_ATOMIC_LLONG_LOCK_FREE 2

I don't think FreeBSD has lock-free 64 bit atomic operations on 32-bit x86.  
IIRC we already had some trouble before with clang emitting libcalls to 
`__atomic_fetch_add_8` and friends, which then lead to linking errors.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216745, where this is now 
occurring with boost.


Repository:
  rL LLVM

https://reviews.llvm.org/D28213



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to