From: David Majnemer Date: Tue, 17 Mar 2015 20:41:11 +0000 (+0000) Subject: Revert "COFF: Let globals with private linkage reside in their own section" X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=76d3a99d107da9beb379ed7c6135995b25a4b474;p=oota-llvm.git Revert "COFF: Let globals with private linkage reside in their own section" This reverts commit r232539. This was committed accidently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232543 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h index 75920a3fea4..0d7c26cff8a 100644 --- a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h +++ b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h @@ -147,10 +147,6 @@ public: SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override; - void getNameWithPrefix(SmallVectorImpl &OutName, const GlobalValue *GV, - bool CannotUsePrivateLabel, Mangler &Mang, - const TargetMachine &TM) const override; - const MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const override; diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h index 62ae2372f59..8093d99882c 100644 --- a/include/llvm/Target/TargetLoweringObjectFile.h +++ b/include/llvm/Target/TargetLoweringObjectFile.h @@ -101,11 +101,6 @@ public: return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM); } - virtual void getNameWithPrefix(SmallVectorImpl &OutName, - const GlobalValue *GV, - bool CannotUsePrivateLabel, Mangler &Mang, - const TargetMachine &TM) const; - virtual const MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const; diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 5a8367eea77..725b8246a35 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -927,11 +927,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, StringRef COMDATSymName = Sym->getName(); return getContext().getCOFFSection(Name, Characteristics, Kind, COMDATSymName, Selection); - } else { - SmallString<256> TmpData; - getNameWithPrefix(TmpData, GV, true, Mang, TM); - return getContext().getCOFFSection(Name, Characteristics, Kind, TmpData, - Selection); } } @@ -953,25 +948,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, return DataSection; } -void TargetLoweringObjectFileCOFF::getNameWithPrefix( - SmallVectorImpl &OutName, const GlobalValue *GV, - bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const { - if (GV->hasPrivateLinkage() && - ((isa(GV) && TM.getFunctionSections()) || - (isa(GV) && TM.getDataSections()))) { - SmallString<256> Tmp; - Mang.getNameWithPrefix(Tmp, GV, /*CannotUsePrivateLabel=*/false); - if (Tmp.startswith(".L")) - OutName.append(Tmp.begin() + 2, Tmp.end()); - else if (Tmp.startswith("L")) - OutName.append(Tmp.begin() + 1, Tmp.end()); - else - OutName.append(Tmp.begin(), Tmp.end()); - return; - } - Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel); -} - const MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable( const Function &F, Mangler &Mang, const TargetMachine &TM) const { // If the function can be removed, produce a unique section so that diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 75100fb9923..faa6fbe6075 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -343,9 +343,3 @@ const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol // null return could mean 'no location' & we should just do that here. return MCSymbolRefExpr::Create(Sym, *Ctx); } - -void TargetLoweringObjectFile::getNameWithPrefix( - SmallVectorImpl &OutName, const GlobalValue *GV, - bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const { - Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel); -} diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 56e7e8b24bd..bc2af5e9ad6 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -175,7 +175,7 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl &Name, const TargetLoweringObjectFile *TLOF = getObjFileLowering(); const MCSection *TheSection = TLOF->SectionForGlobal(GV, GVKind, Mang, *this); bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection); - TLOF->getNameWithPrefix(Name, GV, CannotUsePrivateLabel, Mang, *this); + Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel); } MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { diff --git a/test/CodeGen/X86/global-sections.ll b/test/CodeGen/X86/global-sections.ll index 8c61411e53e..dcdc71efdc4 100644 --- a/test/CodeGen/X86/global-sections.ll +++ b/test/CodeGen/X86/global-sections.ll @@ -275,8 +275,8 @@ bb7: ; LINUX-SECTIONS: .asciz "foo" ; LINUX-SECTIONS: .size .LG14, 4 -; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G14 -; WIN32-SECTIONS: _G14: +; WIN32-SECTIONS: .section .rdata,"dr" +; WIN32-SECTIONS: L_G14: ; WIN32-SECTIONS: .asciz "foo" ; cannot be merged on MachO, but can on other formats.