1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/test/ExecutionEngine/MCJIT/weak-function.ll
Lang Hames 400134f8ac [RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
This patch causes RuntimeDyld to check for existing definitions when it
encounters weak symbols. If a definition already exists then the new weak
definition is discarded. All symbol lookups within a "logical dylib" should now
agree on the address of any given weak symbol. This allows the JIT to better
match the behavior of the static linker for C++ code.

This support is only partial, as it does not allow strong definitions that
occur after the first weak definition (in JIT symbol lookup order) to override
the previous weak definitions. Support for this will be added in a future
patch.

llvm-svn: 278065
2016-08-08 22:53:37 +00:00

27 lines
511 B
LLVM

; RUN: lli -jit-kind=mcjit -extra-module %p/Inputs/weak-function-2.ll %s
;
; Check that functions in two different modules agree on the address of weak
; function 'baz'
define linkonce_odr i32 @baz() {
entry:
ret i32 0
}
define i8* @foo() {
entry:
ret i8* bitcast (i32 ()* @baz to i8*)
}
declare i8* @bar()
define i32 @main(i32 %argc, i8** %argv) {
entry:
%call = tail call i8* @foo()
%call1 = tail call i8* @bar()
%cmp = icmp ne i8* %call, %call1
%conv = zext i1 %cmp to i32
ret i32 %conv
}