[llvm-branch-commits] [llvm] [llvm-readobj][ELF] Print the relocation of each --stack-sizes entry (PR #232332)

Prabhu Rajasekaran via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Oct 15 15:50:07 PDT 2026


================
@@ -8461,27 +8484,40 @@ void LLVMELFDumper<ELFT>::printCallGraphRelocation(
     const CallGraphFunc<ELFT> &Func, const Elf_Shdr &RelSec,
     const Elf_Shdr &SymTab) {
   const Relocation<ELFT> &R = *Func.Reloc;
+  const Elf_Sym *Sym = nullptr;
+  Expected<RelSymbol<ELFT>> TargetOrErr = this->getRelocationTarget(R, &SymTab);
+  if (!TargetOrErr)
+    this->reportUniqueWarning(TargetOrErr.takeError());
+  else
+    Sym = TargetOrErr->Sym;
+
+  // As with Address, Names comes before the Relocation object.
+  if (Sym) {
+    SmallVector<std::string> Names =
+        getCallGraphTargetNames(Func, RelSec, SymTab, *Sym);
+    if (!Names.empty())
+      W.printList("Names", Names);
+  }
----------------
Prabhuk wrote:

Done. It's pretty much as you suggested but `TargetOrErr->Sym;` above can return null. So the else block becomes `else if ((Sym = TargetOrErr->Sym)) {`

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


More information about the llvm-branch-commits mailing list