Skip to content

Commit ccbab59

Browse files
committed
[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 e1e9726)
1 parent 464bda7 commit ccbab59

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

compiler-rt/lib/scudo/standalone/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,19 @@ set(SCUDO_SOURCES_CXX_WRAPPERS
129129
)
130130

131131
set(SCUDO_OBJECT_LIBS)
132+
set(SCUDO_LINK_LIBS)
132133

133134
if (COMPILER_RT_HAS_GWP_ASAN)
135+
if(COMPILER_RT_USE_LLVM_UNWINDER)
136+
list(APPEND SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS} dl)
137+
elseif (COMPILER_RT_HAS_GCC_S_LIB)
138+
list(APPEND SCUDO_LINK_LIBS gcc_s)
139+
elseif (COMPILER_RT_HAS_GCC_LIB)
140+
list(APPEND SCUDO_LINK_LIBS gcc)
141+
elseif (NOT COMPILER_RT_USE_BUILTINS_LIBRARY)
142+
message(FATAL_ERROR "No suitable unwinder library")
143+
endif()
144+
134145
add_dependencies(scudo_standalone gwp_asan)
135146
list(APPEND SCUDO_OBJECT_LIBS
136147
RTGwpAsan RTGwpAsanBacktraceLibc RTGwpAsanSegvHandler
@@ -143,8 +154,6 @@ if (COMPILER_RT_HAS_GWP_ASAN)
143154

144155
endif()
145156

146-
set(SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS})
147-
148157
if(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC)
149158
include_directories(${COMPILER_RT_BINARY_DIR}/../libc/include/)
150159

0 commit comments

Comments
 (0)