diff options
Diffstat (limited to 'llvm/test/Linker')
-rw-r--r-- | llvm/test/Linker/Inputs/comdat11.ll | 9 | ||||
-rw-r--r-- | llvm/test/Linker/Inputs/comdat13.ll | 9 | ||||
-rw-r--r-- | llvm/test/Linker/comdat11.ll | 13 | ||||
-rw-r--r-- | llvm/test/Linker/comdat12.ll | 8 | ||||
-rw-r--r-- | llvm/test/Linker/comdat13.ll | 13 | ||||
-rw-r--r-- | llvm/test/Linker/comdat9.ll | 3 |
6 files changed, 55 insertions, 0 deletions
diff --git a/llvm/test/Linker/Inputs/comdat11.ll b/llvm/test/Linker/Inputs/comdat11.ll new file mode 100644 index 00000000000..5b7f74cf0b2 --- /dev/null +++ b/llvm/test/Linker/Inputs/comdat11.ll @@ -0,0 +1,9 @@ +$foo = comdat any +@foo = global i8 1, comdat +define void @zed() { + call void @bar() + ret void +} +define void @bar() comdat($foo) { + ret void +} diff --git a/llvm/test/Linker/Inputs/comdat13.ll b/llvm/test/Linker/Inputs/comdat13.ll new file mode 100644 index 00000000000..a2d16bd261b --- /dev/null +++ b/llvm/test/Linker/Inputs/comdat13.ll @@ -0,0 +1,9 @@ +$foo = comdat any +@foo = global i8 1, comdat +define void @zed() { + call void @bar() + ret void +} +define internal void @bar() comdat($foo) { + ret void +} diff --git a/llvm/test/Linker/comdat11.ll b/llvm/test/Linker/comdat11.ll new file mode 100644 index 00000000000..dbade4104fe --- /dev/null +++ b/llvm/test/Linker/comdat11.ll @@ -0,0 +1,13 @@ +; RUN: llvm-link -S %s %p/Inputs/comdat11.ll -o - | FileCheck %s + +$foo = comdat any +@foo = global i8 0, comdat + +; CHECK: @foo = global i8 0, comdat + +; CHECK: define void @zed() { +; CHECK: call void @bar() +; CHECK: ret void +; CHECK: } + +; CHECK: declare void @bar() diff --git a/llvm/test/Linker/comdat12.ll b/llvm/test/Linker/comdat12.ll new file mode 100644 index 00000000000..d06e222b63a --- /dev/null +++ b/llvm/test/Linker/comdat12.ll @@ -0,0 +1,8 @@ +; RUN: llvm-link %s -S -o - | FileCheck %s + +$foo = comdat largest +define internal void @foo() comdat($foo) { + ret void +} + +; CHECK-NOT: foo diff --git a/llvm/test/Linker/comdat13.ll b/llvm/test/Linker/comdat13.ll new file mode 100644 index 00000000000..a8e51f04ae1 --- /dev/null +++ b/llvm/test/Linker/comdat13.ll @@ -0,0 +1,13 @@ +; RUN: not llvm-link -S %s %p/Inputs/comdat13.ll -o %t.ll 2>&1 | FileCheck %s + +; In Inputs/comdat13.ll a function not in the $foo comdat (zed) references an +; internal function in the comdat $foo. +; We might want to have the verifier reject that, but for now we at least check +; that the linker produces an error. +; This is the IR equivalent of the "relocation refers to discarded section" in +; an ELF linker. + +; CHECK: Declaration points to discarded value + +$foo = comdat any +@foo = global i8 0, comdat diff --git a/llvm/test/Linker/comdat9.ll b/llvm/test/Linker/comdat9.ll index 274957401aa..4f6f2cfb845 100644 --- a/llvm/test/Linker/comdat9.ll +++ b/llvm/test/Linker/comdat9.ll @@ -14,6 +14,9 @@ $f2 = comdat largest define internal void @f2() comdat($f2) { ret void } +define void @f3() comdat($f2) { + ret void +} ; CHECK-DAG: $f2 = comdat largest ; CHECK-DAG: define internal void @f2() comdat { |