[lld] r219268 - [mach-o] Support fat archives
kledzik at apple.com
Thu Oct 9 15:02:25 PDT 2014
On Oct 9, 2014, at 2:57 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> On 7 October 2014 21:48, Nick Kledzik <kledzik at apple.com> wrote:
>> Author: kledzik
>> Date: Tue Oct 7 20:48:10 2014
>> New Revision: 219268
>> URL: http://llvm.org/viewvc/llvm-project?rev=219268&view=rev
>> [mach-o] Support fat archives
>> mach-o supports "fat" files which are a header/table-of-contents followed by a
>> concatenation of mach-o files (or archives of mach-o files) built for
>> different architectures. Previously, the support for fat files was in the
>> MachOReader, but that only supported fat .o files and dylibs (not archives).
>> The fix is to put the fat handing into MachOFileNode. That way any input file
>> kind (including archives) can be fat. MachOFileNode selects the sub-range
>> of the fat file that matches the arch being linked and creates a MemoryBuffer
>> for just that subrange.
> Interesting. I wonder if a similar change should be done to
> Object/MachOUniversal.cpp. Do tools like nm support fat archives?
Yes, nm supports fat files. It takes an option -arch option which specifies which slice to use. If -arch is not specified and the file is fat, then I think the rule is that if one of the arches matches the running arch (e.g. x86_64 on a Mac), then that slice is shown, otherwise all slices are displayed.
I have noticed that llvm-objdump does not work with fat files.
More information about the llvm-commits