Skip to content

Commit 37dce77

Browse files
[ASan] Exclude .so build when building for WASI by default
1 parent d19dfde commit 37dce77

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
@@ -296,25 +303,27 @@ else()
296303
SanitizerCommonWeakInterception)
297304
endif()
298305

299-
add_compiler_rt_runtime(clang_rt.asan
300-
SHARED
301-
ARCHS ${arch}
302-
OBJECT_LIBS ${ASAN_COMMON_RUNTIME_OBJECT_LIBS}
303-
RTAsan_dynamic
304-
# The only purpose of RTAsan_dynamic_version_script_dummy is to
305-
# carry a dependency of the shared runtime on the version script.
306-
# Replacing it with a straightforward
307-
# add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
308-
# generates an order-only dependency in ninja.
309-
RTAsan_dynamic_version_script_dummy
310-
RTUbsan_cxx
311-
${ASAN_DYNAMIC_WEAK_INTERCEPTION}
312-
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
313-
LINK_FLAGS ${ASAN_DYNAMIC_LINK_FLAGS}
314-
${VERSION_SCRIPT_FLAG}
315-
LINK_LIBS ${ASAN_DYNAMIC_LIBS}
316-
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
317-
PARENT_TARGET asan)
306+
if (COMPILER_RT_ASAN_BUILD_SHARED_LIBS)
307+
add_compiler_rt_runtime(clang_rt.asan
308+
SHARED
309+
ARCHS ${arch}
310+
OBJECT_LIBS ${ASAN_COMMON_RUNTIME_OBJECT_LIBS}
311+
RTAsan_dynamic
312+
# The only purpose of RTAsan_dynamic_version_script_dummy is to
313+
# carry a dependency of the shared runtime on the version script.
314+
# Replacing it with a straightforward
315+
# add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
316+
# generates an order-only dependency in ninja.
317+
RTAsan_dynamic_version_script_dummy
318+
RTUbsan_cxx
319+
${ASAN_DYNAMIC_WEAK_INTERCEPTION}
320+
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
321+
LINK_FLAGS ${ASAN_DYNAMIC_LINK_FLAGS}
322+
${VERSION_SCRIPT_FLAG}
323+
LINK_LIBS ${ASAN_DYNAMIC_LIBS}
324+
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
325+
PARENT_TARGET asan)
326+
endif()
318327

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

0 commit comments

Comments
 (0)