[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / vs-diagnostics-duplicate.s
blob397e14ac68cb28936f620fa90964b350a944774b
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate2.s -o %t2.o
4 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate3.s -o %t3.o
5 // RUN: not ld.lld --vs-diagnostics --threads=1 %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s
7 // Case 1. The source locations are unknown for both symbols.
8 // CHECK: {{.*}}ld.lld{{.*}}: error: duplicate symbol: foo
9 // CHECK-NEXT: >>> defined at {{.*}}1.o:(.text+0x{{.+}})
10 // CHECK-NEXT: >>> defined at {{.*}}2.o:(.text+0x{{.+}})
12 // Case 2. Both symbols have full source location.
13 // CHECK: duplicate.s(15): error: duplicate symbol: bar
14 // CHECK-NEXT: >>> defined at duplicate.s:15
15 // CHECK-NEXT: >>>{{.*}}1.o:(.text+0x{{.+}})
16 // CHECK: duplicate2.s(20): error: duplicate symbol: bar
17 // CHECK-NEXT: >>> defined at duplicate2.s:20
18 // CHECK-NEXT: >>>{{.*}}2.o:(.text+0x{{.+}})
20 // Case 3. For the second definition of `baz` we know only the source file found in a STT_FILE symbol.
21 // CHECK: duplicate.s(30): error: duplicate symbol: baz
22 // CHECK-NEXT: >>> defined at duplicate.s:30
23 // CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}})
24 // CHECK-NEXT: >>> defined at duplicate3.s
25 // CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}})
27 // Check that we prefer using the full path of a source file.
28 // CHECK: /tmp{{/|\\}}duplicate.s(33): error: duplicate symbol: qux
29 // CHECK-NEXT: >>> defined at duplicate.s:33 (/tmp{{/|\\}}duplicate.s:33)
30 // CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}})
31 // CHECK-NEXT: >>> defined at duplicate3.s
32 // CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}})
34 .global _start, foo, bar, baz, qux
35 .text
36 _start:
37 nop
39 foo:
40 nop
42 .file 1 "duplicate.s"
43 .loc 1 15
45 bar:
46 nop
48 .loc 1 30
49 baz:
50 nop
52 .file 2 "/tmp" "duplicate.s"
53 .loc 2 33
54 qux:
55 nop
57 .section .debug_abbrev,"",@progbits
58 .byte 1 # Abbreviation Code
59 .byte 17 # DW_TAG_compile_unit
60 .byte 0 # DW_CHILDREN_no
61 .byte 16 # DW_AT_stmt_list
62 .byte 23 # DW_FORM_sec_offset
63 .byte 0 # EOM(1)
64 .byte 0 # EOM(2)
65 .byte 0 # EOM(3)
67 .section .debug_info,"",@progbits
68 .long .Lend0 - .Lbegin0 # Length of Unit
69 .Lbegin0:
70 .short 4 # DWARF version number
71 .long .debug_abbrev # Offset Into Abbrev. Section
72 .byte 8 # Address Size (in bytes)
73 .byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
74 .long .debug_line # DW_AT_stmt_list
75 .Lend0:
76 .section .debug_line,"",@progbits