File tree Expand file tree Collapse file tree 8 files changed +27
-36
lines changed Expand file tree Collapse file tree 8 files changed +27
-36
lines changed Original file line number Diff line number Diff line change 15
15
using namespace __asan ;
16
16
17
17
#if SANITIZER_CAN_USE_PREINIT_ARRAY
18
- // The symbol is called __local_asan_preinit, because it's not intended to be
19
- // exported.
20
- // This code linked into the main executable when -fsanitize=address is in
21
- // the link flags. It can only use exported interface functions.
22
- __attribute__ ((section(" .preinit_array" ), used))
23
- void (*__local_asan_preinit)(void ) = __asan_init;
18
+ // This section is linked into the main executable when -fsanitize=hwaddress is
19
+ // specified to perform initialization at a very early stage.
20
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
21
+ __asan_init;
24
22
#endif
Original file line number Diff line number Diff line change 14
14
#include " sanitizer_common/sanitizer_internal_defs.h"
15
15
16
16
#if SANITIZER_CAN_USE_PREINIT_ARRAY
17
- // The symbol is called __local_hwasan_preinit, because it's not intended to
18
- // be exported.
19
- // This code linked into the main executable when -fsanitize=hwaddress is in
20
- // the link flags. It can only use exported interface functions.
21
- __attribute__ ((section(" .preinit_array" ), used)) static void (
22
- *__local_hwasan_preinit)(void ) = __hwasan_init;
17
+ // This section is linked into the main executable when -fsanitize=hwaddress is
18
+ // specified to perform initialization at a very early stage.
19
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
20
+ __hwasan_init;
23
21
#endif
Original file line number Diff line number Diff line change 14
14
#include " lsan.h"
15
15
16
16
#if SANITIZER_CAN_USE_PREINIT_ARRAY
17
- // We force __lsan_init to be called before anyone else by placing it into
18
- // .preinit_array section .
19
- __attribute__ ((section(" .preinit_array" ), used))
20
- void (*__local_lsan_preinit)( void ) = __lsan_init;
17
+ // This section is linked into the main executable when -fsanitize=leak is
18
+ // specified to perform initialization at a very early stage .
19
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
20
+ __lsan_init;
21
21
#endif
Original file line number Diff line number Diff line change 15
15
using namespace __memprof ;
16
16
17
17
#if SANITIZER_CAN_USE_PREINIT_ARRAY
18
- // The symbol is called __local_memprof_preinit, because it's not intended to
19
- // be exported. This code linked into the main executable when -fmemory-profile
20
- // is in the link flags. It can only use exported interface functions.
21
- __attribute__ ((section(" .preinit_array" ),
22
- used)) void (*__local_memprof_preinit)(void ) = __memprof_preinit;
18
+ // This section is linked into the main executable when -fmemory-profile is
19
+ // specified to perform initialization at a very early stage.
20
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
21
+ __memprof_preinit;
23
22
#endif
Original file line number Diff line number Diff line change 13
13
14
14
#if SANITIZER_CAN_USE_PREINIT_ARRAY
15
15
16
- // The symbol is called __local_rtsan_preinit, because it's not intended to be
17
- // exported.
18
- // This code is linked into the main executable when -fsanitize=realtime is in
19
- // the link flags. It can only use exported interface functions.
20
- __attribute__ ((section(" .preinit_array" ),
21
- used)) void (*__local_rtsan_preinit)(void ) = __rtsan_init;
16
+ // This section is linked into the main executable when -fsanitize=realtime is
17
+ // specified to perform initialization at a very early stage.
18
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
19
+ __rtsan_init;
22
20
23
21
#endif
Original file line number Diff line number Diff line change 16
16
17
17
#if SANITIZER_CAN_USE_PREINIT_ARRAY
18
18
19
- // The symbol is called __local_tsan_preinit, because it's not intended to be
20
- // exported.
21
- // This code linked into the main executable when -fsanitize=thread is in
22
- // the link flags. It can only use exported interface functions.
23
- __attribute__ ((section(" .preinit_array" ), used))
24
- void (*__local_tsan_preinit)(void ) = __tsan_init;
19
+ // This section is linked into the main executable when -fsanitize=thread is
20
+ // specified to perform initialization at a very early stage.
21
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
22
+ __tsan_init;
25
23
26
24
#endif
Original file line number Diff line number Diff line change @@ -30,6 +30,6 @@ static void PreInitAsStandalone() {
30
30
31
31
} // namespace __ubsan
32
32
33
- __attribute__ ((section(" .preinit_array" ), used)) void (*__local_ubsan_preinit)(
34
- void ) = __ubsan::PreInitAsStandalone;
33
+ __attribute__ ((section(" .preinit_array" ), used)) static auto preinit =
34
+ __ubsan::PreInitAsStandalone;
35
35
#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
Original file line number Diff line number Diff line change 2
2
// RUN: %t.so && \
3
3
// RUN: %clang_tsan -O1 %s %t.so -o %t && %run %t 2>&1 | FileCheck %s
4
4
// RUN: llvm-objdump -t %t | FileCheck %s --check-prefix=CHECK-DUMP
5
- // CHECK-DUMP: {{[.]preinit_array.*__local_tsan_preinit }}
5
+ // CHECK-DUMP: {{[.]preinit_array.*preinit }}
6
6
7
7
// SANITIZER_CAN_USE_PREINIT_ARRAY is undefined on android.
8
8
// UNSUPPORTED: android
You can’t perform that action at this time.
0 commit comments