brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.7 KiB · 3b975d8 Raw
212 lines · yaml
1## Test how we create SHT_RELR sections.2 3## Test that the content of SHT_RELR sections for 64-bit little endian targets is correct.4# RUN: yaml2obj --docnum=1 -D ENCODE=LSB %s -o %t.le645# RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefix=LE646 7# LE64:      Name: .relr.dyn8# LE64-NEXT: Type: SHT_RELR9# LE64-NEXT: Flags [10# LE64-NEXT:   SHF_ALLOC11# LE64-NEXT: ]12# LE64-NEXT: Address: 0x013# LE64-NEXT: Offset: 0x4014# LE64-NEXT: Size: 3215# LE64-NEXT: Link: 016# LE64-NEXT: Info: 017# LE64-NEXT: AddressAlignment: 018# LE64-NEXT: EntrySize: 819# LE64-NEXT: SectionData (20# LE64-NEXT:   0000: DDCCBBAA 00000000 2211FFEE 0000000021# LE64-NEXT:   0010: 66554433 00000010 AA998877 0000001022# LE64-NEXT: )23 24## Test that the content of SHT_RELR sections for 64-bit big endian targets is correct.25# RUN: yaml2obj --docnum=1 -D ENCODE=MSB %s -o %t.be6426# RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefix=BE6427 28# BE64:      Name: .relr.dyn29# BE64:      SectionData (30# BE64-NEXT:   0000: 00000000 AABBCCDD 00000000 EEFF112231# BE64-NEXT:   0010: 10000000 33445566 10000000 778899AA32# BE64-NEXT: )33 34--- !ELF35FileHeader:36  Class: ELFCLASS6437  Data:  ELFDATA2[[ENCODE]]38  Type:  ET_DYN39Sections:40  - Name:    .relr.dyn41    Type:    SHT_RELR42## Set an arbitrary flag to demonstrate flags are set when requested.43    Flags:   [ SHF_ALLOC ]44    Entries: [ 0x00000000AABBCCDD, 0x00000000EEFF1122,45               0x1000000033445566, 0x10000000778899AA ]46 47## Test that the content of SHT_RELR sections for 32-bit little endian targets is correct.48# RUN: yaml2obj --docnum=2 -D ENCODE=LSB %s -o %t.le3249# RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefix=LE3250 51# LE32:      Name: .relr.dyn52# LE32-NEXT: Type: SHT_RELR53# LE32-NEXT: Flags [54# LE32-NEXT:   SHF_ALLOC55# LE32-NEXT: ]56# LE32-NEXT: Address: 0x057# LE32-NEXT: Offset: 0x3458# LE32-NEXT: Size: 1659# LE32-NEXT: Link: 060# LE32-NEXT: Info: 061# LE32-NEXT: AddressAlignment: 062# LE32-NEXT: EntrySize: 463# LE32-NEXT: SectionData (64# LE32-NEXT:   0000: DDCCBBAA BBAAFFEE BBAAFFEE BCAAFFEE65# LE32-NEXT: )66 67## Test that the content of SHT_RELR sections for 32-bit big endian targets is correct.68# RUN: yaml2obj --docnum=2 -D ENCODE=MSB %s -o %t.be3269# RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefix=BE3270 71# BE32:      Name: .relr.dyn72# BE32:      SectionData (73# BE32-NEXT:   0000: AABBCCDD EEFFAABB EEFFAABB EEFFAABC  |74# BE32-NEXT: )75 76--- !ELF77FileHeader:78  Class: ELFCLASS3279  Data:  ELFDATA2[[ENCODE]]80  Type:  ET_DYN81Sections:82  - Name:    .relr.dyn83    Type:    SHT_RELR84## Set an arbitrary flag to demonstrate flags are set when requested.85    Flags:   [ SHF_ALLOC ]86    Entries: [ 0xAABBCCDD, 0xEEFFAABB,87               0xEEFFAABB, 0xEEFFAABC ]88 89## Check we are able to set an arbitrary sh_entsize.90# RUN: yaml2obj --docnum=3 %s -o %t.entsize91# RUN: llvm-readelf --sections %t.entsize | FileCheck %s --check-prefix=ENTSIZE92 93# ENTSIZE: [Nr] Name      Type Address  Off    Size   ES94# ENTSIZE: [ 1] .relr.dyn RELR 00000000 000034 000001 3495 96--- !ELF97FileHeader:98  Class: ELFCLASS3299  Data:  ELFDATA2LSB100  Type:  ET_DYN101Sections:102  - Name:    .relr.dyn103    Type:    SHT_RELR104    EntSize: 0x34105    Content: "12"106 107## Test we can't use 64-bit offsets/bitmaps when creating a 32-bit object.108# RUN: yaml2obj --docnum=4 %s -o %t.nottoolarge109# RUN: llvm-readobj --sections --section-data %t.nottoolarge | FileCheck %s --check-prefix=NOT-TOO-LARGE110 111# NOT-TOO-LARGE:      Name: .relr.dyn112# NOT-TOO-LARGE:      SectionData (113# NOT-TOO-LARGE-NEXT:   0000: FFFFFFFF114# NOT-TOO-LARGE-NEXT: )115 116# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=TOO-LARGE117# TOO-LARGE: error: .relr.dyn: the value is too large for 32-bits: 0x100000000118 119--- !ELF120FileHeader:121  Class: ELFCLASS32122  Data:  ELFDATA2LSB123  Type:  ET_DYN124Sections:125  - Name:    .relr.dyn126    Type:    SHT_RELR127    Entries: [ 0x00000000FFFFFFFF ]128 129--- !ELF130FileHeader:131  Class: ELFCLASS32132  Data:  ELFDATA2LSB133  Type:  ET_DYN134Sections:135  - Name:    .relr.dyn136    Type:    SHT_RELR137    Entries: [ 0x0000000100000000 ]138 139## Check we can use the "Content" key with the "Size" key when the size is greater140## than or equal to the content size.141 142# RUN: not yaml2obj --docnum=6 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \143# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR144 145# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size146 147--- !ELF148FileHeader:149  Class: ELFCLASS64150  Data:  ELFDATA2LSB151  Type:  ET_DYN152Sections:153  - Name:    .relr.dyn154    Type:    SHT_RELR155    EntSize: 0xff156    Size:    [[SIZE=<none>]]157    Content: [[CONTENT=<none>]]158    Entries: [[ENTRIES=<none>]]159 160# RUN: yaml2obj --docnum=6 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o161# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \162# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"163 164# RUN: yaml2obj --docnum=6 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o165# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \166# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"167 168# CHECK-CONTENT:      Name: .relr.dyn169# CHECK-CONTENT-NEXT: Type: SHT_RELR170# CHECK-CONTENT-NEXT: Flags [171# CHECK-CONTENT-NEXT: ]172# CHECK-CONTENT-NEXT: Address:173# CHECK-CONTENT-NEXT: Offset:174# CHECK-CONTENT-NEXT: Size:175# CHECK-CONTENT-NEXT: Link:176# CHECK-CONTENT-NEXT: Info:177# CHECK-CONTENT-NEXT: AddressAlignment:178# CHECK-CONTENT-NEXT: EntrySize: 255179# CHECK-CONTENT-NEXT: SectionData (180# CHECK-CONTENT-NEXT:   0000: [[DATA]] |181# CHECK-CONTENT-NEXT: )182 183## Check we can use the "Size" key alone to create the section.184 185# RUN: yaml2obj --docnum=6 -DSIZE=3 %s -o %t.size.o186# RUN: llvm-readobj --sections --section-data %t.size.o | \187# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"188 189## Check we can use the "Content" key alone to create the section.190 191# RUN: yaml2obj --docnum=6 -DCONTENT="'112233'" %s -o %t.content.o192# RUN: llvm-readobj --sections --section-data %t.content.o | \193# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"194 195## Check we can't use the "Entries" key together with the "Content" or "Size" keys.196 197# RUN: not yaml2obj --docnum=6 -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \198# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR199# RUN: not yaml2obj --docnum=6 -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \200# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR201 202# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"203 204## Check we create an empty section when none of "Size", "Content" or "Entries" are specified.205 206# RUN: yaml2obj %s --docnum=6 -o %t.empty.o207# RUN: llvm-readelf --sections --section-data %t.empty.o | \208# RUN:   FileCheck %s --check-prefix=EMPTY-SEC209 210# EMPTY-SEC: [Nr] Name      Type Address          Off    Size211# EMPTY-SEC: [ 1] .relr.dyn RELR 0000000000000000 000040 000000212