[LLVMdev] [lld] Verifying the Architecture of files read

Nick Kledzik kledzik at apple.com
Wed Apr 2 23:04:11 PDT 2014


On Apr 2, 2014, at 8:58 PM, Rui Ueyama wrote:

> On Wed, Apr 2, 2014 at 6:36 PM, Nick Kledzik <kledzik at apple.com> wrote:
> It is more than “verify” . Mach-o has “fat” (aka “universal”) files which contain multiple “slices”.  Each slice is for a different arch.  The Reader needs to know the intended arch up front to pick the right slice.  
> 
> That's true. Does the linker on Mac knows which architecture that is trying to link prior to handling input files (by a command line flag, environment variable, etc), or does it have to make a decision by reading a few files? (e.g. set the target architecture with the same one as the first file's magic.)

99% of the time there is a -arch option on the command line which forces which architecture is to be linked.  If there is no -arch on the command line, the linker sniffs the input files in order until it finds the first non-fat object file and then forces the architecture to match that. This sniffing is done independently (and prior to) actual input file processing.

-Nick

> 
> 
> On Apr 1, 2014, at 10:06 PM, Rui Ueyama <ruiu at google.com> wrote:
>> I'd think we can simply wait for all files to be parsed and pass them to a LinkingContext to ask whether or not the input file set seems OK.
> 
> 
> Except there is no method on lld::File that returns its “architecture”.  
> 
> We’ve been side stepping the issue of how to model architectures (e.g. triples) in lld.  We do need to eventually nail this down because we need to record that info in yaml and native files.
> 
> -Nick
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140402/b0d32e44/attachment.html>


More information about the llvm-dev mailing list