[PATCH] D20431: [llvm-nm] Fix output for Mach-O universal files wrapping bitcode objects

Kevin Enderby via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 09:49:51 PDT 2016


Looks fine to me.

There is a whole bunch of better error handling that still needs to happen, I’m grinding through adding all of that, to llvm-nm and other tools.  But what you have fixes the problem you point out with bitcode files in universal files.  And is consistant with the code that is there today.

Kev

> On May 19, 2016, at 6:49 AM, Alice Atlas <alice at delopogan.com> wrote:
> 
> alice created this revision.
> alice added reviewers: Bigcheese, enderby.
> alice added a subscriber: llvm-commits.
> alice set the repository for this revision to rL LLVM.
> 
> Currently llvm-nm can look at a Mach-O universal binary and do one of a few generally unsurprising things (e.g. accept command line options to nm any selection of the contained architectures or all of them or if nothing is specified but the file contains a slice for the local machine’s own architecture then go with that); and obviously it can look at an LLVM bitcode file and do most of the same nm stuff other than have addresses for anything. Currently it can’t do both at once: if you’re targeting Darwin and you've configured some project to build with, say, -flto -arch x86_64 -arch i386, you'll end up with object files that are Mach-O universal binary wrappers containing LLVM bitcode for each architecture, and if you run llvm-nm on one of those, it will tend to silently exit 0. This patch fixes this, and adds two lit tests, one confirming its existing sensible output for -arch=all on Mach-O universal files that consist of native objects rather than bitcode, and one which shows that it currently fails on a universal file containing i386 bitcode and x86_64 bitcode but passes with the code changes in this patch applied.
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D20431
> 
> Files:
>  include/llvm/Object/MachOUniversal.h
>  lib/Object/MachOUniversal.cpp
>  test/tools/llvm-nm/X86/Inputs/test.macho-univ.IRobj-x86_64-i386
>  test/tools/llvm-nm/X86/Inputs/test.macho-univ.x86_64-i386
>  test/tools/llvm-nm/X86/machOUnivIR.test
>  test/tools/llvm-nm/X86/machOUnivNative.test
>  tools/llvm-nm/llvm-nm.cpp
> 
> <D20431.57774.patch>



More information about the llvm-commits mailing list