Skip to content

Commit b0e13be

Browse files
authored
Simplify libjulia usage (#1687)
* Simplify libjulia usage * try fix * fx * champ * tmp * fix * bump
1 parent 5f34de2 commit b0e13be

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/compiler/orcv1.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ function resolver(name, ctx)
131131

132132
found = false
133133
val = nothing
134-
hnd = Libdl.dlopen("libjulia")
134+
135+
hnd = unsafe_load(cglobal(:jl_libjulia_handle, Ptr{Cvoid}))
135136
for (k, v) in Compiler.JuliaGlobalNameMap
136137
if "ejl_"*k == name
137138
val = unsafe_load(Base.reinterpret(Ptr{Ptr{Cvoid}}, Libdl.dlsym(hnd, k)))

src/compiler/orcv2.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ function __init__()
132132
jit[] = CompilerInstance(lljit, nothing, nothing)
133133
end
134134

135-
hnd = Libdl.dlopen("libjulia")
136-
135+
hnd = @static if VERSION >= v"1.10"
136+
unsafe_load(cglobal(:jl_libjulia_handle, Ptr{Cvoid}))
137+
else
138+
Libdl.dlopen("libjulia")
139+
end
137140
for (k, v) in Compiler.JuliaGlobalNameMap
138141
ptr = unsafe_load(Base.reinterpret(Ptr{Ptr{Cvoid}}, Libdl.dlsym(hnd, k)))
139142
LLVM.define(jd_main, absolute_symbol_materialization(mangle(lljit, "ejl_"*k), ptr))

0 commit comments

Comments
 (0)