From 897775d6ee89e54e447e35fd09436a65a620307d Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 6 Nov 2011 14:07:23 +0000 Subject: [PATCH] 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. --- gnu/lib/libstdc++/config.h | 2 +- lib/clang/include/llvm/Config/config.h | 2 ++ lib/clang/include/llvm/Config/llvm-config.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gnu/lib/libstdc++/config.h b/gnu/lib/libstdc++/config.h index 4109752a8ae1..a4afbdbec30a 100644 --- a/gnu/lib/libstdc++/config.h +++ b/gnu/lib/libstdc++/config.h @@ -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 diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 5b6761c2eeaa..5ecb51ca0dd3 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -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 */ diff --git a/lib/clang/include/llvm/Config/llvm-config.h b/lib/clang/include/llvm/Config/llvm-config.h index 05e17ca1fd90..28837f787e96 100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@ -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 */