File tree 4 files changed +7
-34
lines changed
4 files changed +7
-34
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,6 @@ set(NSAN_SOURCES
11
11
nsan_suppressions.cpp
12
12
)
13
13
14
- set (NSAN_PREINIT_SOURCES
15
- nsan_preinit.cpp)
16
-
17
14
set (NSAN_HEADERS
18
15
nsan.h
19
16
nsan_flags.h
@@ -64,12 +61,6 @@ if(NOT APPLE)
64
61
ADDITIONAL_HEADERS ${NSAN_HEADERS}
65
62
CFLAGS ${NSAN_CFLAGS} )
66
63
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
-
73
64
file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /dummy.cpp "" )
74
65
add_compiler_rt_object_libraries(RTNsan_dynamic_version_script_dummy
75
66
ARCHS ${NSAN_SUPPORTED_ARCH}
@@ -81,7 +72,7 @@ add_compiler_rt_runtime(
81
72
clang_rt.nsan
82
73
STATIC
83
74
ARCHS ${NSAN_SUPPORTED_ARCH}
84
- OBJECT_LIBS RTNsan_preinit RTNsan
75
+ OBJECT_LIBS RTNsan
85
76
${NSAN_COMMON_RUNTIME_OBJECT_LIBS}
86
77
CFLAGS ${NSAN_CFLAGS}
87
78
PARENT_TARGET nsan)
Original file line number Diff line number Diff line change @@ -779,7 +779,7 @@ extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_dump_shadow_args() {
779
779
bool __nsan::nsan_initialized;
780
780
bool __nsan::nsan_init_is_running;
781
781
782
- extern " C" void __nsan_init () {
782
+ extern " C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_init () {
783
783
CHECK (!nsan_init_is_running);
784
784
if (nsan_initialized)
785
785
return ;
@@ -801,3 +801,8 @@ extern "C" void __nsan_init() {
801
801
nsan_init_is_running = false ;
802
802
nsan_initialized = true ;
803
803
}
804
+
805
+ #if SANITIZER_CAN_USE_PREINIT_ARRAY
806
+ __attribute__ ((section(" .preinit_array" ),
807
+ used)) static void (*nsan_init_ptr)() = __nsan_init;
808
+ #endif
Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ using __sanitizer::uptr;
32
32
// Private nsan interface. Used e.g. by interceptors.
33
33
extern " C" {
34
34
35
- void __nsan_init ();
36
-
37
35
// This marks the shadow type of the given block of application memory as
38
36
// unknown.
39
37
// printf-free (see comment in nsan_interceptors.cc).
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments