diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -624,6 +624,8 @@ 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; } @@ -915,7 +917,9 @@ } else { Name += MBB.getParent()->getSection()->getName(); if (TM.getUniqueBasicBlockSectionNames()) { - Name += "."; + if (!Name.endswith(".")) { + Name += "."; + } Name += MBB.getSymbol()->getName(); } else { UniqueID = NextUniqueID++;