aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorPan, Tao <tao.pan@intel.com>2021-02-20 10:15:06 +0800
committerWang, Pengfei <pengfei.wang@intel.com>2021-02-20 10:15:48 +0800
commit12edddafac451cb39b923dd0883794f554fc9616 (patch)
treea3ecc8e3fe9aecb25cb11193042aaebe4ed72fc8 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentc17547df44fcbe2cd34bd264b6bda7af0208248b (diff)
downloadllvm-12edddafac451cb39b923dd0883794f554fc9616.zip
llvm-12edddafac451cb39b923dd0883794f554fc9616.tar.gz
llvm-12edddafac451cb39b923dd0883794f554fc9616.tar.bz2
[CodeGen] Fix two dots between text section name and symbol name
There is a trailing dot in text section name if it has prefix, don't add repeated dot when connect text section name and symbol name. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D96327
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 7d3d402..2530fdc 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -626,6 +626,8 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind,
Name.push_back('.');
TM.getNameWithPrefix(Name, GO, Mang, /*MayAlwaysUsePrivate*/true);
} else if (HasPrefix)
+ // For distinguishing between .text.${text-section-prefix}. (with trailing
+ // dot) and .text.${function-name}
Name.push_back('.');
return Name;
}
@@ -939,7 +941,8 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
} else {
Name += MBB.getParent()->getSection()->getName();
if (TM.getUniqueBasicBlockSectionNames()) {
- Name += ".";
+ if (!Name.endswith("."))
+ Name += ".";
Name += MBB.getSymbol()->getName();
} else {
UniqueID = NextUniqueID++;