Lang Hames | bb9431a | 2016-08-09 19:27:17 +0000 | [diff] [blame] | 1 | ; RUN: lli -jit-kind=mcjit -extra-module %p/Inputs/weak-function-2.ll %s |
Lang Hames | ae73b0a | 2016-08-09 20:48:22 +0000 | [diff] [blame] | 2 | ; REQUIRES: not_COFF |
Lang Hames | bb9431a | 2016-08-09 19:27:17 +0000 | [diff] [blame] | 3 | ; |
| 4 | ; Check that functions in two different modules agree on the address of weak |
| 5 | ; function 'baz' |
Lang Hames | ae73b0a | 2016-08-09 20:48:22 +0000 | [diff] [blame] | 6 | ; Testing on COFF platforms is disabled as COFF has no representation of 'weak' |
| 7 | ; linkage. |
Lang Hames | bb9431a | 2016-08-09 19:27:17 +0000 | [diff] [blame] | 8 | |
Lang Hames | ae73b0a | 2016-08-09 20:48:22 +0000 | [diff] [blame] | 9 | define weak i32 @baz() { |
Lang Hames | bb9431a | 2016-08-09 19:27:17 +0000 | [diff] [blame] | 10 | entry: |
| 11 | ret i32 0 |
| 12 | } |
| 13 | |
| 14 | define i8* @foo() { |
| 15 | entry: |
| 16 | ret i8* bitcast (i32 ()* @baz to i8*) |
| 17 | } |
| 18 | |
| 19 | declare i8* @bar() |
| 20 | |
| 21 | define i32 @main(i32 %argc, i8** %argv) { |
| 22 | entry: |
| 23 | %call = tail call i8* @foo() |
| 24 | %call1 = tail call i8* @bar() |
| 25 | %cmp = icmp ne i8* %call, %call1 |
| 26 | %conv = zext i1 %cmp to i32 |
| 27 | ret i32 %conv |
| 28 | } |
| 29 | |