llvm.org GIT mirror llvm / dd255b3
ARMEB: Fix byte order of EH frame unwinding instructions, with modified test file This commit was already commited as revision rL208689 and discussd in phabricator revision D3704. But the test file was crashing on OS X and windows. I fixed the test file in the same way as in rL208340. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208711 91177308-0d34-0410-b5e6-96231b3b80d8 Christian Pirker 6 years ago
2 changed file(s) with 87 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
11361136 "Compact model must use __aeabi_cpp_unwind_pr0 as personality");
11371137 assert(Opcodes.size() == 4u &&
11381138 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be equal to 4");
1139 EmitBytes(StringRef(reinterpret_cast(Opcodes.data()),
1140 Opcodes.size()));
1139 uint64_t Intval = Opcodes[0] |
1140 Opcodes[1] << 8 |
1141 Opcodes[2] << 16 |
1142 Opcodes[3] << 24;
1143 EmitIntValue(Intval, Opcodes.size());
11411144 }
11421145
11431146 // Switch to the section containing FnStart
12091212 }
12101213
12111214 // Emit unwind opcodes
1212 EmitBytes(StringRef(reinterpret_cast(Opcodes.data()),
1213 Opcodes.size()));
1215 assert((Opcodes.size() % 4) == 0 &&
1216 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1217 for (unsigned I = 0; I != Opcodes.size(); I += 4) {
1218 uint64_t Intval = Opcodes[I] |
1219 Opcodes[I + 1] << 8 |
1220 Opcodes[I + 2] << 16 |
1221 Opcodes[I + 3] << 24;
1222 EmitIntValue(Intval, 4);
1223 }
12141224
12151225 // According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
12161226 // __aeabi_unwind_cpp_pr2() is used, then the handler data must be emitted
0 ; RUN: llc < %s -mtriple armeb-eabi -mattr v7 -filetype obj -o - | llvm-objdump -s - | FileCheck %s
1
2 ; ARM EHABI for big endian
3 ; This test case checks whether frame unwinding instructions are laid out in big endian format.
4 ;
5 ; This is the LLVM assembly generated from following C++ code:
6 ;
7 ; extern void foo(int);
8 ; void test(int a, int b) {
9 ; try {
10 ; foo(a);
11 ; } catch (...) {
12 ; foo(b);
13 ; }
14 ;}
15
16 define void @_Z4testii(i32 %a, i32 %b) #0 {
17 entry:
18 invoke void @_Z3fooi(i32 %a)
19 to label %try.cont unwind label %lpad
20
21 lpad: ; preds = %entry
22 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
23 catch i8* null
24 %1 = extractvalue { i8*, i32 } %0, 0
25 %2 = tail call i8* @__cxa_begin_catch(i8* %1) #2
26 invoke void @_Z3fooi(i32 %b)
27 to label %invoke.cont2 unwind label %lpad1
28
29 invoke.cont2: ; preds = %lpad
30 tail call void @__cxa_end_catch()
31 br label %try.cont
32
33 try.cont: ; preds = %entry, %invoke.cont2
34 ret void
35
36 lpad1: ; preds = %lpad
37 %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
38 cleanup
39 invoke void @__cxa_end_catch()
40 to label %eh.resume unwind label %terminate.lpad
41
42 eh.resume: ; preds = %lpad1
43 resume { i8*, i32 } %3
44
45 terminate.lpad: ; preds = %lpad1
46 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
47 catch i8* null
48 %5 = extractvalue { i8*, i32 } %4, 0
49 tail call void @__clang_call_terminate(i8* %5) #3
50 unreachable
51 }
52
53 declare void @_Z3fooi(i32) #0
54
55 declare i32 @__gxx_personality_v0(...)
56
57 declare i8* @__cxa_begin_catch(i8*)
58
59 declare void @__cxa_end_catch()
60
61 ; Function Attrs: noinline noreturn nounwind
62 define linkonce_odr hidden void @__clang_call_terminate(i8*) #1 {
63 %2 = tail call i8* @__cxa_begin_catch(i8* %0) #2
64 tail call void @_ZSt9terminatev() #3
65 unreachable
66 }
67
68 declare void @_ZSt9terminatev()
69
70 ; CHECK-LABEL: Contents of section .ARM.extab:
71 ; CHECK-NEXT: 0000 00000000 00a8b0b0
72