Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 02699bb

Browse files
authoredFeb 19, 2024
fix sysimage-native-code=no option with pkgimages (#53373)
Loading pkgimages would try to access the sysimage native code, which will fail. Ensure that no code tries to load if the sysimage native code is not available, as it may try to link against it. Fixes #53147
1 parent 9c0f1dc commit 02699bb

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
 

‎src/staticdata.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,8 @@ extern void * JL_WEAK_SYMBOL_OR_ALIAS_DEFAULT(system_image_data_unavailable) jl_
607607
extern void * JL_WEAK_SYMBOL_OR_ALIAS_DEFAULT(system_image_data_unavailable) jl_system_image_size;
608608
static void jl_load_sysimg_so(void)
609609
{
610-
int imaging_mode = jl_generating_output() && !jl_options.incremental;
611-
// in --build mode only use sysimg data, not precompiled native code
612-
if (!imaging_mode && jl_options.use_sysimage_native_code==JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES) {
613-
assert(sysimage.fptrs.ptrs);
614-
}
615-
else {
616-
memset(&sysimage.fptrs, 0, sizeof(sysimage.fptrs));
617-
}
618610
const char *sysimg_data;
611+
assert(sysimage.fptrs.ptrs); // jl_init_processor_sysimg should already be run
619612
if (jl_sysimg_handle == jl_exe_handle &&
620613
&jl_system_image_data != JL_WEAK_SYMBOL_DEFAULT(system_image_data_unavailable))
621614
sysimg_data = (const char*)&jl_system_image_data;
@@ -3097,6 +3090,17 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
30973090
htable_new(&new_dt_objs, 0);
30983091
arraylist_new(&deser_sym, 0);
30993092

3093+
// in --build mode only use sysimg data, not precompiled native code
3094+
int imaging_mode = jl_generating_output() && !jl_options.incremental;
3095+
if (!imaging_mode && jl_options.use_sysimage_native_code == JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES) {
3096+
if (image->gvars_base)
3097+
assert(image->fptrs.ptrs);
3098+
}
3099+
else {
3100+
memset(&image->fptrs, 0, sizeof(image->fptrs));
3101+
image->gvars_base = NULL;
3102+
}
3103+
31003104
// step 1: read section map
31013105
assert(ios_pos(f) == 0 && f->bm == bm_mem);
31023106
size_t sizeof_sysdata = read_uint(f);

7 commit comments

Comments
 (7)

nanosoldier commented on Feb 20, 2024

@nanosoldier
Collaborator

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

nanosoldier commented on Feb 21, 2024

@nanosoldier
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

vtjnash commented on Feb 24, 2024

@vtjnash
MemberAuthor

@nanosoldier runbenchmarks(ALL, isdaily = true)

nanosoldier commented on Feb 24, 2024

@nanosoldier
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

vtjnash commented on Feb 24, 2024

@vtjnash
MemberAuthor

A few scattered improvements, but also some extreme regressions, particularly in inference but also in arrays:

["array", "growth", ("push_single!", 2048)] 2.75 (5%) ❌ 1.00 (1%)
["array", "growth", ("push_single!", 256)] 2.69 (5%) ❌ 1.00 (1%)
["array", "growth", ("push_single!", 8)] 2.69 (5%) ❌ 1.00

vtjnash commented on Feb 24, 2024

@vtjnash
MemberAuthor

@nanosoldier runbenchmarks("inference", vs="@41a6e7b6c839f4828f1dbda66725aabc78b75d50")

nanosoldier commented on Feb 24, 2024

@nanosoldier
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Please sign in to comment.