[llvm] [llvm-readobj][ELF] Fix broken JSON output with --dynamic-table (PR #95976)

Fred Grim via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 09:51:49 PDT 2024


================
@@ -7365,6 +7367,19 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicTable() {
   W.startLine() << "]\n";
 }
 
+template <class ELFT> void JSONELFDumper<ELFT>::printDynamicTable() {
+  Elf_Dyn_Range Table = this->dynamic_table();
+  ListScope L(this->W, "DynamicSection");
+  for (const auto &Entry : Table) {
+    DictScope D(this->W);
+    uintX_t Tag = Entry.getTag();
+    std::string Value = this->getDynamicEntry(Tag, Entry.getVal());
+    this->W.printHex("Tag", Tag);
+    this->W.printString("Value", Value);
+    this->W.printString("Type", this->Obj.getDynamicTagAsString(Tag));
----------------
feg208 wrote:

I went with option 2. How does that strike you?

https://github.com/llvm/llvm-project/pull/95976


More information about the llvm-commits mailing list