Prior to this patch, the JSON output would emit an invalid key from the
shared LLVM implementation. This caused llvm-readobj to output invalid
JSON. This patch introduces a small helper function to print the
relocation information differently between the LLVM and JSON formats.
Before this patch:
"Relocations": [Section (2) .rel.text { { "Relocation": { "Offset": 0, "Type": { "Value": "R_X86_64_NONE", "RawValue": 0 }, "Symbol": { "Value": "rel_0", "RawValue": 1 } } }, ...
After this patch:
"Relocations": [ { "SectionIdx": 2, "Relocs": [ { "Relocation": { "Offset": 0, "Type": { "Name": "R_X86_64_NONE", "Value": 0 }, "Symbol": { "Name": "rel_0", "Value": 1 } } }, ...
I wonder if this would be better named printRelocationSectionInfo, since it's not printing any info about the relocations themselves.