Skip to content

Commit d0b97ea

Browse files
maleadtKristofferC
authored andcommitted
Don't touch gvars when compiling for an external back-end.
(cherry picked from commit df2a1c5)
1 parent bfae07c commit d0b97ea

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/aotcompile.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static void jl_ci_cache_lookup(const jl_cgparams_t &cgparams, jl_method_instance
279279
// takes the running content that has collected in the shadow module and dump it to disk
280280
// this builds the object file portion of the sysimage files for fast startup, and can
281281
// also be used be extern consumers like GPUCompiler.jl to obtain a module containing
282-
// all reachable & inferrrable functions. The `policy` flag switches between the defaul
282+
// all reachable & inferrrable functions. The `policy` flag switches between the default
283283
// mode `0` and the extern mode `1`.
284284
extern "C" JL_DLLEXPORT
285285
void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _policy)
@@ -404,16 +404,18 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p
404404

405405
// move everything inside, now that we've merged everything
406406
// (before adding the exported headers)
407-
for (GlobalObject &G : clone->global_objects()) {
408-
if (!G.isDeclaration()) {
409-
G.setLinkage(Function::InternalLinkage);
410-
makeSafeName(G);
411-
addComdat(&G);
407+
if (policy != CompilationPolicy::Extern) {
408+
for (GlobalObject &G : clone->global_objects()) {
409+
if (!G.isDeclaration()) {
410+
G.setLinkage(Function::InternalLinkage);
411+
makeSafeName(G);
412+
addComdat(&G);
412413
#if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_)
413-
// Add unwind exception personalities to functions to handle async exceptions
414-
if (Function *F = dyn_cast<Function>(&G))
415-
F->setPersonalityFn(juliapersonality_func);
414+
// Add unwind exception personalities to functions to handle async exceptions
415+
if (Function *F = dyn_cast<Function>(&G))
416+
F->setPersonalityFn(juliapersonality_func);
416417
#endif
418+
}
417419
}
418420
}
419421

0 commit comments

Comments
 (0)