Skip to content

Commit

Permalink
Merge pull request #43685 from JuliaLang/vc/llvm_asan
Browse files Browse the repository at this point in the history
Pickup TSAN/ASAN and LLVM assertion build fixes from #43418
  • Loading branch information
vtjnash authored Jan 20, 2022
2 parents f67371d + dd2e112 commit 2e854a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 9 additions & 0 deletions cli/loader_exe.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ int main(int argc, char * argv[])
return ret;
}

#if defined(__GLIBC__) && (defined(_COMPILER_ASAN_ENABLED_) || defined(_COMPILER_TSAN_ENABLED_))
// fork is generally bad news, but it is better if we prevent applications from
// making it worse as openblas threadpools cause it to hang
int __register_atfork232(void (*prepare)(void), void (*parent)(void), void (*child)(void), void *dso_handle) {
return 0;
}
__asm__ (".symver __register_atfork232, __register_atfork@@GLIBC_2.3.2");
#endif

#ifdef __cplusplus
} // extern "C"
#endif
2 changes: 1 addition & 1 deletion cli/loader_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
}
// jl_options must be initialized very early, in case an embedder sets some
// values there before calling jl_init
((void (*)())jl_init_options_addr)();
((void (*)(void))jl_init_options_addr)();

for (unsigned int symbol_idx=0; codegen_func_names[symbol_idx] != NULL; ++symbol_idx) {
void *addr = lookup_symbol(libjulia_codegen, codegen_func_names[symbol_idx]);
Expand Down
5 changes: 2 additions & 3 deletions src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ void jl_register_fptrs_impl(uint64_t sysimage_base, const jl_sysimg_fptrs_t *fpt
template<typename T>
static inline void ignoreError(T &err) JL_NOTSAFEPOINT
{
#if !defined(NDEBUG)
// Needed only with LLVM assertion build
#if !defined(NDEBUG) // Needed only with LLVM assertion build
consumeError(err.takeError());
#endif
}
Expand Down Expand Up @@ -937,7 +936,7 @@ static objfileentry_t &find_object_file(uint64_t fbase, StringRef fname) JL_NOTS
if (DebugInfo) {
errorobj = std::move(DebugInfo);
// Yes, we've checked, and yes LLVM want us to check again.
assert(errorobj);
ignoreError(errorobj);
debugobj = errorobj->getBinary();
}
else {
Expand Down

0 comments on commit 2e854a4

Please sign in to comment.