Fix another case where the linkage was not set.
[oota-llvm.git] / test / Linker / comdat13.ll
1 ; RUN: llvm-link -S %s %p/Inputs/comdat13.ll -o - | FileCheck %s
2
3 ; In Inputs/comdat13.ll a function not in the $foo comdat (zed) references an
4 ; internal function in the comdat $foo.
5 ; The IR would be ilegal on ELF ("relocation refers to discarded section"),
6 ; but COFF linkers seem to just duplicate the comdat.
7
8 $foo = comdat any
9 @foo = internal global i8 0, comdat
10 define i8* @bar() {
11        ret i8* @foo
12 }
13
14 ; CHECK: $foo = comdat any
15
16 ; CHECK: @foo = internal global i8 0, comdat
17 ; CHECK: @foo.1 = internal global i8 1, comdat($foo)
18
19 ; CHECK:      define i8* @bar() {
20 ; CHECK-NEXT:   ret i8* @foo
21 ; CHECK-NEXT: }
22
23 ; CHECK:      define i8* @zed() {
24 ; CHECK-NEXT:   call void @bax()
25 ; CHECK-NEXT:   ret i8* @foo.1
26 ; CHECK-NEXT: }
27
28 ; CHECK:      define internal void @bax() comdat($foo) {
29 ; CHECK-NEXT:   ret void
30 ; CHECK-NEXT: }