forked from OSchip/llvm-project
[hwasan] Add __hwasan_init constructor to runtime lib.
Found by an Android toolchain upgrade, inherited module constructors (like init_have_lse_atomics from the builtins) can sneak into the hwasan runtime. If these inherited constructors call hwasanified libc functions, then the HWASan runtime isn't setup enough, and the code crashes. Mark the initialized as a high-priority initializer to fix this. Reviewed By: pcc, yabinc Differential Revision: https://reviews.llvm.org/D107391
This commit is contained in:
parent
440d9712eb
commit
0ebb756087
|
@ -319,7 +319,7 @@ void __hwasan_init_static() {
|
|||
InitializeSingleGlobal(global);
|
||||
}
|
||||
|
||||
void __hwasan_init() {
|
||||
__attribute__((constructor(0))) void __hwasan_init() {
|
||||
CHECK(!hwasan_init_is_running);
|
||||
if (hwasan_inited) return;
|
||||
hwasan_init_is_running = 1;
|
||||
|
|
Loading…
Reference in New Issue