• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 the
5## EXIDX_CANTUNWIND (0x1) special value properly.
6
7# RUN: yaml2obj --docnum=1 -DENCODE=LSB %s -o %t.le.so
8# RUN: obj2yaml %t.le.so | FileCheck %s --check-prefix=LE
9# RUN: yaml2obj --docnum=1 -DENCODE=MSB %s -o %t.be.so
10# RUN: obj2yaml %t.be.so | FileCheck %s --check-prefix=BE
11
12# LE:      - Name: .ARM.exidx
13# LE-NEXT:   Type: SHT_ARM_EXIDX
14# LE-NEXT:   Entries:
15# LE-NEXT:     - Offset: 0xDDCCBBAA
16# LE-NEXT:       Value:  0x1000000
17# LE-NEXT:     - Offset: 0x9988FFEE
18# LE-NEXT:       Value:  EXIDX_CANTUNWIND
19# LE-NEXT: ...
20
21# BE:      - Name: .ARM.exidx
22# BE-NEXT:   Type: SHT_ARM_EXIDX
23# BE-NEXT:   Entries:
24# BE-NEXT:     - Offset: 0xAABBCCDD
25# BE-NEXT:       Value:  EXIDX_CANTUNWIND
26# BE-NEXT:     - Offset: 0xEEFF8899
27# BE-NEXT:       Value:  0x1000000
28# BE-NEXT: ...
29
30--- !ELF
31FileHeader:
32  Class:   ELFCLASS64
33  Data:    ELFDATA2[[ENCODE=LSB]]
34  Type:    ET_DYN
35  Machine: EM_ARM
36Sections:
37  - Name:    .ARM.exidx
38    Type:    SHT_ARM_EXIDX
39## 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 section
45## using the "Content" key.
46# RUN: yaml2obj --docnum=1 -DSIZE=17 %s -o %t.invalid-size.so
47# RUN: obj2yaml %t.invalid-size.so | FileCheck %s --check-prefix=INVALID-SIZE
48
49# INVALID-SIZE:      - Name:    .ARM.exidx
50# INVALID-SIZE-NEXT:   Type:    SHT_ARM_EXIDX
51# INVALID-SIZE-NEXT:   Content: AABBCCDD00000001EEFF88990100000000
52# INVALID-SIZE-NEXT: ...
53
54## Check how we dump an empty SHT_ARM_EXIDX section.
55# RUN: yaml2obj --docnum=2 %s -o %t.empty.so
56# RUN: obj2yaml %t.empty.so | FileCheck %s --check-prefix=EMPTY
57
58# EMPTY:      - Name: .ARM.exidx
59# EMPTY-NEXT:     Type:    SHT_ARM_EXIDX
60# EMPTY-NEXT:     Entries: []
61# EMPTY-NEXT: ...
62
63--- !ELF
64FileHeader:
65  Class:   ELFCLASS64
66  Data:    ELFDATA2LSB
67  Type:    ET_DYN
68  Machine: EM_ARM
69Sections:
70  - Name: .ARM.exidx
71    Type: SHT_ARM_EXIDX
72
73## Check how we dump the SHT_ARM_EXIDX (0x70000001) section when
74## the machine type is not EM_ARM. It is dumped as a regular
75## section of an unknown type.
76
77# RUN: yaml2obj --docnum=3 %s -o %t.not-arm.so
78# RUN: obj2yaml %t.not-arm.so | FileCheck %s --check-prefix=NOT-ARM
79
80# RUN: yaml2obj --docnum=3 -DMACHINE=EM_ARM %s -o %t.arm.so
81# RUN: obj2yaml %t.arm.so | FileCheck %s --check-prefix=ARM
82
83# NOT-ARM:      Sections:
84# NOT-ARM-NEXT:   - Name:    .ARM.exidx
85# NOT-ARM-NEXT:     Type:    0x70000001
86# NOT-ARM-NEXT:     Content: AABBCCDD11223344
87# NOT-ARM-NEXT: ...
88
89# ARM:      - Name: .ARM.exidx
90# ARM-NEXT:   Type: SHT_ARM_EXIDX
91# ARM-NEXT:   Entries:
92# ARM-NEXT:     - Offset: 0xDDCCBBAA
93# ARM-NEXT:       Value:  0x44332211
94# ARM-NEXT: ...
95
96--- !ELF
97FileHeader:
98  Class:   ELFCLASS64
99  Data:    ELFDATA2LSB
100  Type:    ET_DYN
101  Machine: [[MACHINE=<none>]]
102Sections:
103  - Name:    .ARM.exidx
104    Type:    SHT_PROGBITS
105    ShType:  0x70000001 ## SHT_ARM_EXIDX
106## An arbitrary valid content.
107    Content: "AABBCCDD11223344"
108