diff options
author | Michael Davis <michael.davis@essvote.com> | 2019-11-18 17:06:06 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-21 10:31:24 -0800 |
commit | 5ffaf60c7b7c555d19e6ea8dcb99b32f1b2ea59f (patch) | |
tree | 98e55e613f1ecba93fdef3f5bb3601ccb2961305 | |
parent | 3611f25304bbb86f4a1600c3399a8a5a6cc050fa (diff) | |
download | meta-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.patch | 33 | ||||
-rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
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 @@ | |||
1 | From a580e8fcf17fb9cb9056debdd342ac4eabef4762 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 18 Nov 2019 17:00:29 -0800 | ||
4 | Subject: [PATCH] Check for atomic<double> intrinsics | ||
5 | |||
6 | On some architectures e.g. x86/32bit gcc decides to inline calls to | ||
7 | double atomic variables but clang does not and defers it to libatomic | ||
8 | therefore detect if clang can use built-ins for atomic<double> if not | ||
9 | then link libatomic, this helps building clangd for x86 on linux systems | ||
10 | with gcc runtime | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | Signed-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 | |||
18 | diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake | ||
19 | index 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 |