From bf9b77d2facb46fa0873196d9943ccfcc0cccb63 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 1 Aug 2018 01:03:34 +0000 Subject: [PATCH] Tidy up logic around unique section name creation and remove a mostly unused variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338468 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index b5dd2d4cca8..58e3e71133c 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -455,7 +455,6 @@ static MCSectionELF *selectELFSectionForGlobal( Group = C->getName(); } - bool UniqueSectionNames = TM.getUniqueSectionNames(); SmallString<128> Name; if (Kind.isMergeableCString()) { // We also need alignment here. @@ -479,16 +478,17 @@ static MCSectionELF *selectELFSectionForGlobal( Name += *OptionalPrefix; } - if (EmitUniqueSection && UniqueSectionNames) { - Name.push_back('.'); - TM.getNameWithPrefix(Name, GO, Mang, true); - } unsigned UniqueID = MCContext::GenericSectionID; - if (EmitUniqueSection && !UniqueSectionNames) { - UniqueID = *NextUniqueID; - (*NextUniqueID)++; + if (EmitUniqueSection) { + if (TM.getUniqueSectionNames()) { + Name.push_back('.'); + TM.getNameWithPrefix(Name, GO, Mang, true /*MayAlwaysUsePrivate*/); + } else { + UniqueID = *NextUniqueID; + (*NextUniqueID)++; + } } - // Use 0 as the unique ID for execute-only text + // Use 0 as the unique ID for execute-only text. if (Kind.isExecuteOnly()) UniqueID = 0; return Ctx.getELFSection(Name, getELFSectionType(Name, Kind), Flags, -- 2.50.1