Skip to content

Commit cac8bdb

Browse files
authored
[NFC][llvm] Update call graph section's name. (#163429)
Call graph section emitted by LLVM was named `.callgraph`. Renaming it to `.llvm.callgraph`.
1 parent 8d66114 commit cac8bdb

12 files changed

+36
-29
lines changed

llvm/docs/CallGraphSection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# .callgraph Section Layout
1+
# .llvm.callgraph Section Layout
22

3-
The `.callgraph` section is used to store call graph information for each function. The section contains a series of records, with each record corresponding to a single function.
3+
The `.llvm.callgraph` section is used to store call graph information for each function. The section contains a series of records, with each record corresponding to a single function.
44

55
## Per Function Record Layout
66

7-
Each record in the `.callgraph` section has the following binary layout:
7+
Each record in the `.llvm.callgraph` section has the following binary layout:
88

99
| Field | Type | Size (bits) | Description |
1010
| -------------------------------------- | ------------- | ----------- | ------------------------------------------------------------------------------------------------------- |

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ static ConstantInt *extractNumericCGTypeId(const Function &F) {
16831683
return nullptr;
16841684
}
16851685

1686-
/// Emits .callgraph section.
1686+
/// Emits .llvm.callgraph section.
16871687
void AsmPrinter::emitCallGraphSection(const MachineFunction &MF,
16881688
FunctionCallGraphInfo &FuncCGInfo) {
16891689
if (!MF.getTarget().Options.EmitCallGraphSection)

llvm/lib/MC/MCObjectFileInfo.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
553553
SFrameSection =
554554
Ctx->getELFSection(".sframe", ELF::SHT_GNU_SFRAME, ELF::SHF_ALLOC);
555555

556-
CallGraphSection = Ctx->getELFSection(".callgraph", ELF::SHT_PROGBITS, 0);
556+
CallGraphSection =
557+
Ctx->getELFSection(".llvm.callgraph", ELF::SHT_PROGBITS, 0);
557558

558559
StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);
559560

@@ -1171,8 +1172,8 @@ MCObjectFileInfo::getCallGraphSection(const MCSection &TextSec) const {
11711172
}
11721173

11731174
return Ctx->getELFSection(
1174-
".callgraph", ELF::SHT_PROGBITS, Flags, 0, GroupName, true,
1175-
ElfSec.getUniqueID(),
1175+
".llvm.callgraph", ELF::SHT_PROGBITS, Flags, 0, GroupName,
1176+
/*IsComdat=*/true, ElfSec.getUniqueID(),
11761177
static_cast<const MCSymbolELF *>(TextSec.getBeginSymbol()));
11771178
}
11781179

llvm/test/CodeGen/ARM/call-graph-section-addrtaken.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ entry:
2727
!1 = !{i64 0, !"_ZTSFivE.generalized"}
2828
!2 = !{i64 0, !"_ZTSFviE.generalized"}
2929

30-
; CHECK: .section .callgraph,"o",%progbits,.text
30+
; CHECK: .section .llvm.callgraph,"o",%progbits,.text
3131
;; Version
3232
; CHECK-NEXT: .byte 0
3333
;; Flags -- Potential indirect target so LSB is set to 1. Other bits are 0.

llvm/test/CodeGen/ARM/call-graph-section-assembly.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
;; Test if temporary labels are generated for each indirect callsite.
2-
;; Test if the .callgraph section contains the MD5 hash of callees' type (type id)
2+
;; Test if the .llvm.callgraph section contains the MD5 hash of callees' type (type id)
33
;; is correctly paired with its corresponding temporary label generated for indirect
44
;; call sites annotated with !callee_type metadata.
5-
;; Test if the .callgraph section contains unique direct callees.
5+
;; Test if the .llvm.callgraph section contains unique direct callees.
66

77
; RUN: llc -mtriple=arm-unknown-linux --call-graph-section -o - < %s | FileCheck %s
88

@@ -36,7 +36,7 @@ entry:
3636
!4 = !{!5}
3737
!5 = !{i64 0, !"_ZTSFPvS_E.generalized"}
3838

39-
; CHECK: .section .callgraph,"o",%progbits,.text
39+
; CHECK: .section .llvm.callgraph,"o",%progbits,.text
4040
;; Version
4141
; CHECK-NEXT: .byte 0
4242
;; Flags

llvm/test/CodeGen/ARM/call-graph-section-tailcall.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
;; Tests that we store the type identifiers in .callgraph section of the object file for tailcalls.
1+
;; Tests that we store the type identifiers in .llvm.callgraph section of the object file for tailcalls.
22

33
; RUN: llc -mtriple=arm-unknown-linux --call-graph-section -filetype=obj -o - < %s | \
4-
; RUN: llvm-readelf -x .callgraph - | FileCheck %s
4+
; RUN: llvm-readelf -x .llvm.callgraph - | FileCheck %s
55

66
define i32 @check_tailcall(ptr %func, i8 %x) !type !0 {
77
entry:
@@ -27,7 +27,7 @@ declare !type !2 i32 @bar(i8 signext)
2727
!2 = !{i64 0, !"_ZTSFicE.generalized"}
2828
!3 = !{i64 0, !"_ZTSFiiE.generalized"}
2929

30-
; CHECK: Hex dump of section '.callgraph':
30+
; CHECK: Hex dump of section '.llvm.callgraph':
3131
; CHECK-NEXT: 0x00000000 00050000 00008e19 0b7f3326 e3000154
3232
; CHECK-NEXT: 0x00000010 86bc5981 4b8e3000 05100000 00a150b8
3333
;; Verify that the type id 0x308e4b8159bc8654 is in section.

llvm/test/CodeGen/ARM/call-graph-section.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
;; Tests that we store the type identifiers in .callgraph section of the object file.
1+
;; Tests that we store the type identifiers in .llvm.callgraph section of the object file.
22

33
; RUN: llc -mtriple=arm-unknown-linux --call-graph-section -filetype=obj -o - < %s | \
4-
; RUN: llvm-readelf -x .callgraph - | FileCheck %s
4+
; RUN: llvm-readelf -x .llvm.callgraph - | FileCheck %s
55

66
declare !type !0 void @foo()
77

@@ -31,7 +31,7 @@ entry:
3131

3232
;; Make sure following type IDs are in call graph section
3333
;; 0x5eecb3e2444f731f, 0x814b8e305486bc59, 0xf897fd777ade6814
34-
; CHECK: Hex dump of section '.callgraph':
34+
; CHECK: Hex dump of section '.llvm.callgraph':
3535
; CHECK-NEXT: 0x00000000 00050000 00000000 00000000 00000324
3636
; CHECK-NEXT: 0x00000010 44f731f5 eecb3e54 86bc5981 4b8e307a
3737
; CHECK-NEXT: 0x00000020 de6814f8 97fd77

llvm/test/CodeGen/X86/call-graph-section-addrtaken.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ entry:
2727
!1 = !{i64 0, !"_ZTSFivE.generalized"}
2828
!2 = !{i64 0, !"_ZTSFviE.generalized"}
2929

30-
; CHECK: .section .callgraph,"o",@progbits,.text
30+
; CHECK: .section .llvm.callgraph,"o",@progbits,.text
3131
;; Version
3232
; CHECK-NEXT: .byte 0
3333
;; Flags -- Potential indirect target so LSB is set to 1. Other bits are 0.

llvm/test/CodeGen/X86/call-graph-section-assembly.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
;; Test if temporary labels are generated for each indirect callsite.
2-
;; Test if the .callgraph section contains the MD5 hash of callees' type (type id)
2+
;; Test if the .llvm.callgraph section contains the MD5 hash of callees' type (type id)
33
;; is correctly paired with its corresponding temporary label generated for indirect
44
;; call sites annotated with !callee_type metadata.
5-
;; Test if the .callgraph section contains unique direct callees.
5+
;; Test if the .llvm.callgraph section contains unique direct callees.
66

77
; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -o - < %s | FileCheck %s
88

@@ -36,7 +36,7 @@ entry:
3636
!4 = !{!5}
3737
!5 = !{i64 0, !"_ZTSFPvS_E.generalized"}
3838

39-
; CHECK: .section .callgraph,"o",@progbits,.text
39+
; CHECK: .section .llvm.callgraph,"o",@progbits,.text
4040
;; Version
4141
; CHECK-NEXT: .byte 0
4242
;; Flags

llvm/test/CodeGen/X86/call-graph-section-tailcall.ll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
;; Tests that we store the type identifiers in .callgraph section of the object file for tailcalls.
1+
;; Tests that we store the type identifiers in .llvm.callgraph section of the object file for tailcalls.
2+
3+
; REQUIRES: x86-registered-target
4+
; REQUIRES: arm-registered-target
25

36
; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -filetype=obj -o - < %s | \
4-
; RUN: llvm-readelf -x .callgraph - | FileCheck %s
7+
; RUN: llvm-readelf -x .llvm.callgraph - | FileCheck %s
58

69
define i32 @check_tailcall(ptr %func, i8 %x) !type !0 {
710
entry:
@@ -27,7 +30,7 @@ declare !type !2 i32 @bar(i8 signext)
2730
!2 = !{i64 0, !"_ZTSFicE.generalized"}
2831
!3 = !{i64 0, !"_ZTSFiiE.generalized"}
2932

30-
; CHECK: Hex dump of section '.callgraph':
33+
; CHECK: Hex dump of section '.llvm.callgraph':
3134
; CHECK-NEXT: 0x00000000 00050000 00000000 00008e19 0b7f3326
3235
; CHECK-NEXT: 0x00000010 e3000154 86bc5981 4b8e3000 05000000
3336
;; Verify that the type id 0x308e4b8159bc8654 is in section.

0 commit comments

Comments
 (0)