brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · c573fe0 Raw
130 lines · yaml
1## Test how we create SHT_ARM_EXIDX sections.2 3## Test that the content of SHT_ARM_EXIDX sections,4## generated for 32/64-bit little/big endian targets is correct.5## Also check that we can use a special EXIDX_CANTUNWIND (0x1) value for a Value field of an entry.6# RUN: yaml2obj --docnum=1 -DENCODE=LSB -DCLASS=64 %s -o %t.le647# RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefixes=DEFAULT,LE8# RUN: yaml2obj --docnum=1 -DENCODE=LSB -DCLASS=32 %s -o %t.le329# RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefixes=DEFAULT,LE10# RUN: yaml2obj --docnum=1 -DENCODE=MSB -DCLASS=64 %s -o %t.be6411# RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefixes=DEFAULT,BE12# RUN: yaml2obj --docnum=1 -DENCODE=MSB -DCLASS=32 %s -o %t.be3213# RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefixes=DEFAULT,BE14 15# DEFAULT:      Name: .ARM.exidx (1)16# DEFAULT-NEXT: Type: SHT_ARM_EXIDX (0x70000001)17# DEFAULT-NEXT: Flags [ (0x0)18# DEFAULT-NEXT: ]19# DEFAULT-NEXT: Address: 0x020# DEFAULT-NEXT: Offset: 0x{{.*}}21# DEFAULT-NEXT: Size: 1622# DEFAULT-NEXT: Link: 023# DEFAULT-NEXT: Info: 024# DEFAULT-NEXT: AddressAlignment: 025# DEFAULT-NEXT: EntrySize: 026# DEFAULT-NEXT: SectionData (27# LE-NEXT:       0000: DDCCBBAA 44332211 9988FFEE 01000000  |28# BE-NEXT:       0000: AABBCCDD 11223344 EEFF8899 00000001  |29# DEFAULT-NEXT: )30 31--- !ELF32FileHeader:33  Class:   ELFCLASS[[CLASS=64]]34  Data:    ELFDATA2[[ENCODE=LSB]]35  Type:    ET_DYN36  Machine: [[MACHINE=EM_ARM]]37Sections:38  - Name: .ARM.exidx39    Type: SHT_ARM_EXIDX40    Entries:41      - Offset: 0xAABBCCDD42        Value:  0x1122334443      - Offset: 0xEEFF889944        Value:  EXIDX_CANTUNWIND45 46## Check we only recognize the SHT_ARM_EXIDX section type when machine type is EM_ARM.47# RUN: not yaml2obj --docnum=1 -DMACHINE=EM_NONE %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN48 49# UNKNOWN:      error: invalid hex32 number50# UNKNOWN-NEXT:  Type: SHT_ARM_EXIDX51 52## Check we can set arbitrary section properties for a SHT_ARM_EXIDX section.53## Also check that we are able to specify none of "Entries", "Content" nor "Size" keys.54 55# RUN: yaml2obj --docnum=2 %s -o %t.props.o56# RUN: llvm-readelf --sections %t.props.o | FileCheck %s --check-prefix=PROPERTIES57 58# PROPERTIES: [Nr] Name       Type      Address          Off    Size   ES Flg Lk    Inf Al59# PROPERTIES: [ 1] .ARM.exidx ARM_EXIDX 0000000000001122 000055 000000 66 AMS 13124 0   8560 61--- !ELF62FileHeader:63  Class:   ELFCLASS6464  Data:    ELFDATA2LSB65  Type:    ET_REL66  Machine: EM_ARM67Sections:68  - Name:         .ARM.exidx69    Type:         SHT_ARM_EXIDX70    Flags:        [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]71    Address:      0x112272    Link:         0x334473    AddressAlign: 0x5574    EntSize:      0x6675 76## Check we can't use the "Entries" key together with the "Content" or "Size" keys.77 78# RUN: not yaml2obj --docnum=3 -DSIZE=0 -DENT="[]" %s 2>&1 | \79# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR80# RUN: not yaml2obj --docnum=3 -DCONTENT="'00'" -DENT="[]" %s 2>&1 | \81# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR82 83# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"84 85--- !ELF86FileHeader:87  Class:   ELFCLASS6488  Data:    ELFDATA2LSB89  Type:    ET_REL90  Machine: EM_ARM91Sections:92  - Name:    .ARM.exidx93    Type:    SHT_ARM_EXIDX94    Size:    [[SIZE=<none>]]95    Content: [[CONTENT=<none>]]96    Entries: [[ENT=<none>]]97 98## Check we can use the "Content" key with the "Size" key when the size is greater99## than or equal to the content size.100 101# RUN: not yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=0 %s 2>&1 | \102# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR103 104# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size105 106# RUN: yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=1 %s -o %t.cont.size.eq.o107# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \108# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="00"109 110# RUN: yaml2obj --docnum=3 -DCONTENT="'00'" -DSIZE=2 %s -o %t.cont.size.gr.o111# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \112# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0000"113 114# CHECK-CONTENT:      Name: .ARM.exidx115# CHECK-CONTENT:      SectionData (116# CHECK-CONTENT-NEXT:   0000: [[DATA]] |117# CHECK-CONTENT-NEXT: )118 119## Check we can use "Content" key alone to emit arbitrary content.120 121# RUN: yaml2obj --docnum=3 -DCONTENT="'11223344'" %s -o %t.content.o122# RUN: llvm-readobj --sections --section-data %t.content.o | \123# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="11223344"124 125## Check we can use "Size" key alone to emit content of an arbitrary size.126 127# RUN: yaml2obj --docnum=3 -DSIZE=4 %s -o %t.size.o128# RUN: llvm-readobj --sections --section-data %t.size.o | \129# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="00000000"130