[NoPatch!] [lld]:What output formats should we support?

Tim Northover t.p.northover at gmail.com
Fri Jun 20 11:20:29 PDT 2014


>> + printAtoms, also in MachOLinkingContext
>>
>> The latter isn't quite the same, because output always goes to stdout,
>> and the normal object is still created, but I think it should be in
>> the same uniform set.
>
> This is purely for test cases and inspection.  It prints the atom graph after all passes are done.
> It is independent of the cases above.  It has nothing to do with the real linker output.

Sure, but in clang terms this *would* just be the normal output, as
controlled by -emit-llvm or -ast-dump, which replace the current
output rather than something like -debug which adds more. In general
LLVM-land, tests using -debug equivalents are rare.

>> + HostNative ( == old Default)
>> + HostYAML
>> + AtomNative (== old Native)
>> + AtomYAML (== old YAML)
> “Host” is wrong here.  lld is supposed to be a cross compiler.  Host usually means
> what you are running on.  The term we’ve been using for ELF/COFF/Mach-O is
> “flavor”.

Yep, the names are admittedly dodgy. It's the concepts I'm keen on at
the moment. Mostly because, since we accept a YAMLised version of
MachO, I think there should be an easy way to create it from the
command-line and I'd rather have a uniform interface than a one-off
option.

I'll certainly take another stab at the names in light of what you've
said though.

> Adding the forth case (e.g. mach-o as yaml), is interesting.  But I’m  not
> sure who would used that mode, other that for creating test case inputs.

No-one. At least as far as I can tell. But creating test case inputs
easily is a very useful ability.

> The mach-o writer is set up to handle that because it always first creates an
> intermediate “normalized mach-o” data structure which can then be written as
> binary or yaml-encoded-mach-o.  But I don’t think the ELF and COFF writers can
> do that.  They would probably need to write the output as a binary to a temp
> file then run obj2yaml to convert it to yaml.

They could simply not support that output for now (looking at
ELFLinkingContext::validateImpl, it already doesn't support "Native").

>From reading your initial commit of the the MachO YAML form, it seems
like you wanted it to spread out there eventually (and I also think
this would be a good idea: checking in .o files makes minor
modifications to tests rather difficult and non-obvious).

Cheers.

Tim.




More information about the llvm-commits mailing list