summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Lupori <leandro.lupori@linaro.org>2023-01-27 18:34:00 +0000
committerLeandro Lupori <leandro.lupori@linaro.org>2023-04-27 11:10:43 +0000
commitccbab5979b7bd594314b50f4fc54ec57a676f391 (patch)
tree91e4feefb6f6b9b7ea7d02ff0a5ddf608aca02ea
parent464bda7750a3ba9e23823fc707d7e7b6fc38438d (diff)
downloadllvm-ccbab5979b7bd594314b50f4fc54ec57a676f391.tar.gz
[compiler-rt] Fix scudo build on ARM
The build of scudo was failing on armv7l, with undefined references to unwinder symbols, such as __aeabi_unwind_cpp_pr0. These are needed by RTGwpAsan and thus, on ARM, scudo must also be linked against an unwind library. The cmake command that caused the build failure was: cmake --fresh -S "$PWD/llvm/" -B "$PWD/build/" -G Ninja \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra;polly" \ -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \ -DLLVM_TOOLCHAIN_TOOLS="llvm-ar;llvm-ranlib;llvm-objdump;\ llvm-rc;llvm-cvtres;llvm-nm;llvm-strings;llvm-readobj;\ llvm-dlltool;llvm-pdbutil;llvm-objcopy;llvm-strip;llvm-cov;\ llvm-profdata;llvm-addr2line;llvm-symbolizer;llvm-windres;llvm-ml;\ llvm-readelf;llvm-size" \ -DLLVM_INSTALL_BINUTILS_SYMLINKS=OFF -DLLVM_PARALLEL_LINK_JOBS=1 Fixes #60115 Reviewed By: hctim Differential Revision: https://reviews.llvm.org/D142888 (cherry picked from commit e1e972689b9138db795885a5468a15aafbe7cb51)
-rw-r--r--compiler-rt/lib/scudo/standalone/CMakeLists.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler-rt/lib/scudo/standalone/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
index 9ac3340877da..d75b7fd23523 100644
--- a/compiler-rt/lib/scudo/standalone/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
@@ -129,8 +129,19 @@ set(SCUDO_SOURCES_CXX_WRAPPERS
)
set(SCUDO_OBJECT_LIBS)
+set(SCUDO_LINK_LIBS)
if (COMPILER_RT_HAS_GWP_ASAN)
+ if(COMPILER_RT_USE_LLVM_UNWINDER)
+ list(APPEND SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS} dl)
+ elseif (COMPILER_RT_HAS_GCC_S_LIB)
+ list(APPEND SCUDO_LINK_LIBS gcc_s)
+ elseif (COMPILER_RT_HAS_GCC_LIB)
+ list(APPEND SCUDO_LINK_LIBS gcc)
+ elseif (NOT COMPILER_RT_USE_BUILTINS_LIBRARY)
+ message(FATAL_ERROR "No suitable unwinder library")
+ endif()
+
add_dependencies(scudo_standalone gwp_asan)
list(APPEND SCUDO_OBJECT_LIBS
RTGwpAsan RTGwpAsanBacktraceLibc RTGwpAsanSegvHandler
@@ -143,8 +154,6 @@ if (COMPILER_RT_HAS_GWP_ASAN)
endif()
-set(SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS})
-
if(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC)
include_directories(${COMPILER_RT_BINARY_DIR}/../libc/include/)