[PATCH] D87487: [compiler-rt][cmake] Attempt to fix build race condition
Mark Searles via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 16:58:14 PDT 2020
msearles created this revision.
msearles added reviewers: ro, eugenis.
Herald added subscribers: Sanitizers, mgorny, dberris.
Herald added a project: Sanitizers.
msearles requested review of this revision.
Fix for https://bugs.llvm.org/show_bug.cgi?id=26054
There was code which purported to work around a bug in cmake version
2. This involved creating a dummy.cpp file which had dependencies on
the '.vers' script.
Now that cmake version 3.13.4 is the minimum version of cmake this
work-around is removed and a straight forward dependency on the PHONY
target clang_rt.asan-dynamic-${arch}-version-list is introduced.
This appears to work with both GNUmake and ninja as targets.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87487
Files:
compiler-rt/lib/asan/CMakeLists.txt
Index: compiler-rt/lib/asan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/asan/CMakeLists.txt
+++ compiler-rt/lib/asan/CMakeLists.txt
@@ -149,13 +149,6 @@
DEFS ${ASAN_COMMON_DEFINITIONS}
DEPS ${ASAN_DEPS})
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
- add_compiler_rt_object_libraries(RTAsan_dynamic_version_script_dummy
- ARCHS ${ASAN_SUPPORTED_ARCH}
- SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
- CFLAGS ${ASAN_DYNAMIC_CFLAGS}
- DEFS ${ASAN_DYNAMIC_DEFINITIONS}
- DEPS ${ASAN_DEPS})
endif()
# Build ASan runtimes shipped with Clang.
@@ -225,6 +218,9 @@
foreach(arch ${ASAN_SUPPORTED_ARCH})
if (COMPILER_RT_HAS_VERSION_SCRIPT)
+ # adds a custom target clang_rt.asan-dynamic-${arch}-version-list
+ # which depends on vers = ${CMAKE_CURRENT_BINARY_DIR}/clang_rt.asan-dynamic-${arch}.vers
+ # and runs python to generate it.
add_sanitizer_rt_version_list(clang_rt.asan-dynamic-${arch}
LIBS clang_rt.asan-${arch} clang_rt.asan_cxx-${arch}
EXTRA asan.syms.extra)
@@ -235,10 +231,6 @@
if (COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
list(APPEND VERSION_SCRIPT_FLAG -Wl,-z,gnu-version-script-compat)
endif()
- set_property(SOURCE
- ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
- APPEND PROPERTY
- OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clang_rt.asan-dynamic-${arch}.vers)
else()
set(VERSION_SCRIPT_FLAG)
endif()
@@ -264,12 +256,6 @@
ARCHS ${arch}
OBJECT_LIBS ${ASAN_COMMON_RUNTIME_OBJECT_LIBS}
RTAsan_dynamic
- # The only purpose of RTAsan_dynamic_version_script_dummy is to
- # carry a dependency of the shared runtime on the version script.
- # Replacing it with a straightforward
- # add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
- # generates an order-only dependency in ninja.
- RTAsan_dynamic_version_script_dummy
RTUbsan_cxx
${ASAN_DYNAMIC_WEAK_INTERCEPTION}
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
@@ -278,6 +264,7 @@
LINK_LIBS ${ASAN_DYNAMIC_LIBS}
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
PARENT_TARGET asan)
+ add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
if (SANITIZER_USE_SYMBOLS AND NOT ${arch} STREQUAL "i386")
add_sanitizer_rt_symbols(clang_rt.asan_cxx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87487.291105.patch
Type: text/x-patch
Size: 2590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/513742e7/attachment.bin>
More information about the llvm-commits
mailing list