[llvm] r189315 - Move everything depending on Object/MachOFormat.h over to Support/MachO.h.

Nick Kledzik kledzik at apple.com
Tue Aug 27 15:59:40 PDT 2013


On Aug 26, 2013, at 10:41 PM, Charles Davis <cdavis5x at gmail.com> wrote:
> On Aug 26, 2013, at 11:32 PM, Charles Davis wrote:
>> On Aug 26, 2013, at 11:19 PM, David Blaikie wrote:
>> 
>>> On Mon, Aug 26, 2013 at 10:00 PM, Charles Davis <cdavis5x at gmail.com> wrote:
>>>> Author: cdavis
>>>> Date: Tue Aug 27 00:00:43 2013
>>>> New Revision: 189315
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=189315&view=rev
>>>> Log:
>>>> Move everything depending on Object/MachOFormat.h over to Support/MachO.h.
>>> 
>>> There seem to be a number of unrelated changes in this patch -
>>> especially for such a large change, please commit the mechanical
>>> portion separately from any other cleanup/changes.
>> Sorry. Would you like me to revert this particular change?
> I went ahead and reverted it (and r189319) in r189321. It looks like it also broke the tests on some platforms (specifically System z and PowerPC--endianness issue? I don't have a big endian machine to test with, so…).

Chip, 

After looking at the failures, the problematic area is with defining relocation_info using bit fields.  Your patch uses:

+    struct scattered_relocation_info {
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
+      uint32_t r_scattered:1,
+               r_pcrel:1,
+               r_length:2,
+               r_type:4,
+               r_address:24;
+#else
+      uint32_t r_address:24,
+               r_type:4,
+               r_length:2,
+               r_pcrel:1,
+               r_scattered:1;
+#endif
+      int32_t r_value;
+    };


But whether all three of those preprocessor symbols (e.g. BIG_ENDIAN) are set up is hazy.  My guess is one of the is not set up on the failing big endian builders and causing the relocations to be messed up.  I don’t see many of the endian conditionals used anywhere in LLVM.  I’d suggest keeping the MC stuff using the word0 and word1 style of access and avoid using bitfields.


   // struct relocation_info (8 bytes)
-  macho::RelocationEntry MRE;
-  MRE.Word0 = Value;
-  MRE.Word1 = ((Index                  <<  0) |
-               (IsPCRel                << 24) |
-               (Log2Size               << 25) |
-               (1                      << 27) | // Extern
-               (macho::RIT_Generic_TLV << 28)); // Type
+  MachO::relocation_info MRE;
+  MRE.r_address = Value;
+  MRE.r_symbolnum = Index;
+  MRE.r_pcrel = IsPCRel;
+  MRE.r_length = Log2Size;
+  MRE.r_extern = 1;
+  MRE.r_type = MachO::GENERIC_RELOC_TLV;





More information about the llvm-commits mailing list