[clang] [llvm] [llvm][AsmPrinter] Emit call graph section (PR #87576)
Prabhu Rajasekaran via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 09:27:52 PDT 2025
================
@@ -0,0 +1,58 @@
+/// Test the callgraph section to make sure the indirect callsites
+/// (annotated by generated temporary labels .Ltmp*) are associated
+/// with the corresponding callee type identifiers.
+
+// RUN: llvm-mc -triple=x86_64 -filetype=obj -o - < %s | llvm-readelf -x .callgraph - | FileCheck %s
+
+ .text
+ .globl ball # -- Begin function ball
+ .p2align 4
+ .type ball, at function
+ball: # @ball
+.Lfunc_begin0:
+# %bb.0: # %entry
+ pushq %rbx
+ subq $32, %rsp
+ movl $0, 4(%rsp)
+ movq foo at GOTPCREL(%rip), %rcx
+ movq %rcx, 24(%rsp)
+ xorl %eax, %eax
+ callq *%rcx
+.Ltmp0:
+ movq bar at GOTPCREL(%rip), %rax
+ movq %rax, 16(%rsp)
+ movsbl 3(%rsp), %edi
+ callq *%rax
+.Ltmp1:
+ movq baz at GOTPCREL(%rip), %rax
+ movq %rax, 8(%rsp)
+ leaq 3(%rsp), %rbx
+ movq %rbx, %rdi
+ callq *%rax
+.Ltmp2:
+ callq foo at PLT
+ movsbl 3(%rsp), %edi
+ callq bar at PLT
+ movq %rbx, %rdi
+ callq baz at PLT
+ addq $32, %rsp
+ popq %rbx
+ retq
+ .section .callgraph,"o", at progbits,.text
+ .quad 0
+ .quad .Lfunc_begin0
+ .quad 1
+ .quad 3
+ /// MD5 hash of the callee type ID for foo.
+ // CHECK: 2444f731 f5eecb3e
+ .quad 0x3ecbeef531f74424
+ .quad .Ltmp0
+ /// MD5 hash of the callee type ID for bar.
+ // CHECK: 5486bc59 814b8e30
+ .quad 0x308e4b8159bc8654
+ .quad .Ltmp1
+ /// MD5 hash of the callee type ID for baz.
+ // CHECK: 7ade6814 f897fd77
----------------
Prabhuk wrote:
Done. Thank you. PTAL.
https://github.com/llvm/llvm-project/pull/87576
More information about the llvm-commits
mailing list