[llvm-readobj] Fix "Section" output when emitting relocations in JSON
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 } } }, ... ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D137094
Loading
Please sign in to comment