section-arch-flags.test
4.6 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## Check how we dump arch specific ELF section flags.
# RUN: yaml2obj --docnum 1 %s -o %t-hex.o
# RUN: llvm-readobj -S %t-hex.o | FileCheck --check-prefix=HEX-LLVM %s
# RUN: llvm-readelf -S %t-hex.o | FileCheck --check-prefix=HEX-GNU %s
# HEX-LLVM: Flags [ (0x10000000)
# HEX-LLVM-NEXT: SHF_HEX_GPREL (0x10000000)
# HEX-LLVM-NEXT: ]
# HEX-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# HEX-GNU: [ 1] .hex PROGBITS 00000000 000034 000000 00 p 0 0 0
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_HEXAGON
Sections:
- Name: .hex
Type: SHT_PROGBITS
Flags: [ SHF_HEX_GPREL ]
# RUN: yaml2obj --docnum 2 %s -o %t-mips.o
# RUN: llvm-readobj -S %t-mips.o | FileCheck --check-prefix=MIPS-LLVM %s
# RUN: llvm-readelf -S %t-mips.o | FileCheck --check-prefix=MIPS-GNU %s
# MIPS-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# MIPS-GNU: [ 1] .mips PROGBITS 00000000 000034 000000 00 op 0 0 0
# MIPS-LLVM: Flags [ (0xFF000000)
# MIPS-LLVM-NEXT: SHF_EXCLUDE (0x80000000)
# MIPS-LLVM-NEXT: SHF_MIPS_ADDR (0x40000000)
# MIPS-LLVM-NEXT: SHF_MIPS_GPREL (0x10000000)
# MIPS-LLVM-NEXT: SHF_MIPS_LOCAL (0x4000000)
# MIPS-LLVM-NEXT: SHF_MIPS_MERGE (0x20000000)
# MIPS-LLVM-NEXT: SHF_MIPS_NAMES (0x2000000)
# MIPS-LLVM-NEXT: SHF_MIPS_NODUPES (0x1000000)
# MIPS-LLVM-NEXT: SHF_MIPS_NOSTRIP (0x8000000)
# MIPS-LLVM-NEXT: SHF_MIPS_STRING (0x80000000)
# MIPS-LLVM-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .mips
Type: SHT_PROGBITS
Flags: [ SHF_MIPS_NODUPES, SHF_MIPS_NAMES, SHF_MIPS_LOCAL, SHF_MIPS_NOSTRIP,
SHF_MIPS_GPREL, SHF_MIPS_MERGE, SHF_MIPS_ADDR, SHF_MIPS_STRING ]
## Test what we print when a MIPS object has the SHF_MIPS_STRING flag.
## SHF_MIPS_STRING has a value of 0x80000000, which matches the value of SHF_EXCLUDE.
# RUN: yaml2obj --docnum 3 %s -o %t-mips-exclude.o
# RUN: llvm-readobj -S %t-mips-exclude.o | FileCheck --check-prefix=MIPS-EXCLUDE-LLVM %s
# RUN: llvm-readelf -S %t-mips-exclude.o | FileCheck --check-prefix=MIPS-EXCLUDE-GNU %s
# MIPS-EXCLUDE-LLVM: Name: .mips
# MIPS-EXCLUDE-LLVM-NEXT: Type: SHT_PROGBITS
# MIPS-EXCLUDE-LLVM-NEXT: Flags [ (0x80000000)
# MIPS-EXCLUDE-LLVM-NEXT: SHF_EXCLUDE (0x80000000)
# MIPS-EXCLUDE-LLVM-NEXT: SHF_MIPS_STRING (0x80000000)
# MIPS-EXCLUDE-LLVM-NEXT: ]
# MIPS-EXCLUDE-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# MIPS-EXCLUDE-GNU: [ 1] .mips PROGBITS 00000000 000034 000000 00 E 0 0 0
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .mips
Type: SHT_PROGBITS
Flags: [ SHF_MIPS_STRING ]
# RUN: yaml2obj --docnum 4 %s -o %t-x86_64.o
# RUN: llvm-readobj -S %t-x86_64.o | FileCheck --check-prefix=X86_64-LLVM %s
# RUN: llvm-readelf -S %t-x86_64.o | FileCheck --check-prefix=X86_64-GNU %s
# X86_64-LLVM: Name: .x86_64
# X86_64-LLVM-NEXT: Type: SHT_PROGBITS
# X86_64-LLVM-NEXT: Flags [ (0x10000000)
# X86_64-LLVM-NEXT: SHF_X86_64_LARGE (0x10000000)
# X86_64-LLVM-NEXT: ]
# X86_64-LLVM: Name: .with.exclude
# X86_64-LLVM-NEXT: Type: SHT_PROGBITS
# X86_64-LLVM-NEXT: Flags [ (0x90000000)
# X86_64-LLVM-NEXT: SHF_EXCLUDE (0x80000000)
# X86_64-LLVM-NEXT: SHF_X86_64_LARGE (0x10000000)
# X86_64-LLVM-NEXT: ]
## GNU prints 'l' before 'E', despite otherwise printing upper-case letters first.
# X86_64-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# X86_64-GNU: [ 1] .x86_64 PROGBITS 0000000000000000 000040 000000 00 l 0 0 0
# X86_64-GNU: [ 2] .with.exclude PROGBITS 0000000000000000 000040 000000 00 lE 0 0 0
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .x86_64
Type: SHT_PROGBITS
Flags: [ SHF_X86_64_LARGE ]
- Name: .with.exclude
Type: SHT_PROGBITS
Flags: [ SHF_X86_64_LARGE, SHF_EXCLUDE ]
# RUN: yaml2obj --docnum 5 %s -o %t-arm.o
# RUN: llvm-readobj -S %t-arm.o | FileCheck --check-prefix=ARM-LLVM %s
# RUN: llvm-readelf -S %t-arm.o | FileCheck --check-prefix=ARM-GNU %s
# ARM-LLVM: Flags [ (0x20000000)
# ARM-LLVM-NEXT: SHF_ARM_PURECODE (0x20000000)
# ARM-LLVM-NEXT: ]
# ARM-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# ARM-GNU: [ 1] foo PROGBITS 0000000000000000 000040 000000 00 y 0 0 0
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_ARM
Sections:
- Name: foo
Type: SHT_PROGBITS
Flags: [ SHF_ARM_PURECODE ]