[lld] How to test Reader / Writer

Hello,

I’m actually experimenting with lld mach-o support, and would like to write some tests for new and existing features.
Actually, I can’t find how to write a reader/writer test.

I’d like to add LC_RPATH support to reader / writer. But I don’t know how it can be tested.
The idea would be to have a yaml representation of a dylib or executable containing a rpath load command. Then convert it into a binary file, test the binary file using objdump or similar command, and then read back the binary and write a yaml representation that could be checked using FileCheck.

I know it is possible to link an object in the yaml format or output the linker result on yaml, but what I want is to convert any kind of binary and not only object.

Is there such testing facility in lld. That is a command that allow to convert from on format (binary, yaml) to an other using the integrated reader/writer ?

Such test would be useful to detect issue like the one in the Mach-O binary reader that does not properly read current and compatibility version in LC_ID_DYLIB load command (there is test for that feature that uses the yaml reader, but it does not cover the binary reader).

Thanks
Jean-Daniel