summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Davis <michael.davis@essvote.com>2019-11-18 17:06:06 -0800
committerKhem Raj <raj.khem@gmail.com>2019-11-21 10:31:24 -0800
commit5ffaf60c7b7c555d19e6ea8dcb99b32f1b2ea59f (patch)
tree98e55e613f1ecba93fdef3f5bb3601ccb2961305
parent3611f25304bbb86f4a1600c3399a8a5a6cc050fa (diff)
downloadmeta-clang-5ffaf60c7b7c555d19e6ea8dcb99b32f1b2ea59f.tar.gz
llvm: Check for built-in atomic<double> during configure
This helps in deciding on linking libatomic, therefore its important to check for atomic<double> because on x86, clang decides to not use built-in whereas gcc does, so clangd e.g. links ok when using gcc but fails when using clang with gcc-runtime on x86 Backport of ba6e545b1d0ee93b4ef698fae2d5a018a062b46a Signed-off-by: Michael Davis <michael.davis@essvote.com>
-rw-r--r--recipes-devtools/clang/clang/0021-Check-for-atomic-double-intrinsics.patch33
-rw-r--r--recipes-devtools/clang/common.inc1
2 files changed, 34 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0021-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0021-Check-for-atomic-double-intrinsics.patch
new file mode 100644
index 0000000..04a5b93
--- /dev/null
+++ b/recipes-devtools/clang/clang/0021-Check-for-atomic-double-intrinsics.patch
@@ -0,0 +1,33 @@
1From a580e8fcf17fb9cb9056debdd342ac4eabef4762 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 18 Nov 2019 17:00:29 -0800
4Subject: [PATCH] Check for atomic<double> intrinsics
5
6On some architectures e.g. x86/32bit gcc decides to inline calls to
7double atomic variables but clang does not and defers it to libatomic
8therefore detect if clang can use built-ins for atomic<double> if not
9then link libatomic, this helps building clangd for x86 on linux systems
10with gcc runtime
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
17
18diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
19index 9a4cdf12a62..e70ce924df9 100644
20--- a/llvm/cmake/modules/CheckAtomic.cmake
21+++ b/llvm/cmake/modules/CheckAtomic.cmake
22@@ -26,9 +26,10 @@ function(check_working_cxx_atomics64 varname)
23 #include <atomic>
24 #include <cstdint>
25 std::atomic<uint64_t> x (0);
26+std::atomic<double> y (0);
27 int main() {
28 uint64_t i = x.load(std::memory_order_relaxed);
29- return 0;
30+ return int(y);
31 }
32 " ${varname})
33 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc
index fec78fb..c54c999 100644
--- a/recipes-devtools/clang/common.inc
+++ b/recipes-devtools/clang/common.inc
@@ -28,6 +28,7 @@ SRC_URI = "\
28 file://0018-compiler-rt-Disable-tsan-on-OE-glibc.patch \ 28 file://0018-compiler-rt-Disable-tsan-on-OE-glibc.patch \
29 file://0019-llvm-Enhance-path-prefix-mapping.patch \ 29 file://0019-llvm-Enhance-path-prefix-mapping.patch \
30 file://0020-clang-Initial-implementation-of-fmacro-prefix-map-an.patch \ 30 file://0020-clang-Initial-implementation-of-fmacro-prefix-map-an.patch \
31 file://0021-Check-for-atomic-double-intrinsics.patch \
31" 32"
32 33
33# Fallback to no-PIE if not set 34# Fallback to no-PIE if not set