[llvm] [llvm-readobj][ELF] Implement JSON output for --dynamic-table (PR #95976)

Fred Grim via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 06:49:38 PDT 2024


================
@@ -7365,6 +7369,55 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicTable() {
   W.startLine() << "]\n";
 }
 
+template <class ELFT>
+void JSONELFDumper<ELFT>::printAuxillaryDynamicTableEntryInfo(
+    const Elf_Dyn &Entry) {
+  switch (Entry.getTag()) {
+  case DT_SONAME:
+    this->W.printString("Name", this->getDynamicString(Entry.getVal()));
+    break;
+  case DT_AUXILIARY:
+    LLVM_FALLTHROUGH;
+  case DT_FILTER:
+    LLVM_FALLTHROUGH;
+  case DT_NEEDED: {
+    ListScope L(this->W, "Libraries");
+    this->W.printString(this->getDynamicString(Entry.getVal()));
+  } break;
+  case DT_USED: {
+    ListScope L(this->W, "Objects");
+    this->W.printString(this->getDynamicString(Entry.getVal()));
----------------
feg208 wrote:

so reading the elf docs I think only the Path is really multiply valued. All the others are to an offset in the string table with no documented separator like ':' or ';' or anything. I wonder why the original was a
```
[D]
```
to begin with. I must be missing something though. I am going off https://refspecs.linuxfoundation.org/elf/elf.pdf 2-12

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


More information about the llvm-commits mailing list