[clang] 035441f - [ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.
Kirill Stoimenov via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 10 13:11:51 PST 2022
Author: Kirill Stoimenov
Date: 2022-03-10T21:11:32Z
New Revision: 035441ff3008c2a1930363751c6db61b71a5f089
URL: https://github.com/llvm/llvm-project/commit/035441ff3008c2a1930363751c6db61b71a5f089
DIFF: https://github.com/llvm/llvm-project/commit/035441ff3008c2a1930363751c6db61b71a5f089.diff
LOG: [ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D121405
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/sanitizer-ld.c
compiler-rt/lib/asan/CMakeLists.txt
compiler-rt/lib/asan/asan_rtl_x86_64.S
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index abbba00e97537..2f3dc86eaad1d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -842,10 +842,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes())
StaticRuntimes.push_back("stats_client");
- // Always link the static runtime regardless of DSO or executable.
- if (SanArgs.needsAsanRt())
- HelperStaticRuntimes.push_back("asan_static");
-
// Collect static runtimes.
if (Args.hasArg(options::OPT_shared)) {
// Don't link static runtimes into DSOs.
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index 966edbd7d038b..9a7a7db284c5d 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -30,7 +30,6 @@
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-EXECUTABLE-LINUX %s
//
-// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan_static-x86_64
// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan-x86_64
// RUN: %clang -fsanitize=address -shared %s -### -o %t.o 2>&1 \
@@ -39,7 +38,6 @@
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
//
-// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static-x86_64
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan-x86_64
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index 0e7250a8fa10b..0862a3d648fa2 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -34,6 +34,7 @@ set(ASAN_SOURCES
if (NOT WIN32 AND NOT APPLE)
list(APPEND ASAN_SOURCES
+ asan_rtl_x86_64.S
asan_interceptors_vfork.S
)
endif()
@@ -48,7 +49,6 @@ set(ASAN_STATIC_SOURCES
if (NOT WIN32 AND NOT APPLE)
list(APPEND ASAN_STATIC_SOURCES
- asan_rtl_x86_64.S
)
endif()
diff --git a/compiler-rt/lib/asan/asan_rtl_x86_64.S b/compiler-rt/lib/asan/asan_rtl_x86_64.S
index 50e039e53d626..92376f5b9a78f 100644
--- a/compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ b/compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -42,7 +42,7 @@ CLABEL(reg, op, 1, i): ;\
pop %rcx ;\
jl RLABEL(reg, op, 1, i);\
mov %##reg,%rdi ;\
- jmp __asan_report_##op##1_asm ;\
+ jmp __asan_report_##op##1 ;\
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_2(reg, op, i) \
CLABEL(reg, op, 2, i): ;\
@@ -54,7 +54,7 @@ CLABEL(reg, op, 2, i): ;\
pop %rcx ;\
jl RLABEL(reg, op, 2, i);\
mov %##reg,%rdi ;\
- jmp __asan_report_##op##2_asm ;\
+ jmp __asan_report_##op##2 ;\
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_4(reg, op, i) \
CLABEL(reg, op, 4, i): ;\
@@ -66,7 +66,7 @@ CLABEL(reg, op, 4, i): ;\
pop %rcx ;\
jl RLABEL(reg, op, 4, i);\
mov %##reg,%rdi ;\
- jmp __asan_report_##op##4_asm ;\
+ jmp __asan_report_##op##4 ;\
#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_1(reg, op) \
BEGINF(reg, op, 1, add) ;\
@@ -97,7 +97,7 @@ ENDF
#define ASAN_MEMORY_ACCESS_FAIL(reg, op, s, i) \
FLABEL(reg, op, s, i): ;\
mov %##reg,%rdi ;\
- jmp __asan_report_##op##s##_asm;\
+ jmp __asan_report_##op##s##;\
#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_8(reg, op) \
BEGINF(reg, op, 8, add) ;\
More information about the cfe-commits
mailing list