aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.com>2024-01-30 15:19:09 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-01-31 14:24:15 +0300
commitf47227affdd3c905bce1cadef8a971e6bde03300 (patch)
treeefd2b4f0d37a832cb1c2a7249b892097ecacdaad
parent29a090163b553df920c21547c13b851c0685ee80 (diff)
downloadydb-f47227affdd3c905bce1cadef8a971e6bde03300.tar.gz
Set -mno-outline-atomics for modern versions of CLang and GCC to avoid unresolved symbols linking errors on arm64.,. Fix #2527
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake7
-rw-r--r--cmake/global_flags.compiler.gnu.march.cmake7
2 files changed, 14 insertions, 0 deletions
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake
index a81af88c70..a9c619efc6 100644
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake
+++ b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake
@@ -29,6 +29,13 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
string(APPEND _GNU_MARCH_C_CXX_FLAGS " -D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE")
endif()
+elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
+ if (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
+ # Clang 13+ generates outline atomics by default if '-rtlib=compiler_rt' is specified or system's
+ # libgcc version is >= 9.3.1 : https://github.com/llvm/llvm-project/commit/c5e7e649d537067dec7111f3de1430d0fc8a4d11
+ # Disable this behaviour because our build links with contrib/libs/cxxsupp/builtins that does not contain outline atomics yet
+ string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mno-outline-atomics")
+ endif()
elseif (ANDROID AND (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a"))
string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mfloat-abi=softfp")
endif()
diff --git a/cmake/global_flags.compiler.gnu.march.cmake b/cmake/global_flags.compiler.gnu.march.cmake
index a81af88c70..a9c619efc6 100644
--- a/cmake/global_flags.compiler.gnu.march.cmake
+++ b/cmake/global_flags.compiler.gnu.march.cmake
@@ -29,6 +29,13 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
string(APPEND _GNU_MARCH_C_CXX_FLAGS " -D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE")
endif()
+elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
+ if (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
+ # Clang 13+ generates outline atomics by default if '-rtlib=compiler_rt' is specified or system's
+ # libgcc version is >= 9.3.1 : https://github.com/llvm/llvm-project/commit/c5e7e649d537067dec7111f3de1430d0fc8a4d11
+ # Disable this behaviour because our build links with contrib/libs/cxxsupp/builtins that does not contain outline atomics yet
+ string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mno-outline-atomics")
+ endif()
elseif (ANDROID AND (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a"))
string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mfloat-abi=softfp")
endif()