summaryrefslogtreecommitdiffstats
path: root/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch')
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
new file mode 100644
index 00000000..08856482
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
@@ -0,0 +1,32 @@
+From dd6a749dee10f537fc7cb558ace319041a63e5f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Nov 2019 17:00:29 -0800
+Subject: [PATCH] Check for atomic<double> intrinsics
+
+On some architectures e.g. x86/32bit gcc decides to inline calls to
+double atomic variables but clang does not and defers it to libatomic
+therefore detect if clang can use built-ins for atomic<double> if not
+then link libatomic, this helps building clangd for x86 on linux systems
+with gcc runtime
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
+index 29f3bdd57f0..6460842cf63 100644
+--- a/llvm/cmake/modules/CheckAtomic.cmake
++++ b/llvm/cmake/modules/CheckAtomic.cmake
+@@ -26,9 +26,10 @@ function(check_working_cxx_atomics64 varname)
+ #include <atomic>
+ #include <cstdint>
+ std::atomic<uint64_t> x (0);
++std::atomic<double> y (0);
+ int main() {
+ uint64_t i = x.load(std::memory_order_relaxed);
+- return 0;
++ return int(y);
+ }
+ " ${varname})
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})