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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
## Test how we create SHT_RELR sections.
## Test that the content of SHT_RELR sections for 64-bit little endian targets is correct.
# RUN: yaml2obj --docnum=1 -D ENCODE=LSB %s -o %t.le64
# RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefix=LE64
# LE64: Name: .relr.dyn
# LE64-NEXT: Type: SHT_RELR
# LE64-NEXT: Flags [
# LE64-NEXT: SHF_ALLOC
# LE64-NEXT: ]
# LE64-NEXT: Address: 0x0
# LE64-NEXT: Offset: 0x40
# LE64-NEXT: Size: 32
# LE64-NEXT: Link: 0
# LE64-NEXT: Info: 0
# LE64-NEXT: AddressAlignment: 0
# LE64-NEXT: EntrySize: 8
# LE64-NEXT: SectionData (
# LE64-NEXT: 0000: DDCCBBAA 00000000 2211FFEE 00000000
# LE64-NEXT: 0010: 66554433 00000010 AA998877 00000010
# LE64-NEXT: )
## Test that the content of SHT_RELR sections for 64-bit big endian targets is correct.
# RUN: yaml2obj --docnum=1 -D ENCODE=MSB %s -o %t.be64
# RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefix=BE64
# BE64: Name: .relr.dyn
# BE64: SectionData (
# BE64-NEXT: 0000: 00000000 AABBCCDD 00000000 EEFF1122
# BE64-NEXT: 0010: 10000000 33445566 10000000 778899AA
# BE64-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2[[ENCODE]]
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
## Set an arbitrary flag to demonstrate flags are set when requested.
Flags: [ SHF_ALLOC ]
Entries: [ 0x00000000AABBCCDD, 0x00000000EEFF1122,
0x1000000033445566, 0x10000000778899AA ]
## Test that the content of SHT_RELR sections for 32-bit little endian targets is correct.
# RUN: yaml2obj --docnum=2 -D ENCODE=LSB %s -o %t.le32
# RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefix=LE32
# LE32: Name: .relr.dyn
# LE32-NEXT: Type: SHT_RELR
# LE32-NEXT: Flags [
# LE32-NEXT: SHF_ALLOC
# LE32-NEXT: ]
# LE32-NEXT: Address: 0x0
# LE32-NEXT: Offset: 0x34
# LE32-NEXT: Size: 16
# LE32-NEXT: Link: 0
# LE32-NEXT: Info: 0
# LE32-NEXT: AddressAlignment: 0
# LE32-NEXT: EntrySize: 4
# LE32-NEXT: SectionData (
# LE32-NEXT: 0000: DDCCBBAA BBAAFFEE BBAAFFEE BCAAFFEE
# LE32-NEXT: )
## Test that the content of SHT_RELR sections for 32-bit big endian targets is correct.
# RUN: yaml2obj --docnum=2 -D ENCODE=MSB %s -o %t.be32
# RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefix=BE32
# BE32: Name: .relr.dyn
# BE32: SectionData (
# BE32-NEXT: 0000: AABBCCDD EEFFAABB EEFFAABB EEFFAABC |
# BE32-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2[[ENCODE]]
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
## Set an arbitrary flag to demonstrate flags are set when requested.
Flags: [ SHF_ALLOC ]
Entries: [ 0xAABBCCDD, 0xEEFFAABB,
0xEEFFAABB, 0xEEFFAABC ]
## Check we are able to set an arbitrary sh_entsize.
# RUN: yaml2obj --docnum=3 %s -o %t.entsize
# RUN: llvm-readelf --sections %t.entsize | FileCheck %s --check-prefix=ENTSIZE
# ENTSIZE: [Nr] Name Type Address Off Size ES
# ENTSIZE: [ 1] .relr.dyn RELR 00000000 000034 000001 34
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
EntSize: 0x34
Content: "12"
## Test we can't use 64-bit offsets/bitmaps when creating a 32-bit object.
# RUN: yaml2obj --docnum=4 %s -o %t.nottoolarge
# RUN: llvm-readobj --sections --section-data %t.nottoolarge | FileCheck %s --check-prefix=NOT-TOO-LARGE
# NOT-TOO-LARGE: Name: .relr.dyn
# NOT-TOO-LARGE: SectionData (
# NOT-TOO-LARGE-NEXT: 0000: FFFFFFFF
# NOT-TOO-LARGE-NEXT: )
# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=TOO-LARGE
# TOO-LARGE: error: .relr.dyn: the value is too large for 32-bits: 0x100000000
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Entries: [ 0x00000000FFFFFFFF ]
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Entries: [ 0x0000000100000000 ]
## Check we can use the "Content" key with the "Size" key when the size is greater
## than or equal to the content size.
# RUN: not yaml2obj --docnum=6 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
EntSize: 0xff
Size: [[SIZE=<none>]]
Content: [[CONTENT=<none>]]
Entries: [[ENTRIES=<none>]]
# RUN: yaml2obj --docnum=6 -DSIZE=2 -DCONTENT="'0011'" %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="0011"
# RUN: yaml2obj --docnum=6 -DSIZE=3 -DCONTENT="'0011'" %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="001100"
# CHECK-CONTENT: Name: .relr.dyn
# CHECK-CONTENT-NEXT: Type: SHT_RELR
# CHECK-CONTENT-NEXT: Flags [
# CHECK-CONTENT-NEXT: ]
# CHECK-CONTENT-NEXT: Address:
# CHECK-CONTENT-NEXT: Offset:
# CHECK-CONTENT-NEXT: Size:
# CHECK-CONTENT-NEXT: Link:
# CHECK-CONTENT-NEXT: Info:
# CHECK-CONTENT-NEXT: AddressAlignment:
# CHECK-CONTENT-NEXT: EntrySize: 255
# CHECK-CONTENT-NEXT: SectionData (
# CHECK-CONTENT-NEXT: 0000: [[DATA]] |
# CHECK-CONTENT-NEXT: )
## Check we can use the "Size" key alone to create the section.
# RUN: yaml2obj --docnum=6 -DSIZE=3 %s -o %t.size.o
# RUN: llvm-readobj --sections --section-data %t.size.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"
## Check we can use the "Content" key alone to create the section.
# RUN: yaml2obj --docnum=6 -DCONTENT="'112233'" %s -o %t.content.o
# RUN: llvm-readobj --sections --section-data %t.content.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"
## Check we can't use the "Entries" key together with the "Content" or "Size" keys.
# RUN: not yaml2obj --docnum=6 -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=ENTRIES-ERR
# RUN: not yaml2obj --docnum=6 -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=ENTRIES-ERR
# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"
## Check we create an empty section when none of "Size", "Content" or "Entries" are specified.
# RUN: yaml2obj %s --docnum=6 -o %t.empty.o
# RUN: llvm-readelf --sections --section-data %t.empty.o | \
# RUN: FileCheck %s --check-prefix=EMPTY-SEC
# EMPTY-SEC: [Nr] Name Type Address Off Size
# EMPTY-SEC: [ 1] .relr.dyn RELR 0000000000000000 000040 000000
|