Skip to content

Commit e1c463b

Browse files
authored
Revert "[UBSan] [min-rt] make minimal runtime handlers weak" (#156975)
Existing `__ubsan_report_error` should be enough to solve this. Ability to override on two levels, may result in hard to debug bugs when in the same binary strong __ubsan_report_error and __ubsan_handle_##name##_minimal_abort defined in unrelated components. With one entry point we will have at least linking error. Reverts #154220
1 parent b5cebe4 commit e1c463b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
125125
} // namespace __sanitizer
126126
#endif
127127

128+
#define INTERFACE extern "C" __attribute__((visibility("default")))
129+
128130
#define HANDLER_RECOVER(name, kind) \
129-
SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal) { \
131+
INTERFACE void __ubsan_handle_##name##_minimal() { \
130132
__ubsan_report_error(kind, GET_CALLER_PC(), nullptr); \
131133
}
132134

133135
#define HANDLER_NORECOVER(name, kind) \
134-
SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal_abort) { \
136+
INTERFACE void __ubsan_handle_##name##_minimal_abort() { \
135137
uintptr_t caller = GET_CALLER_PC(); \
136138
__ubsan_report_error_fatal(kind, caller, nullptr); \
137139
abort_with_message(kind, caller, nullptr); \
@@ -142,14 +144,13 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
142144
HANDLER_NORECOVER(name, kind)
143145

144146
#define HANDLER_RECOVER_PTR(name, kind) \
145-
SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal, \
146-
const uintptr_t address) { \
147+
INTERFACE void __ubsan_handle_##name##_minimal(const uintptr_t address) { \
147148
__ubsan_report_error(kind, GET_CALLER_PC(), &address); \
148149
}
149150

150151
#define HANDLER_NORECOVER_PTR(name, kind) \
151-
SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal_abort, \
152-
const uintptr_t address) { \
152+
INTERFACE void __ubsan_handle_##name##_minimal_abort( \
153+
const uintptr_t address) { \
153154
uintptr_t caller = GET_CALLER_PC(); \
154155
__ubsan_report_error_fatal(kind, caller, &address); \
155156
abort_with_message(kind, caller, &address); \

0 commit comments

Comments
 (0)