[llvm] Reland "[llvm-readobj] Dump callgraph section info for ELF" (PR #176260)

Prabhu Rajasekaran via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 11:03:28 PST 2026


================
@@ -8154,6 +8303,120 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printCGProfile() {
   }
 }
 
+template <class ELFT> void LLVMELFDumper<ELFT>::printCallGraphInfo() {
+  // Call graph section is of type SHT_LLVM_CALL_GRAPH. Typically named
+  // ".llvm.callgraph". First fetch the section by its type.
+  using Elf_Shdr = typename ELFT::Shdr;
+  Expected<MapVector<const Elf_Shdr *, const Elf_Shdr *>> MapOrErr =
+      this->Obj.getSectionAndRelocations([](const Elf_Shdr &Sec) {
+        return Sec.sh_type == ELF::SHT_LLVM_CALL_GRAPH;
+      });
+  if (!MapOrErr || MapOrErr->empty()) {
+    reportWarning(createError("unable to read SHT_LLVM_CALL_GRAPH section: " +
+                              toString(MapOrErr.takeError())),
+                  this->FileName);
+    return;
----------------
Prabhuk wrote:

Done.

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


More information about the llvm-commits mailing list