arm-exidx-section.yaml
4.74 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
## Test how we create SHT_ARM_EXIDX sections.
## Test that the content of SHT_ARM_EXIDX sections,
## generated for 32/64-bit little/big endian targets is correct.
## Also check that we can use a special EXIDX_CANTUNWIND (0x1) value for a Value field of an entry.
# RUN: yaml2obj --docnum=1 -DENCODE=LSB -DCLASS=64 %s -o %t.le64
# RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefixes=DEFAULT,LE
# RUN: yaml2obj --docnum=1 -DENCODE=LSB -DCLASS=32 %s -o %t.le32
# RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefixes=DEFAULT,LE
# RUN: yaml2obj --docnum=1 -DENCODE=MSB -DCLASS=64 %s -o %t.be64
# RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefixes=DEFAULT,BE
# RUN: yaml2obj --docnum=1 -DENCODE=MSB -DCLASS=32 %s -o %t.be32
# RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefixes=DEFAULT,BE
# DEFAULT: Name: .ARM.exidx (1)
# DEFAULT-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
# DEFAULT-NEXT: Flags [ (0x0)
# DEFAULT-NEXT: ]
# DEFAULT-NEXT: Address: 0x0
# DEFAULT-NEXT: Offset: 0x{{.*}}
# DEFAULT-NEXT: Size: 16
# DEFAULT-NEXT: Link: 0
# DEFAULT-NEXT: Info: 0
# DEFAULT-NEXT: AddressAlignment: 0
# DEFAULT-NEXT: EntrySize: 0
# DEFAULT-NEXT: SectionData (
# LE-NEXT: 0000: DDCCBBAA 44332211 9988FFEE 01000000 |
# BE-NEXT: 0000: AABBCCDD 11223344 EEFF8899 00000001 |
# DEFAULT-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS[[CLASS=64]]
Data: ELFDATA2[[ENCODE=LSB]]
Type: ET_DYN
Machine: [[MACHINE=EM_ARM]]
Sections:
- Name: .ARM.exidx
Type: SHT_ARM_EXIDX
Entries:
- Offset: 0xAABBCCDD
Value: 0x11223344
- Offset: 0xEEFF8899
Value: EXIDX_CANTUNWIND
## Check we only recognize the SHT_ARM_EXIDX section type when machine type is EM_ARM.
# RUN: not yaml2obj --docnum=1 -DMACHINE=EM_NONE %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN
# UNKNOWN: error: invalid hex32 number
# UNKNOWN-NEXT: Type: SHT_ARM_EXIDX
## Check we can set arbitrary section properties for a SHT_ARM_EXIDX section.
## Also check that we are able to specify none of "Entries", "Content" nor "Size" keys.
# RUN: yaml2obj --docnum=2 %s -o %t.props.o
# RUN: llvm-readelf --sections %t.props.o | FileCheck %s --check-prefix=PROPERTIES
# PROPERTIES: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# PROPERTIES: [ 1] .ARM.exidx ARM_EXIDX 0000000000001122 000055 000000 00 AMS 13124 0 85
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_ARM
Sections:
- Name: .ARM.exidx
Type: SHT_ARM_EXIDX
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
Address: 0x1122
Link: 0x3344
AddressAlign: 0x55
EntSize: 0x66
## Check we can't use "Entries" key together with "Content" or "Size" keys.
# RUN: not yaml2obj --docnum=3 -DSIZE=0 -DENT="[]" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=ENTRIES-ERR
# RUN: not yaml2obj --docnum=3 -DCONTENT="'00'" -DENT="[]" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=ENTRIES-ERR
# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_ARM
Sections:
- Name: .ARM.exidx
Type: SHT_ARM_EXIDX
Size: [[SIZE=<none>]]
Content: [[CONTENT=<none>]]
Entries: [[ENT=<none>]]
## Check we can use "Content" key with "Size" key when the size is greater
## than or equal to the content size.
# RUN: not yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=0 %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
# CONTENT-SIZE-ERR: error: "Size" must be greater than or equal to the content size
# RUN: yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=1 %s -o %t.cont.size.eq.o
# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="00"
# RUN: yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=2 %s -o %t.cont.size.gr.o
# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0000"
# CHECK-CONTENT: Name: .ARM.exidx
# CHECK-CONTENT: SectionData (
# CHECK-CONTENT-NEXT: 0000: [[DATA]] |
# CHECK-CONTENT-NEXT: )
## Check we can use "Content" key alone to emit arbitrary content.
# RUN: yaml2obj --docnum=3 -DCONTENT="'11223344'" %s -o %t.content.o
# RUN: llvm-readobj --sections --section-data %t.content.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="11223344"
## Check we can use "Size" key alone to emit content of an arbitrary size.
# RUN: yaml2obj --docnum=3 -DSIZE=4 %s -o %t.size.o
# RUN: llvm-readobj --sections --section-data %t.size.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="00000000"