[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

Daniel Dunbar daniel at zuster.org
Sun Nov 28 13:39:33 PST 2010


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.

 - Daniel

> -Chris




More information about the llvm-commits mailing list