diff options
author | Christian Pirker <cpirker@a-bix.com> | 2014-05-13 11:41:49 +0000 |
---|---|---|
committer | Christian Pirker <cpirker@a-bix.com> | 2014-05-13 11:41:49 +0000 |
commit | ea3514ecdbfa154fa04c01eaa7a82166b7890e22 (patch) | |
tree | f2e669553000e4f680eb97f5863501f9a9592fac /llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | |
parent | 688dfa55b6fc6ece154c429f78021ecb3aae3500 (diff) | |
download | bcm5719-llvm-ea3514ecdbfa154fa04c01eaa7a82166b7890e22.tar.gz bcm5719-llvm-ea3514ecdbfa154fa04c01eaa7a82166b7890e22.zip |
ARMEB: Fix byte order of EH frame unwinding instructions
llvm-svn: 208689
Diffstat (limited to 'llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp index 657190d086d..7c178650a59 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ b/llvm/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 |