From 583dbe718a2f35fb0b8f8f6bd1f85a15b11e0b49 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Wed, 31 Aug 2022 16:15:40 -0400 Subject: [PATCH 1/2] Make the "system image too large" error message more descriptive --- src/staticdata.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/staticdata.c b/src/staticdata.c index 1b5fc9bbe3edc..2f52d46693486 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -59,6 +59,7 @@ done by `get_item_for_reloc`. #include #include #include // printf +#include // PRIxPTR #include "julia.h" #include "julia_internal.h" @@ -1947,9 +1948,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: sysimg.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); } From 057f5fc6fa8d0939b71a93fefbecf747c9cbca66 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Wed, 7 Sep 2022 09:38:01 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Denis Barucic --- src/staticdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/staticdata.c b/src/staticdata.c index 2f52d46693486..2066e83ccb54a 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -1960,7 +1960,7 @@ static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED if (const_data.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)) { jl_printf( JL_STDERR, - "ERROR: system image too large: sysimg.size is %jd but the limit is %" PRIxPTR "\n", + "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*) );