1; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu %s -filetype=obj -o %t
2; RUN: llvm-objdump -s %t | FileCheck %s
3
4declare i32 @__gxx_personality_v0(...)
5
6declare void @bar()
7
8define i64 @foo(i64 %lhs, i64 %rhs) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
9  invoke void @bar() to label %end unwind label %clean
10end:
11 ret i64 0
12
13clean:
14  %tst = landingpad { i8*, i32 } cleanup
15  ret i64 42
16}
17
18; CHECK: Contents of section .eh_frame:
19; CHECK: 0000 1c000000 00000000 017a504c 5200017c  .........zPLR..|
20; CHECK: 0010 1e0b0000 00000000 00000000 1b0c1f00  ................
21
22; Don't really care about the rest:
23
24; 0020 1c000000 24000000 00000000 24000000  ....$.......$...
25; 0030 08000000 00000000 00440c1f 10449e02  .........D...D..
26
27; The key test here is that the personality routine is sanely encoded (under the
28; small memory model it must be an 8-byte value for full generality: code+data <
29; 4GB, but you might need both +4GB and -4GB depending on where things end
30; up. However, for completeness:
31
32; First CIE:
33; ----------
34; 1c000000: Length = 0x1c
35; 00000000: This is a CIE
36; 03: Version 3
37; 7a 50 4c 52 00: Augmentation string "zPLR" (personality routine, language-specific data, pointer format)
38; 01: Code alignment factor 1
39; 78: Data alignment factor: -8
40; 1e: Return address in x30
41; 07: Augmentation data 0xb bytes (this is key!)
42; 00: Personality encoding is DW_EH_PE_absptr
43; 00 00 00 00 00 00 00 00: First part of aug (personality routine). Relocated, obviously
44; 00: Second part of aug (language-specific data): absolute pointer format used
45; 1b: pointer format: pc-relative signed 4-byte. Just like GNU.
46; 0c 1f 00: Initial instructions ("DW_CFA_def_cfa x31 ofs 0" in this case)
47