summaryrefslogtreecommitdiff
path: root/test/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-08-09 19:27:17 +0000
committerLang Hames <lhames@gmail.com>2016-08-09 19:27:17 +0000
commit04d404bad2a4338841d5ab5f0ec3908bbd62fa1a (patch)
tree291bcba7a682081eb1f0a90cde5dbdb9b2638799 /test/ExecutionEngine
parentc93602e15af3c18ad01902df37066ff6f74ae3b8 (diff)
Re-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ExecutionEngine')
-rw-r--r--test/ExecutionEngine/MCJIT/Inputs/weak-function-2.ll9
-rw-r--r--test/ExecutionEngine/MCJIT/weak-function.ll26
-rw-r--r--test/ExecutionEngine/OrcMCJIT/Inputs/weak-function-2.ll9
-rw-r--r--test/ExecutionEngine/OrcMCJIT/weak-function.ll26
4 files changed, 70 insertions, 0 deletions
diff --git a/test/ExecutionEngine/MCJIT/Inputs/weak-function-2.ll b/test/ExecutionEngine/MCJIT/Inputs/weak-function-2.ll
new file mode 100644
index 00000000000..a7ff83df039
--- /dev/null
+++ b/test/ExecutionEngine/MCJIT/Inputs/weak-function-2.ll
@@ -0,0 +1,9 @@
+define linkonce_odr i32 @baz() #0 {
+entry:
+ ret i32 0
+}
+
+define i8* @bar() {
+entry:
+ ret i8* bitcast (i32 ()* @baz to i8*)
+}
diff --git a/test/ExecutionEngine/MCJIT/weak-function.ll b/test/ExecutionEngine/MCJIT/weak-function.ll
new file mode 100644
index 00000000000..562d6ade33b
--- /dev/null
+++ b/test/ExecutionEngine/MCJIT/weak-function.ll
@@ -0,0 +1,26 @@
+; 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
+}
+
diff --git a/test/ExecutionEngine/OrcMCJIT/Inputs/weak-function-2.ll b/test/ExecutionEngine/OrcMCJIT/Inputs/weak-function-2.ll
new file mode 100644
index 00000000000..a7ff83df039
--- /dev/null
+++ b/test/ExecutionEngine/OrcMCJIT/Inputs/weak-function-2.ll
@@ -0,0 +1,9 @@
+define linkonce_odr i32 @baz() #0 {
+entry:
+ ret i32 0
+}
+
+define i8* @bar() {
+entry:
+ ret i8* bitcast (i32 ()* @baz to i8*)
+}
diff --git a/test/ExecutionEngine/OrcMCJIT/weak-function.ll b/test/ExecutionEngine/OrcMCJIT/weak-function.ll
new file mode 100644
index 00000000000..db255cdbb2c
--- /dev/null
+++ b/test/ExecutionEngine/OrcMCJIT/weak-function.ll
@@ -0,0 +1,26 @@
+; RUN: lli -jit-kind=orc-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
+}
+