This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] Remove --format option in favor of YAML tags
ClosedPublic

Authored by beanz on Jun 24 2016, 6:24 PM.

Details

Summary

Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that.

Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are:

!ELF
!COFF
!mach-o
!fat-mach-o

I have a corresponding patch that is quite large that fixes up all the in-tree test cases.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 61870.Jun 24 2016, 6:24 PM
beanz retitled this revision from to [yaml2obj] Remove --format option in favor of YAML tags.
beanz updated this object.
beanz added reviewers: silvas, rafael, Bigcheese.
beanz added a subscriber: llvm-commits.
compnerd accepted this revision.Jun 24 2016, 7:22 PM
compnerd added a reviewer: compnerd.
compnerd added a subscriber: compnerd.

Nice! I think it would be a good idea to add a few tests. Basically, feed it a yaml document and ensure that the format detection happens correctly.

tools/yaml2obj/yaml2macho.cpp
450 ↗(On Diff #61870)

Not your fault, but its hard to see that the code here is switching between a fat macho or a sliced/lipo'ed/thin one.

This revision is now accepted and ready to land.Jun 24 2016, 7:22 PM
silvas accepted this revision.Jun 26 2016, 5:32 PM
silvas edited edge metadata.

Makes sense. This is how we originally wanted to do it but didn't have tag support IIRC.

This revision was automatically updated to reflect the committed changes.