[llvm] r179298 - Fix llvm-readobj tests on big endian hosts.

Rafael Espindola rafael.espindola at gmail.com
Thu Apr 11 10:23:23 PDT 2013


Author: rafael
Date: Thu Apr 11 12:23:23 2013
New Revision: 179298

URL: http://llvm.org/viewvc/llvm-project?rev=179298&view=rev
Log:
Fix llvm-readobj tests on big endian hosts.

Modified:
    llvm/trunk/include/llvm/Object/MachO.h

Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=179298&r1=179297&r2=179298&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Thu Apr 11 12:23:23 2013
@@ -112,11 +112,18 @@ namespace MachOFormat {
     MachOInt32 Reserved3;
   };
 
+  struct MachOInt24 {
+    uint8_t bytes[3];
+    operator uint32_t() const {
+      return (bytes[2] << 24) | (bytes[1] << 16) | bytes[0];
+    }
+  };
+
   template<endianness TargetEndianness>
   struct RelocationEntry {
     LLVM_MACHOB_IMPORT_TYPES(TargetEndianness)
     MachOInt32 Address;
-    unsigned SymbolNum : 24;
+    MachOInt24 SymbolNum;
     unsigned PCRel : 1;
     unsigned Length : 2;
     unsigned External : 1;





More information about the llvm-commits mailing list