blob: 68195f8464976524363671a8f7f71d2139327107 [file] [log] [blame]
From 40520b0de69d8ca8e659248f5ffe641f33cc6dee Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 9 Mar 2021 14:16:58 -0800
Subject: [PATCH] Extend atomics check to include 1-byte CAS test
Rename ATOMIC_INT64_REQUIRES_LIBATOMIC to ATOMICS_REQUIRE_LIBATOMIC so
it can reflect broader range which is now checked
Rename ATOMIC_INT64_IS_BUILTIN to ATOMICS_ARE_BUILTIN
Upstream-Status: Accepted [https://bugs.webkit.org/attachment.cgi?bugid=222959]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Source/JavaScriptCore/CMakeLists.txt | 2 +-
Source/WebKit/CMakeLists.txt | 2 +-
Source/cmake/WebKitCompilerFlags.cmake | 15 ++++++++++-----
3 files changed, 12 insertions(+), 7 deletions(-)
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -129,7 +129,7 @@ if (USE_CAPSTONE)
list(APPEND JavaScriptCore_LIBRARIES capstone)
endif ()
-if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
+if (ATOMICS_REQUIRE_LIBATOMIC)
list(APPEND JavaScriptCore_LIBRARIES atomic)
endif ()
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -337,7 +337,7 @@ if (USE_LIBWEBRTC)
list(APPEND WebKit_LIBRARIES webrtc)
endif ()
-if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
+if (ATOMICS_REQUIRE_LIBATOMIC)
list(APPEND WebKit_PRIVATE_LIBRARIES atomic)
endif ()
--- a/Source/cmake/WebKitCompilerFlags.cmake
+++ b/Source/cmake/WebKitCompilerFlags.cmake
@@ -280,12 +280,17 @@ endif ()
if (COMPILER_IS_GCC_OR_CLANG)
set(ATOMIC_TEST_SOURCE "
#include <atomic>
- int main() { std::atomic<int64_t> i(0); i++; return 0; }
+ int main() {
+ std::atomic<int64_t> i(0);
+ std::atomic<int8_t> j(0);
+ i++; j++;
+ return 0;
+ }
")
- check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
- if (NOT ATOMIC_INT64_IS_BUILTIN)
+ check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMICS_ARE_BUILTIN)
+ if (NOT ATOMICS_ARE_BUILTIN)
set(CMAKE_REQUIRED_LIBRARIES atomic)
- check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC)
+ check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMICS_REQUIRE_LIBATOMIC)
unset(CMAKE_REQUIRED_LIBRARIES)
endif ()
endif ()
--- a/Source/WTF/wtf/CMakeLists.txt
+++ b/Source/WTF/wtf/CMakeLists.txt
@@ -529,6 +529,10 @@ list(APPEND WTF_LIBRARIES
ICU::uc
)
+if (ATOMICS_REQUIRE_LIBATOMIC)
+ list(APPEND WTF_LIBRARIES atomic)
+endif ()
+
set(WTF_INTERFACE_LIBRARIES WTF)
set(WTF_INTERFACE_INCLUDE_DIRECTORIES ${WTF_FRAMEWORK_HEADERS_DIR})
set(WTF_INTERFACE_DEPENDENCIES WTF_CopyHeaders)