[llvm] r208711 - ARMEB: Fix byte order of EH frame unwinding instructions, with modified test file

Christian Pirker cpirker at a-bix.com
Tue May 13 09:44:31 PDT 2014


Author: cpirker
Date: Tue May 13 11:44:30 2014
New Revision: 208711

URL: http://llvm.org/viewvc/llvm-project?rev=208711&view=rev
Log:
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.


Added:
    llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll
      - copied, changed from r208691, llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll
Modified:
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=208711&r1=208710&r2=208711&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Tue May 13 11:44:30 2014
@@ -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(
   }
 
   // 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

Copied: llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll (from r208691, llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll?p2=llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll&p1=llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll&r1=208691&r2=208711&rev=208711&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/big-endian-eh-unwind.ll Tue May 13 11:44:30 2014
@@ -1,4 +1,4 @@
-; RUN: llc -march armeb -mattr v7 -filetype obj -o - %s | llvm-objdump -s - | FileCheck %s
+; RUN: llc < %s -mtriple armeb-eabi -mattr v7 -filetype obj -o - | llvm-objdump -s - | FileCheck %s
 
 ; ARM EHABI for big endian
 ; This test case checks whether frame unwinding instructions are laid out in big endian format.
@@ -69,5 +69,5 @@ define linkonce_odr hidden void @__clang
 declare void @_ZSt9terminatev()
 
 ; CHECK-LABEL: Contents of section .ARM.extab:
-; CHECK-NEXT: 0000 00000000 00b0b0b0
+; CHECK-NEXT: 0000 00000000 00a8b0b0
 





More information about the llvm-commits mailing list