[llvm] r358839 - [BinaryFormat] Fix bitfield-ordering of MachO::relocation_info on big-endian.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 20:14:43 PDT 2019


Author: lhames
Date: Sat Apr 20 20:14:43 2019
New Revision: 358839

URL: http://llvm.org/viewvc/llvm-project?rev=358839&view=rev
Log:
[BinaryFormat] Fix bitfield-ordering of MachO::relocation_info on big-endian.

Hopefully this will fix the JITLink regression test failures on big-endian
testers (e.g.
http://lab.llvm.org:8011/builders/clang-s390x-linux-lnt/builds/12702)

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

Modified: llvm/trunk/include/llvm/BinaryFormat/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/MachO.h?rev=358839&r1=358838&r2=358839&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/MachO.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/MachO.h Sat Apr 20 20:14:43 2019
@@ -942,8 +942,13 @@ struct fat_arch_64 {
 // Structs from <mach-o/reloc.h>
 struct relocation_info {
   int32_t r_address;
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
+  uint32_t r_type : 4,  r_extern : 1, r_length : 2, r_pcrel : 1,
+      r_symbolnum : 24;
+#else
   uint32_t r_symbolnum : 24, r_pcrel : 1, r_length : 2, r_extern : 1,
       r_type : 4;
+#endif
 };
 
 struct scattered_relocation_info {




More information about the llvm-commits mailing list