1bb9431acSLang Hames; RUN: lli -jit-kind=mcjit -extra-module %p/Inputs/weak-function-2.ll %s
2*c42c67adSStefan Gränitz; RUN: lli -extra-module %p/Inputs/weak-function-2.ll %s
3ac2f5a61SPaul Robinson; UNSUPPORTED: uses_COFF
4bb9431acSLang Hames;
5bb9431acSLang Hames; Check that functions in two different modules agree on the address of weak
6bb9431acSLang Hames; function 'baz'
7ae73b0a9SLang Hames; Testing on COFF platforms is disabled as COFF has no representation of 'weak'
8ae73b0a9SLang Hames; linkage.
9bb9431acSLang Hames
10ae73b0a9SLang Hamesdefine weak i32 @baz() {
11bb9431acSLang Hamesentry:
12bb9431acSLang Hames  ret i32 0
13bb9431acSLang Hames}
14bb9431acSLang Hames
15bb9431acSLang Hamesdefine i8* @foo() {
16bb9431acSLang Hamesentry:
17bb9431acSLang Hames  ret i8* bitcast (i32 ()* @baz to i8*)
18bb9431acSLang Hames}
19bb9431acSLang Hames
20bb9431acSLang Hamesdeclare i8* @bar()
21bb9431acSLang Hames
22bb9431acSLang Hamesdefine i32 @main(i32 %argc, i8** %argv) {
23bb9431acSLang Hamesentry:
24bb9431acSLang Hames  %call = tail call i8* @foo()
25bb9431acSLang Hames  %call1 = tail call i8* @bar()
26bb9431acSLang Hames  %cmp = icmp ne i8* %call, %call1
27bb9431acSLang Hames  %conv = zext i1 %cmp to i32
28bb9431acSLang Hames  ret i32 %conv
29bb9431acSLang Hames}
30bb9431acSLang Hames
31