diff options
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index a9b1455..a3bfd65 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -611,15 +611,19 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, Name = getSectionPrefixForGlobal(Kind); } + bool HasPrefix = false; if (const auto *F = dyn_cast<Function>(GO)) { - if (Optional<StringRef> Prefix = F->getSectionPrefix()) + if (Optional<StringRef> Prefix = F->getSectionPrefix()) { Name += *Prefix; + HasPrefix = true; + } } if (UniqueSectionName) { Name.push_back('.'); TM.getNameWithPrefix(Name, GO, Mang, /*MayAlwaysUsePrivate*/true); - } + } else if (HasPrefix) + Name.push_back('.'); return Name; } |