sections.test
3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
## Check how llvm-readobj prints sections with --sections.
## We test the --sections flag for llvm-readelf in the gnu-sections.test.
# RUN: yaml2obj --docnum=1 %s -o %t64
# RUN: llvm-readobj --sections %t64 | FileCheck %s --check-prefixes=ELF,ELF64
# RUN: yaml2obj --docnum=2 %s -o %t32
# RUN: llvm-readobj --sections %t32 | FileCheck %s --check-prefixes=ELF,ELF32
## Check flag aliases produce identical output.
# RUN: llvm-readobj --sections %t64 > %t64.llvm.sections
# RUN: llvm-readobj -S %t64 > %t64.llvm.upper.s
# RUN: cmp %t64.llvm.sections %t64.llvm.upper.s
# RUN: llvm-readobj -s %t64 > %t64.llvm.lower.s
# RUN: cmp %t64.llvm.sections %t64.llvm.lower.s
# RUN: llvm-readobj --section-headers %t64 > %t64.llvm.section-headers
# RUN: cmp %t64.llvm.sections %t64.llvm.section-headers
# RUN: llvm-readobj --sections %t32 > %t32.llvm.sections
# RUN: llvm-readobj -S %t32 > %t32.llvm.upper.s
# RUN: cmp %t32.llvm.sections %t32.llvm.upper.s
# RUN: llvm-readobj -s %t32 > %t32.llvm.lower.s
# RUN: cmp %t32.llvm.sections %t32.llvm.lower.s
# RUN: llvm-readobj --section-headers %t32 > %t32.llvm.section-headers
# RUN: cmp %t32.llvm.sections %t32.llvm.section-headers
# ELF: Sections [
# ELF-NEXT: Section {
# ELF-NEXT: Index: 0
# ELF-NEXT: Name: (0)
# ELF-NEXT: Type: SHT_NULL (0x0)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF-NEXT: Offset: 0x0
# ELF-NEXT: Size: 0
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 0
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 1
# ELF-NEXT: Name: .foo (1)
# ELF-NEXT: Type: SHT_PROGBITS (0x1)
# ELF-NEXT: Flags [ (0x3)
# ELF-NEXT: SHF_ALLOC (0x2)
# ELF-NEXT: SHF_WRITE (0x1)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x2
# ELF64-NEXT: Offset: 0x41
# ELF32-NEXT: Offset: 0x37
# ELF-NEXT: Size: 3
# ELF-NEXT: Link: 4
# ELF-NEXT: Info: 1
# ELF-NEXT: AddressAlignment: 5
# ELF-NEXT: EntrySize: 6
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 2
# ELF-NEXT: Name: .strtab (16)
# ELF-NEXT: Type: SHT_STRTAB (0x3)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF64-NEXT: Offset: 0x44
# ELF32-NEXT: Offset: 0x3A
# ELF-NEXT: Size: 1
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 1
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 3
# ELF-NEXT: Name: .shstrtab (6)
# ELF-NEXT: Type: SHT_STRTAB (0x3)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF64-NEXT: Offset: 0x45
# ELF32-NEXT: Offset: 0x3B
# ELF-NEXT: Size: 24
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 1
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .foo
Type: SHT_PROGBITS
Info: 1
Address: 0x2
Size: 0x3
Flags: [ SHF_WRITE, SHF_ALLOC ]
Link: 4
AddressAlign: 5
EntSize: 6
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .foo
Type: SHT_PROGBITS
Info: 1
Address: 0x2
Size: 0x3
Flags: [ SHF_WRITE, SHF_ALLOC ]
Link: 4
AddressAlign: 5
EntSize: 6