[CompilerRT] Remove ubsan static runtime on Apple
This patch removes the static ubsan runtime on Apple devices. The motivation is to reduce the toolchain size. rdar://102061519 Differential Revision: https://reviews.llvm.org/D141550
This commit is contained in:
parent
bbb73fbceb
commit
a44477b1f4
|
@ -215,6 +215,8 @@ def err_drv_malformed_sanitizer_coverage_allowlist : Error<
|
|||
"malformed sanitizer coverage allowlist: '%0'">;
|
||||
def err_drv_malformed_sanitizer_coverage_ignorelist : Error<
|
||||
"malformed sanitizer coverage ignorelist: '%0'">;
|
||||
def err_drv_unsupported_static_ubsan_darwin : Error<
|
||||
"static UndefinedBehaviorSanitizer runtime is not supported on darwin">;
|
||||
def err_drv_duplicate_config : Error<
|
||||
"no more than one option '--config' is allowed">;
|
||||
def err_drv_cannot_open_config_file : Error<
|
||||
|
|
|
@ -1425,15 +1425,22 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|||
}
|
||||
|
||||
const SanitizerArgs &Sanitize = getSanitizerArgs(Args);
|
||||
|
||||
if (!Sanitize.needsSharedRt() && Sanitize.needsUbsanRt()) {
|
||||
getDriver().Diag(diag::err_drv_unsupported_static_ubsan_darwin);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Sanitize.needsAsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
|
||||
if (Sanitize.needsLsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan");
|
||||
if (Sanitize.needsUbsanRt())
|
||||
if (Sanitize.needsUbsanRt()) {
|
||||
assert(Sanitize.needsSharedRt() && "Static sanitizer runtimes not supported");
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs,
|
||||
Sanitize.requiresMinimalRuntime() ? "ubsan_minimal"
|
||||
: "ubsan",
|
||||
Sanitize.needsSharedRt());
|
||||
: "ubsan");
|
||||
}
|
||||
if (Sanitize.needsTsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "tsan");
|
||||
if (Sanitize.needsFuzzer() && !Args.hasArg(options::OPT_dynamiclib)) {
|
||||
|
|
|
@ -423,8 +423,7 @@
|
|||
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
|
||||
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
||||
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}libclang_rt.ubsan_osx.a"
|
||||
// CHECK-UBSAN-STATIC-DARWIN: {{.*}}error: static UndefinedBehaviorSanitizer runtime is not supported on darwin
|
||||
|
||||
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
||||
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
||||
|
|
|
@ -114,19 +114,21 @@ if(APPLE)
|
|||
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
|
||||
PARENT_TARGET ubsan)
|
||||
|
||||
add_compiler_rt_runtime(clang_rt.ubsan
|
||||
STATIC
|
||||
OS ${UBSAN_SUPPORTED_OS}
|
||||
ARCHS ${UBSAN_SUPPORTED_ARCH}
|
||||
OBJECT_LIBS RTUbsan
|
||||
RTUbsan_standalone
|
||||
RTSanitizerCommonNoHooks
|
||||
RTSanitizerCommonLibcNoHooks
|
||||
RTSanitizerCommonCoverage
|
||||
RTSanitizerCommonSymbolizerNoHooks
|
||||
RTInterception
|
||||
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
|
||||
PARENT_TARGET ubsan)
|
||||
if (NOT APPLE)
|
||||
add_compiler_rt_runtime(clang_rt.ubsan
|
||||
STATIC
|
||||
OS ${UBSAN_SUPPORTED_OS}
|
||||
ARCHS ${UBSAN_SUPPORTED_ARCH}
|
||||
OBJECT_LIBS RTUbsan
|
||||
RTUbsan_standalone
|
||||
RTSanitizerCommonNoHooks
|
||||
RTSanitizerCommonLibcNoHooks
|
||||
RTSanitizerCommonCoverage
|
||||
RTSanitizerCommonSymbolizerNoHooks
|
||||
RTInterception
|
||||
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
|
||||
PARENT_TARGET ubsan)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
|
|
@ -101,7 +101,6 @@ if(APPLE)
|
|||
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
||||
get_test_cc_for_arch(${arch} UBSAN_TEST_TARGET_CC UBSAN_TEST_TARGET_CFLAGS)
|
||||
set(UBSAN_TEST_TARGET_CFLAGS "${UBSAN_TEST_TARGET_CFLAGS} -lc++abi")
|
||||
add_ubsan_testsuites("StandaloneStatic" ubsan ${arch})
|
||||
endforeach()
|
||||
|
||||
# Device and simulator test suites.
|
||||
|
|
Loading…
Reference in New Issue
Block a user