[llvm] [llvm-readobj] Dump callgraph section info for ELF (PR #157499)
Prabhu Rajasekaran via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 11 15:50:08 PST 2025
================
@@ -0,0 +1,146 @@
+## Tests --call-graph-info prints information from call graph section.
+
+# REQUIRES: x86-registered-target
+
+# RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t
+# RUN: llvm-readelf --call-graph-info %t 2>&1 | count 0
+# RUN: llvm-readelf --elf-output-style=LLVM --call-graph-info %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=LLVM
+# RUN: llvm-readelf --elf-output-style=JSON --pretty-print --call-graph-info %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=JSON
+
+# LLVM: warning: '[[FILE]]': .llvm.callgraph section has unknown type id for 2 indirect targets.
+# LLVM-NEXT: CallGraph [
+# LLVM-NEXT: Function {
+# LLVM-NEXT: warning: '[[FILE]]': unknown relocation at offset 2
+# LLVM-NEXT: Version: 0
+# LLVM-NEXT: IsIndirectTarget: Yes
+# LLVM-NEXT: TypeId: 0x0
+# LLVM-NEXT: NumDirectCallees: 1
+# LLVM-NEXT: DirectCallees [
+# LLVM-NEXT: {
+# LLVM-NEXT: warning: '[[FILE]]': unknown relocation at offset 19
+# LLVM-NEXT: }
+# LLVM-NEXT: ]
+# LLVM-NEXT: NumIndirectTargetTypeIDs: 0
+# LLVM-NEXT: IndirectTypeIDs: []
+# LLVM-NEXT: }
+# LLVM-NEXT: Function {
+# LLVM-NEXT: warning: '[[FILE]]': unknown relocation at offset 29
+# LLVM-NEXT: Version: 0
+# LLVM-NEXT: IsIndirectTarget: Yes
+# LLVM-NEXT: TypeId: 0x0
+# LLVM-NEXT: NumDirectCallees: 0
+# LLVM-NEXT: DirectCallees [
+# LLVM-NEXT: ]
+# LLVM-NEXT: NumIndirectTargetTypeIDs: 1
+# LLVM-NEXT: IndirectTypeIDs: [0x10]
+# LLVM-NEXT: }
+# LLVM-NEXT: Function {
+# LLVM-NEXT: warning: '[[FILE]]': unknown relocation at offset 56
+# LLVM-NEXT: Version: 0
+# LLVM-NEXT: IsIndirectTarget: Yes
+# LLVM-NEXT: TypeId: 0x20
+# LLVM-NEXT: NumDirectCallees: 0
+# LLVM-NEXT: DirectCallees [
+# LLVM-NEXT: ]
+# LLVM-NEXT: NumIndirectTargetTypeIDs: 0
+# LLVM-NEXT: IndirectTypeIDs: []
+# LLVM-NEXT: }
+# LLVM-NEXT: ]
+
+# JSON: warning: '[[FILE]]': .llvm.callgraph section has unknown type id for 2 indirect targets.
+# JSON: "CallGraph": [
+# JSON-NEXT: {
+# JSON-NEXT: "Function": {
+# JSON-SAME: warning: '[[FILE]]': unknown relocation at offset 2
----------------
Prabhuk wrote:
Piping the stderr to /dev/null to avoid warnings clobbering the stdout content.
https://github.com/llvm/llvm-project/pull/157499
More information about the llvm-commits
mailing list