aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.com>2024-01-30 15:19:09 +0300
committerakhropov <akhropov@yandex-team.com>2024-01-30 15:53:16 +0300
commita7593f8fca5ad0f8de02e84c342725136674433d (patch)
tree970aacca30d5be2817dd766ac3c4670c8e117005
parent9f73e972687d13df63dc168cf12d88ca8e1591ff (diff)
downloadydb-a7593f8fca5ad0f8de02e84c342725136674433d.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()