Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing codegen fallback functions and fix test #43706

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cli/loader_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,16 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
libjulia_internal = load_library(special_library_names[0], lib_dir, 1);
void *libjulia_codegen = load_library(special_library_names[1], lib_dir, 0);
const char * const * codegen_func_names;
const char *codegen_liberr;
if (libjulia_codegen == NULL) {
// if codegen is not available, use fallback implementation in libjulia-internal
libjulia_codegen = libjulia_internal;
codegen_func_names = jl_codegen_fallback_func_names;
codegen_liberr = " from libjulia-internal\n";
}
else {
codegen_func_names = jl_codegen_exported_func_names;
codegen_liberr = " from libjulia-codegen\n";
}

// Once we have libjulia-internal loaded, re-export its symbols:
Expand All @@ -225,7 +228,7 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
for (unsigned int symbol_idx=0; codegen_func_names[symbol_idx] != NULL; ++symbol_idx) {
void *addr = lookup_symbol(libjulia_codegen, codegen_func_names[symbol_idx]);
if (addr == NULL) {
jl_loader_print_stderr3("ERROR: Unable to load ", codegen_func_names[symbol_idx], " from libjulia-codegen\n");
jl_loader_print_stderr3("ERROR: Unable to load ", codegen_func_names[symbol_idx], codegen_liberr);
exit(1);
}
(*jl_codegen_exported_func_addrs[symbol_idx]) = addr;
Expand Down
10 changes: 9 additions & 1 deletion src/codegen-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ JL_DLLEXPORT void jl_dump_compiles_fallback(void *s)
{
}

JL_DLLEXPORT void jl_dump_emitted_mi_name_fallback(void *s)
{
}

JL_DLLEXPORT void jl_dump_llvm_opt_fallback(void *s)
{
}

JL_DLLEXPORT jl_value_t *jl_dump_fptr_asm_fallback(uint64_t fptr, char raw_mc, const char* asm_variant, const char *debuginfo, char binary) UNAVAILABLE

JL_DLLEXPORT jl_value_t *jl_dump_function_asm_fallback(void *F, char raw_mc, const char* asm_variant, const char *debuginfo, char binary) UNAVAILABLE
Expand Down Expand Up @@ -133,4 +141,4 @@ JL_DLLEXPORT void LLVMExtraAddGCInvariantVerifierPass_fallback(void *PM, bool_t

JL_DLLEXPORT void LLVMExtraAddDemoteFloat16Pass_fallback(void *PM) UNAVAILABLE

JL_DLLEXPORT void LLVMExtraAddCPUFeaturesPass_impl(void *PM) UNAVAILABLE
JL_DLLEXPORT void LLVMExtraAddCPUFeaturesPass_fallback(void *PM) UNAVAILABLE
4 changes: 2 additions & 2 deletions test/compiler/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ mktempdir() do pfx
libpath = relpath(dirname(dlpath("libjulia-codegen")), dirname(Sys.BINDIR))
libs_deleted = 0
for f in filter(f -> startswith(f, "libjulia-codegen"), readdir(joinpath(pfx, libpath)))
rm(f; force=true, recursive=true)
rm(joinpath(pfx, libpath, f); force=true, recursive=true)
libs_deleted += 1
end
@test libs_deleted > 0
@test readchomp(`$pfx/bin/$(Base.julia_exename()) -e 'println("no codegen!")'`) == "no codegen!"
@test readchomp(`$pfx/bin/$(Base.julia_exename()) -e 'print("no codegen!\n")'`) == "no codegen!"
end

# issue #42645
Expand Down