When one attempts to compile the tree with -march=i386, which also used

to be gcc's default before r198344, calls to atomic builtins will not be
expanded inline.  Instead, they will be generated as calls to external
functions (e.g. __sync_fetch_and_add_N), leading to linking errors later
on.

Put in a seatbelt that disables use of atomic builtins in libstdc++ and
llvm, when tuning specifically for the real i386 CPU.  This does not
protect against all possible issues, but it is better than nothing.
This commit is contained in:
dim 2011-11-06 14:07:23 +00:00
parent f22dd3ece0
commit 897775d6ee
3 changed files with 5 additions and 1 deletions

View File

@ -671,7 +671,7 @@
/* #undef VERSION */
/* Define if builtin atomic operations are supported on this host. */
#if defined(__amd64__) || defined(__i386__)
#if defined(__amd64__) || (defined(__i386__) && !defined(__tune_i386__))
#define _GLIBCXX_ATOMIC_BUILTINS 1
#endif

View File

@ -552,7 +552,9 @@
/* #undef LLVM_ETCDIR */
/* Has gcc/MSVC atomic intrinsics */
#ifndef __tune_i386__
#define LLVM_HAS_ATOMICS 1
#endif
/* Host triple we were built on */
/* #undef LLVM_HOSTTRIPLE */

View File

@ -34,7 +34,9 @@
/* #undef LLVM_ETCDIR */
/* Has gcc/MSVC atomic intrinsics */
#ifndef __tune_i386__
#define LLVM_HAS_ATOMICS 1
#endif
/* Host triple we were built on */
/* #undef LLVM_HOSTTRIPLE */