xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/ARM/unwind-non-relocatable.test (revision fdceec7aeac6ae0fba4db9703bf4e4e69a126d0d)
1## Check that we dump the unwind information for a non-relocatable input properly.
2
3## Check that we correctly decode function addresses and that we are able to
4## locate corresponding STT_FUNC symbols and dump function names properly.
5# RUN: yaml2obj %s -o %t
6# RUN: llvm-readobj -u %t | FileCheck --check-prefix=UNWIND %s
7# RUN: llvm-readelf -u %t | FileCheck --check-prefix=UNWIND %s
8
9# UNWIND:      UnwindInformation {
10# UNWIND-NEXT:   UnwindIndexTable {
11# UNWIND-NEXT:     SectionIndex: 2
12# UNWIND-NEXT:     SectionName: .ARM.exidx
13# UNWIND-NEXT:     SectionOffset: 0x34
14# UNWIND-NEXT:     Entries [
15# UNWIND-NEXT:       Entry {
16# UNWIND-NEXT:         FunctionAddress: 0x230
17# UNWIND-NEXT:         FunctionName: func1
18# UNWIND-NEXT:         Model: Compact (Inline)
19# UNWIND-NEXT:         PersonalityIndex: 0
20# UNWIND-NEXT:         Opcodes [
21# UNWIND-NEXT:           0xB0      ; finish
22# UNWIND-NEXT:           0xB0      ; finish
23# UNWIND-NEXT:           0xB0      ; finish
24# UNWIND-NEXT:         ]
25# UNWIND-NEXT:       }
26# UNWIND-NEXT:       Entry {
27# UNWIND-NEXT:         FunctionAddress: 0x234
28# UNWIND-NEXT:         FunctionName: func2
29# UNWIND-NEXT:         Model: Compact (Inline)
30# UNWIND-NEXT:         PersonalityIndex: 0
31# UNWIND-NEXT:         Opcodes [
32# UNWIND-NEXT:           0x9B      ; vsp = r11
33# UNWIND-NEXT:           0x84 0x80 ; pop {fp, lr}
34# UNWIND-NEXT:         ]
35# UNWIND-NEXT:       }
36# UNWIND-NEXT:       Entry {
37# UNWIND-NEXT:         FunctionAddress: 0x248
38# UNWIND-NEXT:         FunctionName: func3
39# UNWIND-NEXT:         Model: Compact (Inline)
40# UNWIND-NEXT:         PersonalityIndex: 0
41# UNWIND-NEXT:         Opcodes [
42# UNWIND-NEXT:           0xB0      ; finish
43# UNWIND-NEXT:           0xB0      ; finish
44# UNWIND-NEXT:           0xB0      ; finish
45# UNWIND-NEXT:         ]
46# UNWIND-NEXT:       }
47# UNWIND-NEXT:       Entry {
48# UNWIND-NEXT:         FunctionAddress: 0x24C
49# UNWIND-NEXT:         Model: CantUnwind
50# UNWIND-NEXT:       }
51# UNWIND-NEXT:       Entry {
52# UNWIND-NEXT:         FunctionAddress: 0x4000026B
53# UNWIND-NEXT:         FunctionName: func4
54# UNWIND-NEXT:         Model: Compact (Inline)
55# UNWIND-NEXT:         PersonalityIndex: 0
56# UNWIND-NEXT:         Opcodes [
57# UNWIND-NEXT:           0xB0      ; finish
58# UNWIND-NEXT:           0xB0      ; finish
59# UNWIND-NEXT:           0xB0      ; finish
60# UNWIND-NEXT:         ]
61# UNWIND-NEXT:       }
62# UNWIND-NEXT:       Entry {
63# UNWIND-NEXT:         FunctionAddress: 0x25C
64# UNWIND-NEXT:         FunctionName: func5
65# UNWIND-NEXT:         ExceptionHandlingTable: .ARM.extab
66# UNWIND-NEXT:         TableEntryAddress: 0xAABE44
67# UNWIND-NEXT:         Model: Generic
68# UNWIND-NEXT:         PersonalityRoutineAddress: 0x33CCCF44
69# UNWIND-NEXT:         PersonalityRoutineName: personality1
70# UNWIND-NEXT:       }
71# UNWIND-NEXT:       Entry {
72# UNWIND-NEXT:         FunctionAddress: 0x25C
73# UNWIND-NEXT:         FunctionName: func5
74# UNWIND-NEXT:         ExceptionHandlingTable: .ARM.extab
75# UNWIND-NEXT:         TableEntryAddress: 0xAABE48
76# UNWIND-NEXT:         Model: Generic
77# UNWIND-NEXT:         PersonalityRoutineAddress: 0xFFFFFFFFF811138C
78# UNWIND-NEXT:       }
79# UNWIND-NEXT:     ]
80# UNWIND-NEXT:   }
81# UNWIND-NEXT: }
82
83--- !ELF
84FileHeader:
85  Class:   ELFCLASS32
86  Data:    ELFDATA2LSB
87  Type:    ET_DYN
88  Machine: EM_ARM
89Sections:
90  - Name:    .text
91    Type:    SHT_PROGBITS
92    Address: 0x230
93  - Name:    .ARM.exidx
94    Type:    SHT_ARM_EXIDX
95    Address: 0x24C
96    Entries:
97## A. Address of .ARM.exidx (0x24C) + entry offset (0) + 0x7fffffe4 (31 bit) == 0x230 (func1).
98      - Offset: 0x7FFFFFE4
99        Value:  0x80B0B0B0 ## arbitrary opcodes.
100## B. Address of .ARM.exidx (0x24C) + entry offset (8) + 0x7fffffe0 (31 bit) == 0x234 (func2).
101      - Offset: 0x7FFFFFE0
102        Value:  0x809B8480 ## arbitrary opcodes.
103## C. Address of .ARM.exidx (0x24C) + entry offset (16) + 0x7fffffec (31 bit) == 0x248 (func3).
104      - Offset: 0x7FFFFFEC
105        Value:  0x80B0B0B0 ## arbitrary opcodes.
106## D. Address of .ARM.exidx (0x24C) + entry offset (24) + 0x7fffffe8 (31 bit) == 0x24C.
107      - Offset: 0x7FFFFFE8
108        Value:  EXIDX_CANTUNWIND
109## E. Address of .ARM.exidx (0x24C) + entry offset (32) + 0x3FFFFFFF (31 bit) == 0x4000026b (func4).
110      - Offset: 0x3FFFFFFF
111        Value:  0x80B0B0B0 ## arbitrary opcodes.
112## F. Address of .ARM.exidx (0x24C) + entry offset (40) + 0x7FFFFFE8 (31 bit) == 0x25c (func5).
113      - Offset: 0x7FFFFFE8
114## Generic model. .ARM.exidx (0x24C) + entry offset (40 + 4) + 0x00AABBCC ==
115##                0x00AABE44 == address of entry [0] in the .ARM.extab section.
116##                0x00AABE44 + 0x33221100 (31 bit, signed, .ARM.extab entry [0] value) ==
117##                  0x33cccf44 == personality1 routine address.
118        Value:  0x00AABBCC
119## G. Address of .ARM.exidx (0x24C) + entry offset (48) + 0x7FFFFFE0 (31 bit) == 0x25c (func5).
120      - Offset: 0x7FFFFFE0
121## Generic model. .ARM.exidx (0x24C) + entry offset (48 + 4) + 0x00AABBC8 ==
122##                0x00AABE48 == address of entry [1] in the .ARM.extab section.
123##                0x00AABE48 + 0x77665544 (31 bit, signed, .ARM.extab entry [1] value) ==
124##                  0xFFFFFFFFF811138C == the address of a personality routine function that does not exist.
125        Value:  0x00AABBC8
126  - Name:    .ARM.extab
127    Type:    SHT_PROGBITS
128    Address: 0x00AABE44
129    Content: "0011223344556677"
130Symbols:
131  - Name:    func1
132    Type:    STT_FUNC
133    Section: .text
134    Value:   0x230
135  - Name:    func2
136    Type:    STT_FUNC
137    Section: .text
138    Value:   0x234
139  - Name:    func3
140    Type:    STT_FUNC
141    Section: .text
142    Value:   0x248
143  - Name:    func4
144    Type:    STT_FUNC
145    Section: .text
146    Value:   0x4000026b
147  - Name:    func5
148    Type:    STT_FUNC
149    Section: .text
150    Value:   0x25c
151  - Name:  personality1
152    Type:  STT_FUNC
153    Value: 0x33cccf44
154