aboutsummaryrefslogtreecommitdiff
path: root/test/Linker
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:06 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:06 +0000
commit7ab83427af0f77b59941ceba41d509d7d097b065 (patch)
treecc41c05b1db454e3d802f34df75e636ee922ad87 /test/Linker
parentd288ef4c1788d3a951a7558c68312c2d320612b1 (diff)
downloadsrc-7ab83427af0f77b59941ceba41d509d7d097b065.tar.gz
src-7ab83427af0f77b59941ceba41d509d7d097b065.zip
Vendor import of llvm trunk r305145:vendor/llvm/llvm-trunk-r305145
Notes
Notes: svn path=/vendor/llvm/dist/; revision=319780 svn path=/vendor/llvm/llvm-trunk-r305145/; revision=319781; tag=vendor/llvm/llvm-trunk-r305145
Diffstat (limited to 'test/Linker')
-rw-r--r--test/Linker/Inputs/thumb.ll16
-rw-r--r--test/Linker/link-arm-and-thumb.ll23
2 files changed, 39 insertions, 0 deletions
diff --git a/test/Linker/Inputs/thumb.ll b/test/Linker/Inputs/thumb.ll
new file mode 100644
index 000000000000..e15fb26a8c7e
--- /dev/null
+++ b/test/Linker/Inputs/thumb.ll
@@ -0,0 +1,16 @@
+target triple = "thumbv7-linux-gnueabihf"
+
+define i32 @foo(i32 %a, i32 %b) #0 {
+entry:
+ %add = add i32 %a, %b
+ ret i32 %add
+}
+
+define i32 @bar(i32 %a, i32 %b) #1 {
+entry:
+ %add = add i32 %a, %b
+ ret i32 %add
+}
+
+attributes #0 = { "target-features"="-thumb-mode" }
+attributes #1 = { "target-features"="+thumb-mode" }
diff --git a/test/Linker/link-arm-and-thumb.ll b/test/Linker/link-arm-and-thumb.ll
new file mode 100644
index 000000000000..a90f2128e443
--- /dev/null
+++ b/test/Linker/link-arm-and-thumb.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as %s -o %t1.bc
+; RUN: llvm-as %p/Inputs/thumb.ll -o %t2.bc
+; RUN: llvm-link %t1.bc %t2.bc -S 2> %t3.out | FileCheck %s
+; RUN: FileCheck --allow-empty --input-file %t3.out --check-prefix STDERR %s
+
+target triple = "armv7-linux-gnueabihf"
+
+declare i32 @foo(i32 %a, i32 %b);
+
+define i32 @main() {
+entry:
+ %add = call i32 @foo(i32 10, i32 20)
+ ret i32 %add
+}
+
+; CHECK: define i32 @main() {
+; CHECK: define i32 @foo(i32 %a, i32 %b) [[ARM_ATTRS:#[0-9]+]]
+; CHECK: define i32 @bar(i32 %a, i32 %b) [[THUMB_ATTRS:#[0-9]+]]
+
+; CHECK: attributes [[ARM_ATTRS]] = { "target-features"="-thumb-mode" }
+; CHECK: attributes [[THUMB_ATTRS]] = { "target-features"="+thumb-mode" }
+
+; STDERR-NOT: warning: Linking two modules of different target triples: