Skip to content

Commit

Permalink
fix build on Alpine Linux
Browse files Browse the repository at this point in the history
- make sure libexecinfo gets linked into compiler-rt when building
  against musl c library on Alpine Linux
  • Loading branch information
DoDoENT committed Oct 5, 2021
1 parent d7b669b commit d6906be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function(compiler_rt_check_linker_flag flag out_var)
endfunction()

check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_EXECINFO)
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
include(HandleCompilerRT)
find_compiler_rt_library(builtins "" COMPILER_RT_BUILTINS_LIBRARY)
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/scudo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_MINIMAL_DYNAMIC_LIBS)
append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_MINIMAL_DYNAMIC_LIBS)
append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer
SCUDO_CFLAGS)
append_list_if(COMPILER_RT_HAS_EXECINFO execinfo SCUDO_MINIMAL_DYNAMIC_LIBS)

set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
# Use gc-sections by default to avoid unused code being pulled in.
list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)


if(ANDROID)
# Put most Sanitizer shared libraries in the global group. For more details, see
# android-changes-for-ndk-developers.md#changes-to-library-search-order
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/scudo/standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ endif()
set(SCUDO_LINK_LIBS)

append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread SCUDO_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_EXECINFO execinfo SCUDO_LINK_LIBS)

append_list_if(FUCHSIA zircon SCUDO_LINK_LIBS)

Expand Down

0 comments on commit d6906be

Please sign in to comment.