Skip to content

Commit

Permalink
Address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlavaee committed Sep 22, 2023
1 parent 1430099 commit 87ffbe9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,9 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
// name, or a unique ID for the section.
SmallString<128> Name;
StringRef FunctionSectionName = MBB.getParent()->getSection()->getName();
if (!FunctionSectionName.equals(".text") &&
!FunctionSectionName.startswith(".text.")) {
// If the original function has a custom non-dot-text section, then emit
// all basic block sections into that section too, but with a unique id.
Name = FunctionSectionName;
UniqueID = NextUniqueID++;
} else {
if (FunctionSectionName.equals(".text") ||
FunctionSectionName.startswith(".text.")) {
// Function is in a regular .text section.
StringRef FunctionName = MBB.getParent()->getName();
if (MBB.getSectionID() == MBBSectionID::ColdSectionID) {
Name += BBSectionsColdTextPrefix;
Expand All @@ -1063,6 +1059,11 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
UniqueID = NextUniqueID++;
}
}
} else {
// If the original function has a custom non-dot-text section, then emit
// all basic block sections into that section too, each with a unique id.
Name = FunctionSectionName;
UniqueID = NextUniqueID++;
}

unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_EXECINSTR;
Expand Down

0 comments on commit 87ffbe9

Please sign in to comment.