Skip to content

Commit 8ae57a6

Browse files
icmccormobraunsdorf
authored andcommitted
Re-enabled preinit and fixed interceptor initialization order.
1 parent 236d1b0 commit 8ae57a6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler-rt/lib/bsan/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ add_compiler_rt_object_libraries(RTBsan
5555
CFLAGS ${BSAN_CFLAGS}
5656
DEPS ${BSAN_DEPS})
5757

58-
if(!APPLE)
58+
if(NOT APPLE)
5959
add_compiler_rt_object_libraries(RTBsan_preinit
6060
OS ${SANITIZER_COMMON_SUPPORTED_OS}
6161
ARCHS ${BSAN_SUPPORTED_ARCH}
@@ -86,6 +86,7 @@ else()
8686
STATIC
8787
ARCHS ${BSAN_SUPPORTED_ARCH}
8888
OBJECT_LIBS RTBsan
89+
RTBsan_preinit
8990
${BSAN_COMMON_RUNTIME_OBJECT_LIBS}
9091
LINK_FLAGS ${BSAN_LINK_FLAGS}
9192
CFLAGS ${BSAN_CFLAGS}

compiler-rt/lib/bsan/bsan_interceptors.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ void InitializeBsanInterceptors() {
135135
static bool was_called_once;
136136
CHECK(!was_called_once);
137137
was_called_once = true;
138+
BSAN_INTERCEPT_FUNC(malloc);
139+
BSAN_INTERCEPT_FUNC(free);
140+
138141
InitializeCommonInterceptors();
142+
139143
}
140144

141145
} // namespace __bsan

0 commit comments

Comments
 (0)