Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/include/clang/Driver/SanitizerArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class SanitizerArgs {
bool DiagnoseErrors = true);

bool needsSharedRt() const { return SharedRuntime; }
bool needsStableAbi() const { return StableABI; }

bool needsMemProfRt() const { return NeedsMemProfRt; }
bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); }
Expand Down
9 changes: 7 additions & 2 deletions clang/lib/Driver/ToolChains/Darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,8 +1619,13 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
}

if (Sanitize.linkRuntimes()) {
if (Sanitize.needsAsanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
if (Sanitize.needsAsanRt()) {
if (Sanitize.needsStableAbi()) {
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan_abi", /*shared=*/false);
} else {
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
}
}
if (Sanitize.needsLsanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan");
if (Sanitize.needsUbsanRt()) {
Expand Down
2 changes: 0 additions & 2 deletions compiler-rt/test/asan_abi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set(ASAN_ABI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND ASAN_ABI_TEST_DEPS asan_abi)
endif()
set(ASAN_ABI_DYNAMIC_TEST_DEPS ${ASAN_ABI_TEST_DEPS})

set(ASAN_ABI_TEST_ARCH ${ASAN_ABI_SUPPORTED_ARCH})
if(APPLE)
Expand All @@ -27,7 +26,6 @@ foreach(arch ${ASAN_ABI_TEST_ARCH})
string(TOLOWER "-${arch}-${OS_NAME}" ASAN_ABI_TEST_CONFIG_SUFFIX)
get_bits_for_arch(${arch} ASAN_ABI_TEST_BITS)
get_test_cc_for_arch(${arch} ASAN_ABI_TEST_TARGET_CC ASAN_ABI_TEST_TARGET_CFLAGS)
set(ASAN_ABI_TEST_DYNAMIC True)

string(TOUPPER ${arch} ARCH_UPPER_CASE)
set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_asan_abi -O0 -c -fsanitize-stable-abi -fsanitize=address %s -o %t.o
// RUN: %clangxx -c %p/../../../../lib/asan_abi/asan_abi.cpp -o asan_abi.o
// RUN: %clangxx -dead_strip -o %t %t.o %libasan_abi asan_abi.o && %run %t 2>&1
// RUN: %clangxx -dead_strip -o %t %t.o -fsanitize-stable-abi -fsanitize=address asan_abi.o && %run %t 2>&1
// RUN: %clangxx -x c++-header -o - -E %p/../../../../lib/asan/asan_interface.inc \
// RUN: | sed "s/INTERFACE_FUNCTION/\nINTERFACE_FUNCTION/g" > %t.asan_interface.inc
// RUN: llvm-nm -g %libasan_abi \
Expand All @@ -22,6 +22,9 @@
// RUN: sort %t.exports | uniq > %t.exports-sorted
// RUN: diff %t.imports-sorted %t.exports-sorted

// Ensure that there is no dynamic dylib linked.
// RUN: otool -L %t | (! grep -q "dynamic.dylib")

// UNSUPPORTED: ios

int main() { return 0; }
2 changes: 1 addition & 1 deletion compiler-rt/test/asan_abi/TestCases/linkstaticlibrary.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_asan_abi -O2 -c -fsanitize-stable-abi -fsanitize=address -O0 %s -o %t.o
// RUN: %clangxx -c %p/../../../lib/asan_abi/asan_abi.cpp -o asan_abi.o
// RUN: %clangxx -o %t %t.o %libasan_abi asan_abi.o && %run %t 2>&1
// RUN: %clangxx -o %t %t.o -fsanitize-stable-abi -fsanitize=address asan_abi.o && %run %t 2>&1

int main() { return 0; }
1 change: 0 additions & 1 deletion compiler-rt/test/asan_abi/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ config.bits = "@ASAN_ABI_TEST_BITS@"
config.arm_thumb = "@COMPILER_RT_ARM_THUMB@"
config.apple_platform = "@ASAN_ABI_TEST_APPLE_PLATFORM@"
config.apple_platform_min_deployment_target_flag = "@ASAN_ABI_TEST_MIN_DEPLOYMENT_TARGET_FLAG@"
config.asan_abi_dynamic = @ASAN_ABI_TEST_DYNAMIC@
config.target_arch = "@ASAN_ABI_TEST_TARGET_ARCH@"

# Load common config for all compiler-rt lit tests.
Expand Down