1From 17c7ad88f765bfbcfe25dd8f76ab9264250b9ea3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Feb 2022 01:31:26 -0800
4Subject: [PATCH] lldb: Link with libatomic on x86
5
6cmake atomic check is not sufficient for i686 target where clang14 still
7generates __atomic_store calls but the check does not entail this
8function and happily thinks that compiler can resolve all atomic via intrinsics
9on i686, but thats not the case, ideally the check for determining
10atomic operation should be make more robust but until then lets ask to
11link with libatomic on i686/linux
12
13Upstream-Status: Inappropriate [OE-Specific]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 lldb/source/Utility/CMakeLists.txt | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt
20index cc0bf5fdb61a..5228bf01c276 100644
21--- a/lldb/source/Utility/CMakeLists.txt
22+++ b/lldb/source/Utility/CMakeLists.txt
23@@ -19,6 +19,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
24   list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4)
25 endif ()
26
27+if (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
28+    list(APPEND LLDB_SYSTEM_LIBS atomic)
29+endif()
30+
31 if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
32     list(APPEND LLDB_SYSTEM_LIBS atomic)
33 endif()
34