Created
March 29, 2022 15:18
-
-
Save Gnimuc/00cb849d6df9ff8884520a6ec24dc5cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> using LLVM | |
julia> IR = raw""" | |
@_ZN5julia4var1E = constant i64 1, align 8 | |
declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) | |
@__dso_handle = external hidden global i8 | |
define dso_local i64 @_Z4foo1v() #0 { | |
entry: | |
%0 = load i64, i64* @_ZN5julia4var1E, align 8 | |
ret i64 %0 | |
} | |
""" | |
"@_ZN5julia4var1E = constant i64 1, align 8\n\ndeclare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)\n@__dso_handle = external hidden global i8\n\ndefine dso_local i64 @_Z4foo1v() #0 {\nentry:\n %0 = load i64, i64* @_ZN5julia4var1E, align 8\n ret i64 %0\n}\n" | |
julia> @eval f() = Base.llvmcall(($IR, "_Z4foo1v"), Int64, Tuple{}) | |
f (generic function with 1 method) | |
julia> f() | |
1 | |
julia> IR2 = raw""" | |
@_ZN5julia4var1E = constant i64 1, align 8 | |
declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) | |
@__dso_handle = external hidden global i8 | |
define dso_local i64 @_Z4bar1v() #0 { | |
entry: | |
%0 = load i64, i64* @_ZN5julia4var1E, align 8 | |
ret i64 %0 | |
} | |
""" | |
"@_ZN5julia4var1E = constant i64 1, align 8\n\ndeclare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)\n@__dso_handle = external hidden global i8\n\ndefine dso_local i64 @_Z4bar1v() #0 {\nentry:\n %0 = load i64, i64* @_ZN5julia4var1E, align 8\n ret i64 %0\n}\n" | |
julia> @eval g() = Base.llvmcall(($IR2, "_Z4bar1v"), Int64, Tuple{}) | |
g (generic function with 1 method) | |
julia> g() | |
Failure value returned from cantFail wrapped call | |
Duplicate definition of symbol '__ZN5julia4var1E' | |
UNREACHABLE executed at /Users/julia/buildbot/worker/package_macos64/build/usr/include/llvm/Support/Error.h:718! | |
signal (6): Abort trap: 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment