[llvm-readobj] Fix JSON output for Relocations
The existing JSON incorrectly outputs line breaks and other invalid JSON. Example Before this patch: ``` ... "Relocations":[Section (9) .rela.dyn { 0xA3B0 R_X86_64_RELATIVE - 0x43D0 0xA3B8 R_X86_64_RELATIVE - 0x4A30 ... ``` Example After this patch: ``` ... "Relocations":[Section (9) .rela.dyn { {"Relocation":{"Offset":41904,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8}, "Symbol":{"Value":"","RawValue":0},"Addend":17360}}, {"Relocation":{"Offset":41912,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8}, "Symbol":{"Value":"","RawValue":0},"Addend":18992}}, {"Relocation":{"Offset":41920,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8}, "Symbol":{"Value":"","RawValue":0},"Addend":17440}}, ... ``` Note there are still issues with the Section, but each Relocation is now a valid JSON object that can be parsed. Future patches will address the issues regarding JSON output for the Section. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D137089
Loading
Please sign in to comment