Skip to content

Commit 610cfb4

Browse files
committed
Make postponed relocation probe ABI-independent
1 parent 4366a3a commit 610cfb4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/native.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,9 @@ end
738738
@testset "postponed relocation" begin
739739
if VERSION >= v"1.12"
740740
mod = @eval module $(gensym())
741-
f(x::Symbol) = x === :host_ref_probe
741+
f() = UInt(pointer_from_objref(:host_ref_probe))
742742
end
743-
job, _ = Native.create_job(mod.f, (Symbol,); relocatable=true)
743+
job, _ = Native.create_job(mod.f, Tuple{}; relocatable=true)
744744
JuliaContext() do ctx
745745
obj, meta = GPUCompiler.compile(:obj, job)
746746
refs = meta.host_references
@@ -751,11 +751,12 @@ end
751751

752752
bytes = Vector{UInt8}(codeunits(obj))
753753
entry = LLVM.name(meta.entry)
754+
expected = GPUCompiler.resolve_host_reference(only(values(refs.slots)))
754755
fptr, keepalive = Native.load(bytes, entry, refs)
755756
try
756757
GC.@preserve keepalive begin
757-
@test ccall(fptr, Bool, (Any,), :host_ref_probe)
758-
@test !ccall(fptr, Bool, (Any,), :other)
758+
actual = ccall(fptr, UInt, ())
759+
@test actual == expected
759760
end
760761
finally
761762
dispose(first(keepalive))

0 commit comments

Comments
 (0)