Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pickup ASAN and LLVM assertion build fixes from #43418 #43685

Merged
merged 3 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -718,8 +718,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 @@ -985,7 +984,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