108 lines · yaml
1## Check how obj2yaml dumps the SHT_ARM_EXIDX section.2 3## For a valid section, obj2yaml emits the "Entries" key.4## This checks that we respect data endianness and recognize the5## EXIDX_CANTUNWIND (0x1) special value properly.6 7# RUN: yaml2obj --docnum=1 -DENCODE=LSB %s -o %t.le.so8# RUN: obj2yaml %t.le.so | FileCheck %s --check-prefix=LE9# RUN: yaml2obj --docnum=1 -DENCODE=MSB %s -o %t.be.so10# RUN: obj2yaml %t.be.so | FileCheck %s --check-prefix=BE11 12# LE: - Name: .ARM.exidx13# LE-NEXT: Type: SHT_ARM_EXIDX14# LE-NEXT: Entries:15# LE-NEXT: - Offset: 0xDDCCBBAA16# LE-NEXT: Value: 0x100000017# LE-NEXT: - Offset: 0x9988FFEE18# LE-NEXT: Value: EXIDX_CANTUNWIND19# LE-NEXT: ...20 21# BE: - Name: .ARM.exidx22# BE-NEXT: Type: SHT_ARM_EXIDX23# BE-NEXT: Entries:24# BE-NEXT: - Offset: 0xAABBCCDD25# BE-NEXT: Value: EXIDX_CANTUNWIND26# BE-NEXT: - Offset: 0xEEFF889927# BE-NEXT: Value: 0x100000028# BE-NEXT: ...29 30--- !ELF31FileHeader:32 Class: ELFCLASS6433 Data: ELFDATA2[[ENCODE=LSB]]34 Type: ET_DYN35 Machine: EM_ARM36Sections:37 - Name: .ARM.exidx38 Type: SHT_ARM_EXIDX39## 4 words: <arbitrary>, EXIDX_CANTUNWIND in big-endian,40## <arbitrary> and EXIDX_CANTUNWIND in little-endian.41 Content: "AABBCCDD00000001EEFF889901000000"42 Size: [[SIZE=<none>]]43 44## Check that we dump the content of a truncated SHT_ARM_EXIDX section45## using the "Content" key.46# RUN: yaml2obj --docnum=1 -DSIZE=17 %s -o %t.invalid-size.so47# RUN: obj2yaml %t.invalid-size.so | FileCheck %s --check-prefix=INVALID-SIZE48 49# INVALID-SIZE: - Name: .ARM.exidx50# INVALID-SIZE-NEXT: Type: SHT_ARM_EXIDX51# INVALID-SIZE-NEXT: Content: AABBCCDD00000001EEFF8899010000000052# INVALID-SIZE-NEXT: ...53 54## Check how we dump an empty SHT_ARM_EXIDX section.55# RUN: yaml2obj --docnum=2 %s -o %t.empty.so56# RUN: obj2yaml %t.empty.so | FileCheck %s --check-prefix=EMPTY57 58# EMPTY: - Name: .ARM.exidx59# EMPTY-NEXT: Type: SHT_ARM_EXIDX60# EMPTY-NEXT: Entries: []61# EMPTY-NEXT: ...62 63--- !ELF64FileHeader:65 Class: ELFCLASS6466 Data: ELFDATA2LSB67 Type: ET_DYN68 Machine: EM_ARM69Sections:70 - Name: .ARM.exidx71 Type: SHT_ARM_EXIDX72 73## Check how we dump the SHT_ARM_EXIDX (0x70000001) section when74## the machine type is not EM_ARM. It is dumped as a regular75## section of an unknown type.76 77# RUN: yaml2obj --docnum=3 %s -o %t.not-arm.so78# RUN: obj2yaml %t.not-arm.so | FileCheck %s --check-prefix=NOT-ARM79 80# RUN: yaml2obj --docnum=3 -DMACHINE=EM_ARM %s -o %t.arm.so81# RUN: obj2yaml %t.arm.so | FileCheck %s --check-prefix=ARM82 83# NOT-ARM: Sections:84# NOT-ARM-NEXT: - Name: .ARM.exidx85# NOT-ARM-NEXT: Type: 0x7000000186# NOT-ARM-NEXT: Content: AABBCCDD1122334487# NOT-ARM-NEXT: ...88 89# ARM: - Name: .ARM.exidx90# ARM-NEXT: Type: SHT_ARM_EXIDX91# ARM-NEXT: Entries:92# ARM-NEXT: - Offset: 0xDDCCBBAA93# ARM-NEXT: Value: 0x4433221194# ARM-NEXT: ...95 96--- !ELF97FileHeader:98 Class: ELFCLASS6499 Data: ELFDATA2LSB100 Type: ET_DYN101 Machine: [[MACHINE=<none>]]102Sections:103 - Name: .ARM.exidx104 Type: SHT_PROGBITS105 ShType: 0x70000001 ## SHT_ARM_EXIDX106## An arbitrary valid content.107 Content: "AABBCCDD11223344"108