[PATCH] D121405: [ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.
Kirill Stoimenov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 10 12:42:34 PST 2022
kstoimenov created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
kstoimenov requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added subscribers: Sanitizers, cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121405
Files:
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
Index: compiler-rt/lib/asan/asan_rtl_x86_64.S
===================================================================
--- compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -42,7 +42,7 @@
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 @@
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 @@
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 @@
#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) ;\
Index: compiler-rt/lib/asan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/asan/CMakeLists.txt
+++ compiler-rt/lib/asan/CMakeLists.txt
@@ -34,6 +34,7 @@
if (NOT WIN32 AND NOT APPLE)
list(APPEND ASAN_SOURCES
+ asan_rtl_x86_64.S
asan_interceptors_vfork.S
)
endif()
@@ -48,7 +49,6 @@
if (NOT WIN32 AND NOT APPLE)
list(APPEND ASAN_STATIC_SOURCES
- asan_rtl_x86_64.S
)
endif()
Index: clang/test/Driver/sanitizer-ld.c
===================================================================
--- clang/test/Driver/sanitizer-ld.c
+++ 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 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -842,10 +842,6 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121405.414466.patch
Type: text/x-patch
Size: 3260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220310/a9f97ed9/attachment.bin>
More information about the cfe-commits
mailing list