summaryrefslogtreecommitdiff
path: root/lib/Target/ARM
diff options
context:
space:
mode:
authorChristian Pirker <cpirker@a-bix.com>2014-05-13 11:41:49 +0000
committerChristian Pirker <cpirker@a-bix.com>2014-05-13 11:41:49 +0000
commit34b9ca5e145d363361474c21d559077d8c7bdb51 (patch)
treea7d9f0b9500695a9c5aaeb98c58d1d9176c41018 /lib/Target/ARM
parentfc2427bcf8703bbf84787e2b42aac0ef11962d2a (diff)
downloadllvm-34b9ca5e145d363361474c21d559077d8c7bdb51.tar.gz
llvm-34b9ca5e145d363361474c21d559077d8c7bdb51.tar.bz2
llvm-34b9ca5e145d363361474c21d559077d8c7bdb51.tar.xz
ARMEB: Fix byte order of EH frame unwinding instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r--lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index 657190d086..7c178650a5 100644
--- a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -1137,8 +1137,11 @@ void ARMELFStreamer::emitFnEnd() {
"Compact model must use __aeabi_cpp_unwind_pr0 as personality");
assert(Opcodes.size() == 4u &&
"Unwind opcode size for __aeabi_cpp_unwind_pr0 must be equal to 4");
- EmitBytes(StringRef(reinterpret_cast<const char*>(Opcodes.data()),
- Opcodes.size()));
+ uint64_t Intval = Opcodes[0] |
+ Opcodes[1] << 8 |
+ Opcodes[2] << 16 |
+ Opcodes[3] << 24;
+ EmitIntValue(Intval, Opcodes.size());
}
// Switch to the section containing FnStart
@@ -1210,8 +1213,15 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
}
// Emit unwind opcodes
- EmitBytes(StringRef(reinterpret_cast<const char *>(Opcodes.data()),
- Opcodes.size()));
+ assert((Opcodes.size() % 4) == 0 &&
+ "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
+ for (unsigned I = 0; I != Opcodes.size(); I += 4) {
+ uint64_t Intval = Opcodes[I] |
+ Opcodes[I + 1] << 8 |
+ Opcodes[I + 2] << 16 |
+ Opcodes[I + 3] << 24;
+ EmitIntValue(Intval, 4);
+ }
// According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
// __aeabi_unwind_cpp_pr2() is used, then the handler data must be emitted