1 ## Check that obj2yaml is able to produce YAML from
2 ## an object containing symbols and sections with duplicate
3 ## names and produces same-named sections and symbols
4 ## with distinguishing suffixes.
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj -s -t %t1 | FileCheck %s
16 # CHECK: Name: localfoo (
17 # CHECK: Name: localfoo (
18 # CHECK: Name: localfoo (
19 # CHECK: Name: localbar (
20 # CHECK: Name: localbar (
21 # CHECK: Name: localbar (
23 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=CASE1
26 # CASE1-NEXT: FileHeader:
27 # CASE1-NEXT: Class: ELFCLASS64
28 # CASE1-NEXT: Data: ELFDATA2LSB
29 # CASE1-NEXT: Type: ET_REL
30 # CASE1-NEXT: Machine: EM_X86_64
31 # CASE1-NEXT: Sections:
32 # CASE1-NEXT: - Name: .foo
33 # CASE1-NEXT: Type: SHT_PROGBITS
34 # CASE1-NEXT: - Name: '.foo [1]'
35 # CASE1-NEXT: Type: SHT_PROGBITS
36 # CASE1-NEXT: - Name: '.foo [2]'
37 # CASE1-NEXT: Type: SHT_PROGBITS
38 # CASE1-NEXT: - Name: .bar
39 # CASE1-NEXT: Type: SHT_PROGBITS
40 # CASE1-NEXT: - Name: '.bar [1]'
41 # CASE1-NEXT: Type: SHT_PROGBITS
42 # CASE1-NEXT: - Name: '.bar [2]'
43 # CASE1-NEXT: Type: SHT_PROGBITS
44 # CASE1-NEXT: Symbols:
45 # CASE1-NEXT: - Name: localfoo
46 # CASE1-NEXT: - Name: 'localfoo [1]'
47 # CASE1-NEXT: - Name: 'localfoo [2]'
48 # CASE1-NEXT: - Name: localbar
49 # CASE1-NEXT: - Name: 'localbar [1]'
50 # CASE1-NEXT: - Name: 'localbar [2]'
64 - Name: '.foo [random_tag]'
70 - Name: '.bar [random_tag]'
73 - Name: 'localfoo [111]'
74 - Name: 'localfoo [222]'
75 - Name: 'localfoo [random_tag]'
76 - Name: 'localbar [333]'
77 - Name: 'localbar [444]'
78 - Name: 'localbar [random_tag]'
80 ## Check we can refer to symbols with the same
81 ## name from relocations.
83 # RUN: yaml2obj --docnum=2 %s -o %t2
84 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=CASE2
87 # CASE2-NEXT: - Offset: 0x0000000000000000
88 # CASE2-NEXT: Symbol: 'foo [1]'
89 # CASE2-NEXT: Type: R_X86_64_PC32
90 # CASE2-NEXT: - Offset: 0x0000000000000004
91 # CASE2-NEXT: Symbol: foo
92 # CASE2-NEXT: Type: R_X86_64_PC32
93 # CASE2-NEXT: Symbols:
94 # CASE2-NEXT: - Name: foo
95 # CASE2-NEXT: - Name: 'foo [1]'
112 - Type: R_X86_64_PC32
115 - Type: R_X86_64_PC32
122 ## Check obj2yaml does not add a suffix to a name if the
123 ## symbol is in .symtab and .dynsym at the same time.
125 # RUN: yaml2obj --docnum=3 %s -o %t3
126 # RUN: obj2yaml %t3 | FileCheck %s --check-prefix=CASE3
129 # CASE3-NEXT: FileHeader:
130 # CASE3-NEXT: Class: ELFCLASS64
131 # CASE3-NEXT: Data: ELFDATA2LSB
132 # CASE3-NEXT: Type: ET_DYN
133 # CASE3-NEXT: Machine: EM_X86_64
134 # CASE3-NEXT: Symbols:
135 # CASE3-NEXT: - Name: foo
136 # CASE3-NEXT: Binding: STB_GLOBAL
137 # CASE3-NEXT: DynamicSymbols:
138 # CASE3-NEXT: - Name: foo
139 # CASE3-NEXT: Binding: STB_GLOBAL