Skip to content

Commit 319d596

Browse files
[ASan][cmake] Exclude .so build when building for WASI by default
1 parent e55172f commit 319d596

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Build for the AddressSanitizer runtime support library.
22

3+
set(COMPILER_RT_ASAN_BUILD_SHARED_LIBS_default ON)
4+
if (CMAKE_SYSTEM_NAME STREQUAL "WASI")
5+
set(COMPILER_RT_ASAN_BUILD_SHARED_LIBS_default OFF)
6+
endif()
7+
option(COMPILER_RT_ASAN_BUILD_SHARED_LIBS
8+
"Build AddressSanitizer shared libraries" ${COMPILER_RT_ASAN_BUILD_SHARED_LIBS_default})
9+
310
set(ASAN_SOURCES
411
asan_allocator.cpp
512
asan_activation.cpp
@@ -307,25 +314,27 @@ else()
307314
endif()
308315

309316
set(ASAN_DYNAMIC_WEAK_INTERCEPTION)
310-
add_compiler_rt_runtime(clang_rt.asan
311-
SHARED
312-
ARCHS ${arch}
313-
OBJECT_LIBS ${ASAN_COMMON_RUNTIME_OBJECT_LIBS}
314-
RTAsan_dynamic
315-
# The only purpose of RTAsan_dynamic_version_script_dummy is to
316-
# carry a dependency of the shared runtime on the version script.
317-
# Replacing it with a straightforward
318-
# add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
319-
# generates an order-only dependency in ninja.
320-
RTAsan_dynamic_version_script_dummy
321-
RTUbsan_cxx
322-
${ASAN_DYNAMIC_WEAK_INTERCEPTION}
323-
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
324-
LINK_FLAGS ${ASAN_DYNAMIC_LINK_FLAGS}
325-
${VERSION_SCRIPT_FLAG}
326-
LINK_LIBS ${ASAN_DYNAMIC_LIBS}
327-
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
328-
PARENT_TARGET asan)
317+
if (COMPILER_RT_ASAN_BUILD_SHARED_LIBS)
318+
add_compiler_rt_runtime(clang_rt.asan
319+
SHARED
320+
ARCHS ${arch}
321+
OBJECT_LIBS ${ASAN_COMMON_RUNTIME_OBJECT_LIBS}
322+
RTAsan_dynamic
323+
# The only purpose of RTAsan_dynamic_version_script_dummy is to
324+
# carry a dependency of the shared runtime on the version script.
325+
# Replacing it with a straightforward
326+
# add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
327+
# generates an order-only dependency in ninja.
328+
RTAsan_dynamic_version_script_dummy
329+
RTUbsan_cxx
330+
${ASAN_DYNAMIC_WEAK_INTERCEPTION}
331+
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
332+
LINK_FLAGS ${ASAN_DYNAMIC_LINK_FLAGS}
333+
${VERSION_SCRIPT_FLAG}
334+
LINK_LIBS ${ASAN_DYNAMIC_LIBS}
335+
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
336+
PARENT_TARGET asan)
337+
endif()
329338

330339
if (SANITIZER_USE_SYMBOLS AND NOT ${arch} STREQUAL "i386")
331340
add_sanitizer_rt_symbols(clang_rt.asan_cxx

0 commit comments

Comments
 (0)