diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-11-18 17:06:06 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-18 22:34:59 -0800 |
commit | ba6e545b1d0ee93b4ef698fae2d5a018a062b46a (patch) | |
tree | 40f1d86b73fdfb22b5f1d1a95de9654e157c7982 | |
parent | d9066d9c1b1a52d71f5599d401c5e4d5b837a558 (diff) | |
download | meta-clang-ba6e545b1d0ee93b4ef698fae2d5a018a062b46a.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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes-devtools/clang/clang/0025-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/0025-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0025-Check-for-atomic-double-intrinsics.patch new file mode 100644 index 0000000..04a5b93 --- /dev/null +++ b/recipes-devtools/clang/clang/0025-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 99b1e43..a21bc93 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
@@ -32,6 +32,7 @@ SRC_URI = "\ | |||
32 | file://0022-RISCV-Add-support-for-floating-point-registers-in-in.patch \ | 32 | file://0022-RISCV-Add-support-for-floating-point-registers-in-in.patch \ |
33 | file://0023-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ | 33 | file://0023-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ |
34 | file://0024-openmp-Recognise-ARMv7ve-machine-arch.patch \ | 34 | file://0024-openmp-Recognise-ARMv7ve-machine-arch.patch \ |
35 | file://0025-Check-for-atomic-double-intrinsics.patch \ | ||
35 | " | 36 | " |
36 | 37 | ||
37 | # Fallback to no-PIE if not set | 38 | # Fallback to no-PIE if not set |