[PATCH] Support native mach-o names in MachOFormat.h

Charles Davis cdavis5x at gmail.com
Mon Aug 19 15:14:28 PDT 2013


On Aug 19, 2013, at 4:02 PM, Eric Christopher wrote:

> Probably wouldn't take much to fix up all the name uses and leave out
> the conditional?
I have two patches; one does what Nick's patch does, but to <llvm/Support/MachO.h>, and also updates everything using it in LLVM to use the new names, and one that strips out the now-redundant <llvm/Object/MachOFormat.h> header and changes everything using *that* to use the new names.

Chip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-MachO-Add-a-bunch-of-defines.patch
Type: application/octet-stream
Size: 44282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130819/06d6d778/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Move-everything-depending-on-Object-MachOFormat.h-ov.patch
Type: application/octet-stream
Size: 161921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130819/06d6d778/attachment-0001.obj>
-------------- next part --------------


> 
> -eric
> 
> On Mon, Aug 19, 2013 at 2:57 PM, Nick Kledzik <kledzik at apple.com> wrote:
>> [+patch]
>> 
>> include/llvm/Object/MachOFormat.h is odd in that it makes up new names for the public mach-o format structs and constants (e.g. it defines LCT_Segment instead of LC_SEGMENT).    LLVM does not handle ELF this way.  LLVM defines SHT_PROGBITS just like the standard ELF header (although llvm puts them into a namespace).  This current set up makes it hard to reconcile the public mach-o documentation with llvm source code.
>> 
>> This patch adds all the standard mach-o names for structs and constants in the llvm::object::mach_o namespace.  All the existing names remain, but I put them inside #ifndef LLVM_NO_OLD_MACH_O_NAMES, so that if someone wanted to switch to the standard names they could define LLVM_NO_OLD_MACH_O_NAMES, do a full build, and update whatever failures are seen.
>> 
>> This issue came up during a code review of lld, as to why lld was defining it own mach-o constants instead of using the ones in llvm.
>> 
>> -Nick
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list