Skip to content

Commit 035441f

Browse files
committed
[ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.
Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D121405
1 parent d90d45f commit 035441f

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
842842
if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes())
843843
StaticRuntimes.push_back("stats_client");
844844

845-
// Always link the static runtime regardless of DSO or executable.
846-
if (SanArgs.needsAsanRt())
847-
HelperStaticRuntimes.push_back("asan_static");
848-
849845
// Collect static runtimes.
850846
if (Args.hasArg(options::OPT_shared)) {
851847
// Don't link static runtimes into DSOs.

clang/test/Driver/sanitizer-ld.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
3131
// RUN: | FileCheck --check-prefix=CHECK-ASAN-EXECUTABLE-LINUX %s
3232
//
33-
// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan_static-x86_64
3433
// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan-x86_64
3534

3635
// RUN: %clang -fsanitize=address -shared %s -### -o %t.o 2>&1 \
@@ -39,7 +38,6 @@
3938
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
4039
// RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
4140
//
42-
// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static-x86_64
4341
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan-x86_64
4442

4543
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \

compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ set(ASAN_SOURCES
3434

3535
if (NOT WIN32 AND NOT APPLE)
3636
list(APPEND ASAN_SOURCES
37+
asan_rtl_x86_64.S
3738
asan_interceptors_vfork.S
3839
)
3940
endif()
@@ -48,7 +49,6 @@ set(ASAN_STATIC_SOURCES
4849

4950
if (NOT WIN32 AND NOT APPLE)
5051
list(APPEND ASAN_STATIC_SOURCES
51-
asan_rtl_x86_64.S
5252
)
5353
endif()
5454

compiler-rt/lib/asan/asan_rtl_x86_64.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ CLABEL(reg, op, 1, i): ;\
4242
pop %rcx ;\
4343
jl RLABEL(reg, op, 1, i);\
4444
mov %##reg,%rdi ;\
45-
jmp __asan_report_##op##1_asm ;\
45+
jmp __asan_report_##op##1 ;\
4646

4747
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_2(reg, op, i) \
4848
CLABEL(reg, op, 2, i): ;\
@@ -54,7 +54,7 @@ CLABEL(reg, op, 2, i): ;\
5454
pop %rcx ;\
5555
jl RLABEL(reg, op, 2, i);\
5656
mov %##reg,%rdi ;\
57-
jmp __asan_report_##op##2_asm ;\
57+
jmp __asan_report_##op##2 ;\
5858

5959
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_4(reg, op, i) \
6060
CLABEL(reg, op, 4, i): ;\
@@ -66,7 +66,7 @@ CLABEL(reg, op, 4, i): ;\
6666
pop %rcx ;\
6767
jl RLABEL(reg, op, 4, i);\
6868
mov %##reg,%rdi ;\
69-
jmp __asan_report_##op##4_asm ;\
69+
jmp __asan_report_##op##4 ;\
7070

7171
#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_1(reg, op) \
7272
BEGINF(reg, op, 1, add) ;\
@@ -97,7 +97,7 @@ ENDF
9797
#define ASAN_MEMORY_ACCESS_FAIL(reg, op, s, i) \
9898
FLABEL(reg, op, s, i): ;\
9999
mov %##reg,%rdi ;\
100-
jmp __asan_report_##op##s##_asm;\
100+
jmp __asan_report_##op##s##;\
101101

102102
#define ASAN_MEMORY_ACCESS_CALLBACK_ADD_8(reg, op) \
103103
BEGINF(reg, op, 8, add) ;\

0 commit comments

Comments
 (0)