llvm.org GIT mirror llvm / 7812ee2
[llvm-readobj] - Convert gnu-sections.test to use YAML. gnu-sections.test currently use relocs.obj.elf-x86_64 and relocs.obj.elf-i386 precompiled objects as an inputs. These inputs actually initially were introduced to test the dump of relocations and have almost nothing common with dumping sections. Patch converts the test to use yaml2obj. That allows to remove relocs.obj.elf-i386 binary. (relocs.obj.elf-x86_64 is still used by another test and can't be removed atm). Differential revision: https://reviews.llvm.org/D62659 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362377 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 1 year, 1 day ago
2 changed file(s) with 113 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386 less more
Binary diff not shown
None RUN: llvm-readelf -S %p/Inputs/relocs.obj.elf-i386 \
1 RUN: | FileCheck %s -check-prefix ELF32
2 RUN: llvm-readelf -S %p/Inputs/relocs.obj.elf-x86_64 \
3 RUN: | FileCheck %s -check-prefix ELF64
4 RUN: llvm-readobj --wide --sections \
5 RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
6 RUN: | FileCheck %s -check-prefix ELF64
7 RUN: llvm-readobj -W --sections \
8 RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
9 RUN: | FileCheck %s -check-prefix ELF64
10 RUN: llvm-readelf -W -S %p/Inputs/relocs.obj.elf-x86_64 \
11 RUN: | FileCheck %s -check-prefix ELF64
0 # RUN: yaml2obj --docnum=1 %s -o %t-i386.o
1 # RUN: llvm-readelf -S %t-i386.o | FileCheck %s -check-prefix ELF32
122
13 ELF32: Section Headers:
14 ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
15 ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
16 ELF32-NEXT: [ 1] .text PROGBITS 00000000 000034 0000f6 00 AX 0 0 4
17 ELF32-NEXT: [ 2] .rel.text REL 00000000 000318 000148 08 6 1 4
18 ELF32-NEXT: [ 3] .data PROGBITS 00000000 00012c 000000 00 WA 0 0 4
19 ELF32-NEXT: [ 4] .bss NOBITS 00000000 00012c 000000 00 WA 0 0 4
20 ELF32-NEXT: [ 5] .shstrtab STRTAB 00000000 00012c 000030 00 0 0 1
21 ELF32-NEXT: [ 6] .symtab SYMTAB 00000000 00029c 000060 10 7 4 4
22 ELF32-NEXT: [ 7] .strtab STRTAB 00000000 0002fc 00001b 00 0 0 1
23 ELF32-NEXT: Key to Flags:
24 ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
25 ELF32-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
26 ELF32-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
3 # ELF32: There are 8 section headers, starting at offset 0x34:
4 # ELF32-EMPTY:
5 # ELF32-NEXT: Section Headers:
6 # ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
7 # ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
8 # ELF32-NEXT: [ 1] .text PROGBITS 00000000 000174 000001 00 AX 0 0 4
9 # ELF32-NEXT: [ 2] .rel.text REL 00000000 000178 000000 08 5 1 4
10 # ELF32-NEXT: [ 3] .data PROGBITS 00000000 000178 000000 00 WA 0 0 4
11 # ELF32-NEXT: [ 4] .bss NOBITS 00000000 000178 000000 00 WA 0 0 4
12 # ELF32-NEXT: [ 5] .symtab SYMTAB 00000000 000178 000020 10 6 2 8
13 # ELF32-NEXT: [ 6] .strtab STRTAB 00000000 000198 000007 00 0 0 1
14 # ELF32-NEXT: [ 7] .shstrtab STRTAB 00000000 00019f 000030 00 0 0 1
15 # ELF32-NEXT: Key to Flags:
16 # ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
17 # ELF32-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
18 # ELF32-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
2719
28 ELF64: There are 8 section headers, starting at offset 0x180:
29 ELF64: Section Headers:
30 ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
31 ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
32 ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 00010a 00 AX 0 0 4
33 ELF64-NEXT: [ 2] .rela.text RELA 0000000000000000 000430 000390 18 6 1 8
34 ELF64-NEXT: [ 3] .data PROGBITS 0000000000000000 00014c 000000 00 WA 0 0 4
35 ELF64-NEXT: [ 4] .bss NOBITS 0000000000000000 00014c 000000 00 WA 0 0 4
36 ELF64-NEXT: [ 5] .shstrtab STRTAB 0000000000000000 00014c 000031 00 0 0 1
37 ELF64-NEXT: [ 6] .symtab SYMTAB 0000000000000000 000380 000090 18 7 4 8
38 ELF64-NEXT: [ 7] .strtab STRTAB 0000000000000000 000410 00001b 00 0 0 1
39 ELF64-NEXT: Key to Flags:
40 ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
41 ELF64-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
42 ELF64-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
20 --- !ELF
21 FileHeader:
22 Class: ELFCLASS32
23 Data: ELFDATA2LSB
24 OSABI: ELFOSABI_GNU
25 Type: ET_REL
26 Machine: EM_386
27 Sections:
28 - Name: .text
29 Type: SHT_PROGBITS
30 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
31 AddressAlign: 0x0000000000000004
32 Content: 00
33 - Name: .rel.text
34 Type: SHT_REL
35 Link: .symtab
36 AddressAlign: 0x0000000000000004
37 EntSize: 0x0000000000000008
38 Info: .text
39 Relocations:
40 - Name: .data
41 Type: SHT_PROGBITS
42 Flags: [ SHF_WRITE, SHF_ALLOC ]
43 AddressAlign: 0x0000000000000004
44 Content: ''
45 - Name: .bss
46 Type: SHT_NOBITS
47 Flags: [ SHF_WRITE, SHF_ALLOC ]
48 AddressAlign: 0x0000000000000004
49 Symbols:
50 - Name: .text
51 Type: STT_SECTION
52 Section: .text
53
54 # RUN: yaml2obj --docnum=2 %s -o %t-x64.o
55 # RUN: llvm-readelf -S %t-x64.o | FileCheck %s -check-prefix ELF64
56
57 ## Check that --wide is the same as -W and ignored and also
58 ## that --section is the same as -S.
59 # RUN: llvm-readobj --wide --sections %t-x64.o --elf-output-style=GNU \
60 # RUN: | FileCheck %s -check-prefix ELF64
61 # RUN: llvm-readobj -W --sections %t-x64.o --elf-output-style=GNU \
62 # RUN: | FileCheck %s -check-prefix ELF64
63 # RUN: llvm-readelf -W -S %t-x64.o | FileCheck %s -check-prefix ELF64
64
65 # ELF64: There are 8 section headers, starting at offset 0x40:
66 # ELF64-EMPTY:
67 # ELF64-NEXT: Section Headers:
68 # ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
69 # ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
70 # ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000240 000001 00 AX 0 0 4
71 # ELF64-NEXT: [ 2] .rela.text RELA 0000000000000000 000248 000000 18 5 1 8
72 # ELF64-NEXT: [ 3] .data PROGBITS 0000000000000000 000248 000000 00 WA 0 0 4
73 # ELF64-NEXT: [ 4] .bss NOBITS 0000000000000000 000248 000000 00 WA 0 0 4
74 # ELF64-NEXT: [ 5] .symtab SYMTAB 0000000000000000 000248 000030 18 6 2 8
75 # ELF64-NEXT: [ 6] .strtab STRTAB 0000000000000000 000278 000007 00 0 0 1
76 # ELF64-NEXT: [ 7] .shstrtab STRTAB 0000000000000000 00027f 000031 00 0 0 1
77 # ELF64-NEXT: Key to Flags:
78 # ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
79 # ELF64-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
80 # ELF64-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
81
82 --- !ELF
83 FileHeader:
84 Class: ELFCLASS64
85 Data: ELFDATA2LSB
86 OSABI: ELFOSABI_GNU
87 Type: ET_REL
88 Machine: EM_X86_64
89 Sections:
90 - Name: .text
91 Type: SHT_PROGBITS
92 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
93 AddressAlign: 0x0000000000000004
94 Content: 00
95 - Name: .rela.text
96 Type: SHT_RELA
97 Link: .symtab
98 AddressAlign: 0x0000000000000008
99 EntSize: 0x0000000000000018
100 Info: .text
101 Relocations:
102 - Name: .data
103 Type: SHT_PROGBITS
104 Flags: [ SHF_WRITE, SHF_ALLOC ]
105 AddressAlign: 0x0000000000000004
106 Content: ''
107 - Name: .bss
108 Type: SHT_NOBITS
109 Flags: [ SHF_WRITE, SHF_ALLOC ]
110 AddressAlign: 0x0000000000000004
111 Symbols:
112 - Name: .text
113 Type: STT_SECTION
114 Section: .text