[PATCH] D54674: [llvm-objcopy] First bits for MachO
Chris Bieneman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 4 16:50:14 PST 2018
beanz added a comment.
My $0.02 on the yaml discussion for tests:
The primary goal of the ObjectYAML tools for MachO was testing tools that cared more about the structure of the file than the data contained in the sections. It allowed the tools to verify load command parsing, object file layout, linkedit data parsing, and debug information (although DWARF5 support is mostly missing). At the time when I stopped working on the YAML tools, the MachO support was complete for load commands, linkedit, and debug information. Data and text section information was not preserved, although the section descriptions themselves were, so the obj->yaml->obj flow would zero out the section data resulting in an appropriately sized and laid out file.
The YAML representation for MachO differs from the ELF or COFF implementations in that it was intended to support converting a MachO generated by the compiler to YAML, round trip it back to binary, and get bit-for-bit identical output for the fields that are preserved in the yaml. This is very useful for certain types of testing (nm, objdump, debug info, etc). Because of the differences in approach between MachO's YAML tooling and the ELF/COFF yaml tooling I think they reasonably have different applications in testing.
In the cases here I'm not sure that `obj2yaml | FileCheck` really adds any additional value over `cmp`, but I do think that for MachO files, unless you really care about the section data, writing tests as yaml should be preferred over binary or assembly tests. Yaml should be preferred over binary files because binary test files are harder to understand and work with, and yaml should be preferred over assembly because it narrows the testing surface (an assembler bug resulting in objcopy failing tests would be unfortunate).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54674/new/
https://reviews.llvm.org/D54674
More information about the llvm-commits
mailing list