[llvm] [llvm-objdump] Handle .callgraph section (PR #151009)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 13:59:10 PDT 2025
================
@@ -3131,6 +3225,207 @@ void Dumper::printSymbol(const SymbolRef &Symbol,
outs() << ' ' << SymName << '\n';
}
+static void printCallGraphInfo(ObjectFile *Obj) {
+ // Get function info through disassembly.
+ disassembleObject(Obj, /*InlineRelocs=*/false, outs());
+
+ // Get the .callgraph section.
+ StringRef CallGraphSectionName(".callgraph");
+ std::optional<object::SectionRef> CallGraphSection;
+ for (auto Sec : ToolSectionFilter(*Obj)) {
+ StringRef Name;
+ if (Expected<StringRef> NameOrErr = Sec.getName())
+ Name = *NameOrErr;
+ else
+ consumeError(NameOrErr.takeError());
+
+ if (Name == CallGraphSectionName) {
+ CallGraphSection = Sec;
+ break;
+ }
+ }
+ if (!CallGraphSection)
+ reportWarning("there is no .callgraph section", Obj->getFileName());
+
+ // Map type id to indirect call sites.
+ MapVector<uint64_t, SmallVector<uint64_t>> TypeIdToIndirCallSites;
----------------
ilovepi wrote:
I'd consider a `using` statement to make this type easier to reason about.
```
using TypIdCallSiteMap = MapVector<uint64_t, SmallVector<uint64_t>>
```
https://github.com/llvm/llvm-project/pull/151009
More information about the llvm-commits
mailing list