1; RUN: llvm-as %s -o %t.o
2; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
3
4; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
5; RUN:    --plugin-opt=emit-llvm \
6; RUN:    -shared %t.o %t2.o -o %t3.o
7; RUN: llvm-dis %t3.o -o - | FileCheck %s
8
9; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
10; RUN:    --plugin-opt=emit-llvm \
11; RUN:    -shared %t2.o %t.o -o %t3.o
12; RUN: llvm-dis %t3.o -o - | FileCheck %s
13
14define linkonce_odr void @f() !dbg !4 {
15  ret void, !dbg !10
16}
17
18; Test that we get a weak_odr regardless of the order of the files
19; CHECK: define weak_odr void @f()
20
21; Test that we only get a single DISubprogram for @f
22; CHECK: !DISubprogram(name: "f"
23; CHECK-NOT: !DISubprogram(name: "f"
24
25!llvm.dbg.cu = !{!0}
26!llvm.module.flags = !{!7, !8}
27!llvm.ident = !{!9}
28
29!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
30!1 = !DIFile(filename: "linkonce-weak.c", directory: ".")
31!2 = !{}
32!3 = !{!4}
33!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, variables: !2)
34!5 = !DISubroutineType(types: !6)
35!6 = !{null}
36!7 = !{i32 2, !"Dwarf Version", i32 4}
37!8 = !{i32 2, !"Debug Info Version", i32 3}
38!9 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"}
39!10 = !DILocation(line: 2, column: 1, scope: !4)
40