From ddec9e4530742aae8c904b478f3c5e15679455e7 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Wed, 4 Oct 2023 09:53:51 -0400 Subject: [PATCH] Revert "Don't mark nonlocal symbols as hidden (#51530)" This reverts commit e1f1cc8f71eb64f25ff138eaa2cbf9d6604d60b4. --- src/aotcompile.cpp | 8 ++------ src/codegen.cpp | 4 ---- src/staticdata.c | 12 ++++++------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp index a1a8a40a5ce55..05088394500c1 100644 --- a/src/aotcompile.cpp +++ b/src/aotcompile.cpp @@ -835,12 +835,8 @@ static SmallVector partitionModule(Module &M, unsigned threads) { continue; if (!canPartition(G)) continue; - // Currently ccallable global aliases have extern linkage, we only want to make the - // internally linked functions/global variables extern+hidden - if (G.hasLocalLinkage()) { - G.setLinkage(GlobalValue::ExternalLinkage); - G.setVisibility(GlobalValue::HiddenVisibility); - } + G.setLinkage(GlobalValue::ExternalLinkage); + G.setVisibility(GlobalValue::HiddenVisibility); if (auto F = dyn_cast(&G)) { partitioner.make(&G, getFunctionWeight(*F).weight); } else { diff --git a/src/codegen.cpp b/src/codegen.cpp index 9dc671dc0ea97..f72c2ae2056b9 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -6801,10 +6801,6 @@ const char *jl_generate_ccallable(LLVMOrcThreadSafeModuleRef llvmmod, void *sysi int found = jl_dlsym(sysimg_handle, name, &addr, 0); if (found) add_named_global(name, addr); - else { - err = jl_get_exceptionf(jl_errorexception_type, "%s not found in sysimg", name); - jl_throw(err); - } } else { jl_method_instance_t *lam = jl_get_specialization1((jl_tupletype_t*)sigt, world, &min_valid, &max_valid, 0); diff --git a/src/staticdata.c b/src/staticdata.c index 31e7a4c812b1c..a974d98a39835 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -3371,7 +3371,7 @@ static jl_value_t *jl_validate_cache_file(ios_t *f, jl_array_t *depmods, uint64_ } // TODO?: refactor to make it easier to create the "package inspector" -static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, ios_t *f, jl_image_t *image, jl_array_t *depmods, int completeinfo, const char *pkgname, bool needs_permalloc) +static jl_value_t *jl_restore_package_image_from_stream(ios_t *f, jl_image_t *image, jl_array_t *depmods, int completeinfo, const char *pkgname, bool needs_permalloc) { JL_TIMING(LOAD_IMAGE, LOAD_Pkgimg); jl_timing_printf(JL_TIMING_DEFAULT_BLOCK, pkgname); @@ -3426,7 +3426,7 @@ static jl_value_t *jl_restore_package_image_from_stream(void* pkgimage_handle, i size_t world = jl_atomic_load_acquire(&jl_world_counter); jl_insert_backedges((jl_array_t*)edges, (jl_array_t*)ext_targets, (jl_array_t*)new_specializations, world); // restore external backedges (needs to be last) // reinit ccallables - jl_reinit_ccallable(&ccallable_list, base, pkgimage_handle); + jl_reinit_ccallable(&ccallable_list, base, NULL); arraylist_free(&ccallable_list); if (completeinfo) { @@ -3457,11 +3457,11 @@ static void jl_restore_system_image_from_stream(ios_t *f, jl_image_t *image, uin jl_restore_system_image_from_stream_(f, image, NULL, checksum | ((uint64_t)0xfdfcfbfa << 32), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } -JL_DLLEXPORT jl_value_t *jl_restore_incremental_from_buf(void* pkgimage_handle, const char *buf, jl_image_t *image, size_t sz, jl_array_t *depmods, int completeinfo, const char *pkgname, bool needs_permalloc) +JL_DLLEXPORT jl_value_t *jl_restore_incremental_from_buf(const char *buf, jl_image_t *image, size_t sz, jl_array_t *depmods, int completeinfo, const char *pkgname, bool needs_permalloc) { ios_t f; ios_static_buffer(&f, (char*)buf, sz); - jl_value_t *ret = jl_restore_package_image_from_stream(pkgimage_handle, &f, image, depmods, completeinfo, pkgname, needs_permalloc); + jl_value_t *ret = jl_restore_package_image_from_stream(&f, image, depmods, completeinfo, pkgname, needs_permalloc); ios_close(&f); return ret; } @@ -3474,7 +3474,7 @@ JL_DLLEXPORT jl_value_t *jl_restore_incremental(const char *fname, jl_array_t *d "Cache file \"%s\" not found.\n", fname); } jl_image_t pkgimage = {}; - jl_value_t *ret = jl_restore_package_image_from_stream(NULL, &f, &pkgimage, depmods, completeinfo, pkgname, true); + jl_value_t *ret = jl_restore_package_image_from_stream(&f, &pkgimage, depmods, completeinfo, pkgname, true); ios_close(&f); return ret; } @@ -3545,7 +3545,7 @@ JL_DLLEXPORT jl_value_t *jl_restore_package_image_from_file(const char *fname, j jl_image_t pkgimage = jl_init_processor_pkgimg(pkgimg_handle); - jl_value_t* mod = jl_restore_incremental_from_buf(pkgimg_handle, pkgimg_data, &pkgimage, *plen, depmods, completeinfo, pkgname, false); + jl_value_t* mod = jl_restore_incremental_from_buf(pkgimg_data, &pkgimage, *plen, depmods, completeinfo, pkgname, false); return mod; }