summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-11-18 17:06:06 -0800
committerKhem Raj <raj.khem@gmail.com>2019-11-18 22:34:59 -0800
commitba6e545b1d0ee93b4ef698fae2d5a018a062b46a (patch)
tree40f1d86b73fdfb22b5f1d1a95de9654e157c7982
parentd9066d9c1b1a52d71f5599d401c5e4d5b837a558 (diff)
downloadmeta-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.patch33
-rw-r--r--recipes-devtools/clang/common.inc1
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 @@
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 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