[llvm] r232543 - Revert "COFF: Let globals with private linkage reside in their own section"

David Majnemer david.majnemer at gmail.com
Tue Mar 17 13:41:11 PDT 2015


Author: majnemer
Date: Tue Mar 17 15:41:11 2015
New Revision: 232543

URL: http://llvm.org/viewvc/llvm-project?rev=232543&view=rev
Log:
Revert "COFF: Let globals with private linkage reside in their own section"

This reverts commit r232539.  This was committed accidently.

Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
    llvm/trunk/lib/Target/TargetMachine.cpp
    llvm/trunk/test/CodeGen/X86/global-sections.ll

Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Tue Mar 17 15:41:11 2015
@@ -147,10 +147,6 @@ public:
                            SectionKind Kind, Mangler &Mang,
                            const TargetMachine &TM) const override;
 
-  void getNameWithPrefix(SmallVectorImpl<char> &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;

Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Mar 17 15:41:11 2015
@@ -101,11 +101,6 @@ public:
     return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
   }
 
-  virtual void getNameWithPrefix(SmallVectorImpl<char> &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;

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Tue Mar 17 15:41:11 2015
@@ -927,11 +927,6 @@ SelectSectionForGlobal(const GlobalValue
       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
   return DataSection;
 }
 
-void TargetLoweringObjectFileCOFF::getNameWithPrefix(
-    SmallVectorImpl<char> &OutName, const GlobalValue *GV,
-    bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const {
-  if (GV->hasPrivateLinkage() &&
-      ((isa<Function>(GV) && TM.getFunctionSections()) ||
-       (isa<GlobalVariable>(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

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Mar 17 15:41:11 2015
@@ -343,9 +343,3 @@ const MCExpr *TargetLoweringObjectFile::
   // null return could mean 'no location' & we should just do that here.
   return MCSymbolRefExpr::Create(Sym, *Ctx);
 }
-
-void TargetLoweringObjectFile::getNameWithPrefix(
-    SmallVectorImpl<char> &OutName, const GlobalValue *GV,
-    bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const {
-  Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
-}

Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Tue Mar 17 15:41:11 2015
@@ -175,7 +175,7 @@ void TargetMachine::getNameWithPrefix(Sm
   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 {

Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=232543&r1=232542&r2=232543&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Tue Mar 17 15:41:11 2015
@@ -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.





More information about the llvm-commits mailing list