Skip to content

Commit 0b15f89

Browse files
committed
Revert "[nsan] Add nsan_preinit.cpp and make it static library only"
https://lab.llvm.org/buildbot/#/builders/66/builds/1345 This reverts commit 2cec041.
1 parent 2ca3f87 commit 0b15f89

File tree

4 files changed

+7
-34
lines changed

4 files changed

+7
-34
lines changed

compiler-rt/lib/nsan/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ set(NSAN_SOURCES
1111
nsan_suppressions.cpp
1212
)
1313

14-
set(NSAN_PREINIT_SOURCES
15-
nsan_preinit.cpp)
16-
1714
set(NSAN_HEADERS
1815
nsan.h
1916
nsan_flags.h
@@ -64,12 +61,6 @@ if(NOT APPLE)
6461
ADDITIONAL_HEADERS ${NSAN_HEADERS}
6562
CFLAGS ${NSAN_CFLAGS})
6663

67-
add_compiler_rt_object_libraries(RTNsan_preinit
68-
ARCHS ${NSAN_SUPPORTED_ARCH}
69-
SOURCES ${NSAN_PREINIT_SOURCES}
70-
ADDITIONAL_HEADERS ${NSAN_HEADERS}
71-
CFLAGS ${NSAN_CFLAGS})
72-
7364
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
7465
add_compiler_rt_object_libraries(RTNsan_dynamic_version_script_dummy
7566
ARCHS ${NSAN_SUPPORTED_ARCH}
@@ -81,7 +72,7 @@ add_compiler_rt_runtime(
8172
clang_rt.nsan
8273
STATIC
8374
ARCHS ${NSAN_SUPPORTED_ARCH}
84-
OBJECT_LIBS RTNsan_preinit RTNsan
75+
OBJECT_LIBS RTNsan
8576
${NSAN_COMMON_RUNTIME_OBJECT_LIBS}
8677
CFLAGS ${NSAN_CFLAGS}
8778
PARENT_TARGET nsan)

compiler-rt/lib/nsan/nsan.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_dump_shadow_args() {
779779
bool __nsan::nsan_initialized;
780780
bool __nsan::nsan_init_is_running;
781781

782-
extern "C" void __nsan_init() {
782+
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_init() {
783783
CHECK(!nsan_init_is_running);
784784
if (nsan_initialized)
785785
return;
@@ -801,3 +801,8 @@ extern "C" void __nsan_init() {
801801
nsan_init_is_running = false;
802802
nsan_initialized = true;
803803
}
804+
805+
#if SANITIZER_CAN_USE_PREINIT_ARRAY
806+
__attribute__((section(".preinit_array"),
807+
used)) static void (*nsan_init_ptr)() = __nsan_init;
808+
#endif

compiler-rt/lib/nsan/nsan.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ using __sanitizer::uptr;
3232
// Private nsan interface. Used e.g. by interceptors.
3333
extern "C" {
3434

35-
void __nsan_init();
36-
3735
// This marks the shadow type of the given block of application memory as
3836
// unknown.
3937
// printf-free (see comment in nsan_interceptors.cc).

compiler-rt/lib/nsan/nsan_preinit.cpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)