Skip to content

Commit

Permalink
Don't touch gvars when compiling for an external back-end.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jan 25, 2021
1 parent dbaca8b commit df2a1c5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static void jl_ci_cache_lookup(const jl_cgparams_t &cgparams, jl_method_instance
// takes the running content that has collected in the shadow module and dump it to disk
// this builds the object file portion of the sysimage files for fast startup, and can
// also be used be extern consumers like GPUCompiler.jl to obtain a module containing
// all reachable & inferrrable functions. The `policy` flag switches between the defaul
// all reachable & inferrrable functions. The `policy` flag switches between the default
// mode `0` and the extern mode `1`.
extern "C" JL_DLLEXPORT
void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _policy)
Expand Down Expand Up @@ -404,16 +404,18 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p

// move everything inside, now that we've merged everything
// (before adding the exported headers)
for (GlobalObject &G : clone->global_objects()) {
if (!G.isDeclaration()) {
G.setLinkage(Function::InternalLinkage);
makeSafeName(G);
addComdat(&G);
if (policy != CompilationPolicy::Extern) {
for (GlobalObject &G : clone->global_objects()) {
if (!G.isDeclaration()) {
G.setLinkage(Function::InternalLinkage);
makeSafeName(G);
addComdat(&G);
#if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_)
// Add unwind exception personalities to functions to handle async exceptions
if (Function *F = dyn_cast<Function>(&G))
F->setPersonalityFn(juliapersonality_func);
// Add unwind exception personalities to functions to handle async exceptions
if (Function *F = dyn_cast<Function>(&G))
F->setPersonalityFn(juliapersonality_func);
#endif
}
}
}

Expand Down

0 comments on commit df2a1c5

Please sign in to comment.