[llvm-commits] [llvm] r120198 - in /llvm/trunk: include/llvm/Object/MachOFormat.h include/llvm/Object/MachOObject.h lib/Object/MachOObject.cpp tools/macho-dump/macho-dump.cpp

Chris Lattner clattner at apple.com
Sun Nov 28 14:01:56 PST 2010


On Nov 28, 2010, at 1:39 PM, Daniel Dunbar wrote:

> On Sun, Nov 28, 2010 at 11:24 AM, Chris Lattner <clattner at apple.com> wrote:
>> 
>> On Nov 26, 2010, at 11:19 PM, Daniel Dunbar wrote:
>> 
>>> MachOObject::MachOObject(MemoryBuffer *Buffer_, bool IsLittleEndian_,
>>>                          bool Is64Bit_)
>>> -  : Buffer(Buffer_), IsLittleEndian(IsLittleEndian_), Is64Bit(Is64Bit_) {
>>> +  : Buffer(Buffer_), IsLittleEndian(IsLittleEndian_), Is64Bit(Is64Bit_),
>>> +    IsSwappedEndian(IsLittleEndian != sys::isLittleEndianHost()),
>>> +    LoadCommands(0), NumLoadedCommands(0) {
>>> +  // Load the common header.
>>> +  memcpy(&Header, Buffer->getBuffer().data(), sizeof(Header));
>> 
>> Is it really a good idea to tie object file format reading to the struct layout of the host compiler?
> 
> In theory, no, but I thought about it and don't think it is a problem
> in practice.

Ok, it still seems sleazy :)

-Chris



More information about the llvm-commits mailing list