Skip to content

Commit

Permalink
Make the "system image too large" error message more descriptive (#46570
Browse files Browse the repository at this point in the history
)

(cherry picked from commit a7bef77)
  • Loading branch information
DilumAluthge authored and KristofferC committed Sep 16, 2022
1 parent b6883b0 commit cc2b7c5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ done by `get_item_for_reloc`.
#include <stdlib.h>
#include <string.h>
#include <stdio.h> // printf
#include <inttypes.h> // PRIxPTR

#include "julia.h"
#include "julia_internal.h"
Expand Down Expand Up @@ -1956,9 +1957,22 @@ static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED
jl_write_gv_tagrefs(&s);
}

if (sysimg.size > ((uintptr_t)1 << RELOC_TAG_OFFSET) ||
const_data.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)) {
jl_printf(JL_STDERR, "ERROR: system image too large\n");
if (sysimg.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)) {
jl_printf(
JL_STDERR,
"ERROR: system image too large: sysimg.size is %jd but the limit is %" PRIxPTR "\n",
(intmax_t)sysimg.size,
((uintptr_t)1 << RELOC_TAG_OFFSET)
);
jl_exit(1);
}
if (const_data.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)) {
jl_printf(
JL_STDERR,
"ERROR: system image too large: const_data.size is %jd but the limit is %" PRIxPTR "\n",
(intmax_t)const_data.size,
((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)
);
jl_exit(1);
}

Expand Down

0 comments on commit cc2b7c5

Please sign in to comment.