<div dir="ltr">This breaks LTO, specifically the LLVMgold plugin, which starts to segfault. The problem is that the TargetLoweringObjectFile is used before being initialized. I'll provide more details in a few minutes.<div>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 11:24 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Feb 18 16:24:57 2014<br>
New Revision: 201608<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=201608&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=201608&view=rev</a><br>
Log:<br>
Fix PR18743.<br>
<br>
The IR<br>
@foo = private constant i32 42<br>
<br>
is valid, but before this patch we would produce an invalid MachO from it. It<br>
was invalid because it would use an L label in a section where the liker needs<br>
the labels in order to atomize it.<br>
<br>
One way of fixing it would be to just reject this IR in the backend, but that<br>
would not be very front end friendly.<br>
<br>
What this patch does is use an 'l' prefix in sections that we know the linker<br>
requires symbols for atomizing them. This allows frontends to just use<br>
private and not worry about which sections they go to or how the linker handles<br>
them.<br>
<br>
One small issue with this strategy is that now a symbol name depends on the<br>
section, which is not available before codegen. This is not a problem in<br>
practice. The reason is that it only happens with private linkage, which will<br>
be ignored by the non codegen users (llvm-nm and llvm-ar).<br>
<br>
Added:<br>
    llvm/trunk/test/CodeGen/X86/osx-private-labels.ll<br>
Modified:<br>
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h<br>
    llvm/trunk/include/llvm/IR/Mangler.h<br>
    llvm/trunk/include/llvm/Target/TargetLowering.h<br>
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp<br>
    llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp<br>
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br>
    llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp<br>
    llvm/trunk/lib/IR/Mangler.cpp<br>
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
    llvm/trunk/lib/LTO/LTOModule.cpp<br>
    llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp<br>
    llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h<br>
    llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp<br>
    llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp<br>
    llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h<br>
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp<br>
    llvm/trunk/lib/Target/X86/X86MCInstLower.cpp<br>
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp<br>
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.h<br>
    llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp<br>
    llvm/trunk/test/CodeGen/PowerPC/private.ll<br>
    llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll<br>
    llvm/trunk/test/CodeGen/X86/pr10420.ll<br>
    llvm/trunk/test/CodeGen/X86/private-2.ll<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Feb 18 16:24:57 2014<br>
@@ -161,6 +161,9 @@ namespace llvm {<br>
     /// getCurrentSection() - Return the current section we are emitting to.<br>
     const MCSection *getCurrentSection() const;<br>
<br>
+    void getNameWithPrefix(SmallVectorImpl<char> &Name,<br>
+                           const GlobalValue *GV) const;<br>
+<br>
     MCSymbol *getSymbol(const GlobalValue *GV) const;<br>
<br>
     //===------------------------------------------------------------------===//<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Tue Feb 18 16:24:57 2014<br>
@@ -57,14 +57,15 @@ public:<br>
<br>
   /// Return an MCExpr to use for a reference to the specified type info global<br>
   /// variable from exception handling information.<br>
-  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                        unsigned Encoding, Mangler &Mang,<br>
-                                        MachineModuleInfo *MMI,<br>
-                                        MCStreamer &Streamer) const<br>
+  const MCExpr *<br>
+  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                          Mangler &Mang, const TargetMachine &TM,<br>
+                          MachineModuleInfo *MMI, MCStreamer &Streamer) const<br>
       LLVM_OVERRIDE;<br>
<br>
   // The symbol that gets passed to .cfi_personality.<br>
   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
+                                    const TargetMachine &TM,<br>
                                     MachineModuleInfo *MMI) const LLVM_OVERRIDE;<br>
<br>
   void InitializeELF(bool UseInitArray_);<br>
@@ -90,6 +91,9 @@ public:<br>
                        Mangler &Mang, const TargetMachine &TM) const<br>
       LLVM_OVERRIDE;<br>
<br>
+  bool isSectionAtomizableBySymbols(const MCSection &Section) const<br>
+      LLVM_OVERRIDE;<br>
+<br>
   const MCSection *SelectSectionForGlobal(const GlobalValue *GV,<br>
                                           SectionKind Kind, Mangler &Mang,<br>
                                           const TargetMachine &TM) const<br>
@@ -105,18 +109,19 @@ public:<br>
   /// This hook allows targets to selectively decide not to emit the<br>
   /// UsedDirective for some symbols in llvm.used.<br>
   /// FIXME: REMOVE this (rdar://7071300)<br>
-  bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const<br>
-      LLVM_OVERRIDE;<br>
+  bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,<br>
+                                  TargetMachine &TM) const LLVM_OVERRIDE;<br>
<br>
   /// The mach-o version of this method defaults to returning a stub reference.<br>
-  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                        unsigned Encoding, Mangler &Mang,<br>
-                                        MachineModuleInfo *MMI,<br>
-                                        MCStreamer &Streamer) const<br>
+  const MCExpr *<br>
+  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                          Mangler &Mang, const TargetMachine &TM,<br>
+                          MachineModuleInfo *MMI, MCStreamer &Streamer) const<br>
       LLVM_OVERRIDE;<br>
<br>
   // The symbol that gets passed to .cfi_personality.<br>
   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
+                                    const TargetMachine &TM,<br>
                                     MachineModuleInfo *MMI) const LLVM_OVERRIDE;<br>
 };<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/IR/Mangler.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Mangler.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Mangler.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/IR/Mangler.h (original)<br>
+++ llvm/trunk/include/llvm/IR/Mangler.h Tue Feb 18 16:24:57 2014<br>
@@ -51,9 +51,10 @@ public:<br>
   /// Print the appropriate prefix and the specified global variable's name.<br>
   /// If the global variable doesn't have a name, this fills in a unique name<br>
   /// for the global.<br>
-  void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const;<br>
-  void getNameWithPrefix(SmallVectorImpl<char> &OutName,<br>
-                         const GlobalValue *GV) const;<br>
+  void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,<br>
+                         bool CannotUsePrivateLabel) const;<br>
+  void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,<br>
+                         bool CannotUsePrivateLabel) const;<br>
<br>
   /// Print the appropriate prefix and the specified name as the global variable<br>
   /// name. GVName must not be empty.<br>
<br>
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)<br>
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Feb 18 16:24:57 2014<br>
@@ -48,8 +48,10 @@ namespace llvm {<br>
   class MachineFunction;<br>
   class MachineInstr;<br>
   class MachineJumpTableInfo;<br>
+  class Mangler;<br>
   class MCContext;<br>
   class MCExpr;<br>
+  class MCSymbol;<br>
   template<typename T> class SmallVectorImpl;<br>
   class DataLayout;<br>
   class TargetRegisterClass;<br>
@@ -1335,6 +1337,10 @@ public:<br>
     return LibcallCallingConvs[Call];<br>
   }<br>
<br>
+  void getNameWithPrefix(SmallVectorImpl<char> &Name, const GlobalValue *GV,<br>
+                         Mangler &Mang) const;<br>
+  MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const;<br>
+<br>
 private:<br>
   const TargetMachine &TM;<br>
   const DataLayout *DL;<br>
<br>
Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)<br>
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Feb 18 16:24:57 2014<br>
@@ -71,8 +71,8 @@ public:<br>
   /// This hook allows targets to selectively decide not to emit the<br>
   /// UsedDirective for some symbols in llvm.used.<br>
   /// FIXME: REMOVE this (rdar://7071300)<br>
-  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,<br>
-                                          Mangler &Mang) const {<br>
+  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,<br>
+                                          TargetMachine &TM) const {<br>
     return GV != 0;<br>
   }<br>
<br>
@@ -117,25 +117,22 @@ public:<br>
<br>
   /// Return an MCExpr to use for a reference to the specified global variable<br>
   /// from exception handling information.<br>
-  virtual const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                                unsigned Encoding,<br>
-                                                Mangler &Mang,<br>
-                                                MachineModuleInfo *MMI,<br>
-                                                MCStreamer &Streamer) const;<br>
-<br>
-  /// Return the MCSymbol for the specified global value. This symbol is the<br>
-  /// main label that is the address of the global<br>
-  MCSymbol *getSymbol(const GlobalValue *GV, Mangler &M) const;<br>
+  virtual const MCExpr *<br>
+  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                          Mangler &Mang, const TargetMachine &TM,<br>
+                          MachineModuleInfo *MMI, MCStreamer &Streamer) const;<br>
<br>
   /// Return the MCSymbol for a private symbol with global value name as its<br>
   /// base, with the specified suffix.<br>
   MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,<br>
-                                         StringRef Suffix, Mangler &M) const;<br>
+                                         StringRef Suffix, Mangler &Mang,<br>
+                                         const TargetMachine &TM) const;<br>
<br>
   // The symbol that gets passed to .cfi_personality.<br>
-  virtual MCSymbol *<br>
-  getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
-                          MachineModuleInfo *MMI) const;<br>
+  virtual MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,<br>
+                                            Mangler &Mang,<br>
+                                            const TargetMachine &TM,<br>
+                                            MachineModuleInfo *MMI) const;<br>
<br>
   const MCExpr *<br>
   getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,<br>
@@ -157,10 +154,17 @@ public:<br>
   virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;<br>
<br>
   virtual const MCExpr *<br>
-  getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang) const {<br>
+  getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang,<br>
+                              const TargetMachine &TM) const {<br>
     return 0;<br>
   }<br>
<br>
+  /// \brief True if the section is atomized using the symbols in it.<br>
+  /// This is false if the section is not atomized at all (most ELF sections) or<br>
+  /// if it is atomized based on its contents (MachO' __TEXT,__cstring for<br>
+  /// example).<br>
+  virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const;<br>
+<br>
 protected:<br>
   virtual const MCSection *<br>
   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 18 16:24:57 2014<br>
@@ -311,8 +311,13 @@ void AsmPrinter::EmitLinkage(const Globa<br>
   llvm_unreachable("Unknown linkage type!");<br>
 }<br>
<br>
+void AsmPrinter::getNameWithPrefix(SmallVectorImpl<char> &Name,<br>
+                                   const GlobalValue *GV) const {<br>
+  TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);<br>
+}<br>
+<br>
 MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {<br>
-  return getObjFileLowering().getSymbol(GV, *Mang);<br>
+  return TM.getTargetLowering()->getSymbol(GV, *Mang);<br>
 }<br>
<br>
 /// EmitGlobalVariable - Emit the specified global variable to the .s file.<br>
@@ -1369,7 +1374,7 @@ void AsmPrinter::EmitLLVMUsedList(const<br>
   for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {<br>
     const GlobalValue *GV =<br>
       dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());<br>
-    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang))<br>
+    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang, TM))<br>
       OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);<br>
   }<br>
 }<br>
@@ -1574,7 +1579,8 @@ static const MCExpr *lowerConstant(const<br>
   }<br>
<br>
   if (const MCExpr *RelocExpr =<br>
-          AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang))<br>
+          AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang,<br>
+                                                              <a href="http://AP.TM" target="_blank">AP.TM</a>))<br>
     return RelocExpr;<br>
<br>
   switch (CE->getOpcode()) {<br>
@@ -2103,7 +2109,8 @@ MCSymbol *AsmPrinter::GetJTSetSymbol(uns<br>
<br>
 MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,<br>
                                                    StringRef Suffix) const {<br>
-  return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang);<br>
+  return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang,<br>
+                                                           TM);<br>
 }<br>
<br>
 /// GetExternalSymbolSymbol - Return the MCSymbol for the specified<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Tue Feb 18 16:24:57 2014<br>
@@ -143,7 +143,7 @@ void AsmPrinter::EmitTTypeReference(cons<br>
     const TargetLoweringObjectFile &TLOF = getObjFileLowering();<br>
<br>
     const MCExpr *Exp =<br>
-        TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, MMI, OutStreamer);<br>
+        TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, TM, MMI, OutStreamer);<br>
     OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));<br>
   } else<br>
     OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Tue Feb 18 16:24:57 2014<br>
@@ -119,7 +119,8 @@ void DwarfCFIException::beginFunction(co<br>
   if (!shouldEmitPersonality)<br>
     return;<br>
<br>
-  const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);<br>
+  const MCSymbol *Sym =<br>
+      TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);<br>
   Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);<br>
<br>
   Asm->OutStreamer.EmitDebugLabel<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Tue Feb 18 16:24:57 2014<br>
@@ -101,7 +101,8 @@ void Win64Exception::endFunction(const M<br>
   if (shouldEmitPersonality) {<br>
     const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();<br>
     const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];<br>
-    const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);<br>
+    const MCSymbol *Sym =<br>
+        TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);<br>
<br>
     Asm->OutStreamer.PushSection();<br>
     Asm->OutStreamer.EmitWin64EHHandlerData();<br>
<br>
Modified: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp Tue Feb 18 16:24:57 2014<br>
@@ -24,7 +24,9 @@<br>
 #include "llvm/IR/DataLayout.h"<br>
 #include "llvm/IR/DerivedTypes.h"<br>
 #include "llvm/IR/GlobalVariable.h"<br>
+#include "llvm/IR/Mangler.h"<br>
 #include "llvm/MC/MCAsmInfo.h"<br>
+#include "llvm/MC/MCContext.h"<br>
 #include "llvm/MC/MCExpr.h"<br>
 #include "llvm/Support/CommandLine.h"<br>
 #include "llvm/Support/ErrorHandling.h"<br>
@@ -1426,3 +1428,29 @@ bool TargetLoweringBase::isLegalAddressi<br>
<br>
   return true;<br>
 }<br>
+<br>
+void TargetLoweringBase::getNameWithPrefix(SmallVectorImpl<char> &Name,<br>
+                                           const GlobalValue *GV,<br>
+                                           Mangler &Mang) const {<br>
+  if (!GV->hasPrivateLinkage()) {<br>
+    // Simple case: If GV is not private, it is not important to find out if<br>
+    // private labels are legal in this case or not.<br>
+    Mang.getNameWithPrefix(Name, GV, false);<br>
+    return;<br>
+  }<br>
+  SectionKind GVKind =<br>
+    TargetLoweringObjectFile::getKindForGlobal(GV, getTargetMachine());<br>
+  const TargetLoweringObjectFile &TLOF = getObjFileLowering();<br>
+  const MCSection *TheSection =<br>
+    TLOF.SectionForGlobal(GV, GVKind, Mang, getTargetMachine());<br>
+  bool CannotUsePrivateLabel = TLOF.isSectionAtomizableBySymbols(*TheSection);<br>
+  Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);<br>
+}<br>
+<br>
+MCSymbol *TargetLoweringBase::getSymbol(const GlobalValue *GV,<br>
+                                        Mangler &Mang) const {<br>
+  SmallString<60> NameStr;<br>
+  getNameWithPrefix(NameStr, GV, Mang);<br>
+  const TargetLoweringObjectFile &TLOF = getObjFileLowering();<br>
+  return TLOF.getContext().GetOrCreateSymbol(NameStr.str());<br>
+}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Tue Feb 18 16:24:57 2014<br>
@@ -36,6 +36,7 @@<br>
 #include "llvm/Support/ErrorHandling.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
 #include "llvm/Target/TargetMachine.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
 using namespace llvm;<br>
 using namespace dwarf;<br>
<br>
@@ -43,19 +44,18 @@ using namespace dwarf;<br>
 //                                  ELF<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-MCSymbol *<br>
-TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV,<br>
-                                                     Mangler &Mang,<br>
-                                                MachineModuleInfo *MMI) const {<br>
+MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(<br>
+    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,<br>
+    MachineModuleInfo *MMI) const {<br>
   unsigned Encoding = getPersonalityEncoding();<br>
   switch (Encoding & 0x70) {<br>
   default:<br>
     report_fatal_error("We do not support this DWARF encoding yet!");<br>
   case dwarf::DW_EH_PE_absptr:<br>
-    return getSymbol(GV, Mang);<br>
+    return TM.getTargetLowering()->getSymbol(GV, Mang);<br>
   case dwarf::DW_EH_PE_pcrel: {<br>
     return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +<br>
-                                          getSymbol(GV, Mang)->getName());<br>
+                        TM.getTargetLowering()->getSymbol(GV, Mang)->getName());<br>
   }<br>
   }<br>
 }<br>
@@ -89,18 +89,19 @@ void TargetLoweringObjectFileELF::emitPe<br>
<br>
 const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
<br>
   if (Encoding & dwarf::DW_EH_PE_indirect) {<br>
     MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();<br>
<br>
-    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);<br>
+    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);<br>
<br>
     // Add information about the stub reference to ELFMMI so that the stub<br>
     // gets emitted by the asmprinter.<br>
     MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);<br>
     if (StubSym.getPointer() == 0) {<br>
-      MCSymbol *Sym = getSymbol(GV, Mang);<br>
+      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());<br>
     }<br>
<br>
@@ -109,8 +110,8 @@ const MCExpr *TargetLoweringObjectFileEL<br>
                         Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);<br>
   }<br>
<br>
-  return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,<br>
-                                                           MMI, Streamer);<br>
+  return TargetLoweringObjectFile::<br>
+    getTTypeGlobalReference(GV, Encoding, Mang, TM, MMI, Streamer);<br>
 }<br>
<br>
 static SectionKind<br>
@@ -195,10 +196,9 @@ getELFSectionFlags(SectionKind K) {<br>
   return Flags;<br>
 }<br>
<br>
-<br>
-const MCSection *TargetLoweringObjectFileELF::<br>
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,<br>
-                         Mangler &Mang, const TargetMachine &TM) const {<br>
+const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(<br>
+    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,<br>
+    const TargetMachine &TM) const {<br>
   StringRef SectionName = GV->getSection();<br>
<br>
   // Infer section flags from the section name if we can.<br>
@@ -248,7 +248,7 @@ SelectSectionForGlobal(const GlobalValue<br>
     Prefix = getSectionPrefixForGlobal(Kind);<br>
<br>
     SmallString<128> Name(Prefix, Prefix+strlen(Prefix));<br>
-    MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     Name.append(Sym->getName().begin(), Sym->getName().end());<br>
     StringRef Group = "";<br>
     unsigned Flags = getELFSectionFlags(Kind);<br>
@@ -487,9 +487,9 @@ emitModuleFlags(MCStreamer &Streamer,<br>
   Streamer.AddBlankLine();<br>
 }<br>
<br>
-const MCSection *TargetLoweringObjectFileMachO::<br>
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,<br>
-                         Mangler &Mang, const TargetMachine &TM) const {<br>
+const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(<br>
+    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,<br>
+    const TargetMachine &TM) const {<br>
   // Parse the section specifier and create it if valid.<br>
   StringRef Segment, Section;<br>
   unsigned TAA = 0, StubSize = 0;<br>
@@ -526,6 +526,41 @@ getExplicitSectionGlobal(const GlobalVal<br>
   return S;<br>
 }<br>
<br>
+bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols(<br>
+    const MCSection &Section) const {<br>
+    const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section);<br>
+<br>
+    // Sections holding 1 byte strings are atomized based on the data<br>
+    // they contain.<br>
+    // Sections holding 2 byte strings require symbols in order to be<br>
+    // atomized.<br>
+    // There is no dedicated section for 4 byte strings.<br>
+    if (SMO.getKind().isMergeable1ByteCString())<br>
+      return false;<br>
+<br>
+    if (SMO.getSegmentName() == "__DATA" &&<br>
+        SMO.getSectionName() == "__cfstring")<br>
+      return false;<br>
+<br>
+    switch (SMO.getType()) {<br>
+    default:<br>
+      return true;<br>
+<br>
+      // These sections are atomized at the element boundaries without using<br>
+      // symbols.<br>
+    case MCSectionMachO::S_4BYTE_LITERALS:<br>
+    case MCSectionMachO::S_8BYTE_LITERALS:<br>
+    case MCSectionMachO::S_16BYTE_LITERALS:<br>
+    case MCSectionMachO::S_LITERAL_POINTERS:<br>
+    case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:<br>
+    case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:<br>
+    case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:<br>
+    case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:<br>
+    case MCSectionMachO::S_INTERPOSING:<br>
+      return false;<br>
+    }<br>
+}<br>
+<br>
 const MCSection *TargetLoweringObjectFileMachO::<br>
 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,<br>
                        Mangler &Mang, const TargetMachine &TM) const {<br>
@@ -606,21 +641,17 @@ TargetLoweringObjectFileMachO::getSectio<br>
   return ReadOnlySection;  // .const<br>
 }<br>
<br>
-/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide<br>
-/// not to emit the UsedDirective for some symbols in llvm.used.<br>
+/// This hook allows targets to selectively decide not to emit the UsedDirective<br>
+/// for some symbols in llvm.used.<br>
 // FIXME: REMOVE this (rdar://7071300)<br>
-bool TargetLoweringObjectFileMachO::<br>
-shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const {<br>
-  /// On Darwin, internally linked data beginning with "L" or "l" does not have<br>
-  /// the directive emitted (this occurs in ObjC metadata).<br>
-  if (!GV) return false;<br>
-<br>
+bool TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(<br>
+    const GlobalValue *GV, Mangler &Mang, TargetMachine &TM) const {<br>
   // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.<br>
   if (GV->hasLocalLinkage() && !isa<Function>(GV)) {<br>
     // FIXME: ObjC metadata is currently emitted as internal symbols that have<br>
     // \1L and \0l prefixes on them.  Fix them to be Private/LinkerPrivate and<br>
     // this horrible hack can go away.<br>
-    MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')<br>
       return false;<br>
   }<br>
@@ -630,14 +661,16 @@ shouldEmitUsedDirectiveFor(const GlobalV<br>
<br>
 const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
   // The mach-o version of this method defaults to returning a stub reference.<br>
<br>
   if (Encoding & DW_EH_PE_indirect) {<br>
     MachineModuleInfoMachO &MachOMMI =<br>
       MMI->getObjFileInfo<MachineModuleInfoMachO>();<br>
<br>
-    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);<br>
+    MCSymbol *SSym =<br>
+        getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);<br>
<br>
     // Add information about the stub reference to MachOMMI so that the stub<br>
     // gets emitted by the asmprinter.<br>
@@ -645,7 +678,7 @@ const MCExpr *TargetLoweringObjectFileMa<br>
       GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :<br>
                                   MachOMMI.getGVStubEntry(SSym);<br>
     if (StubSym.getPointer() == 0) {<br>
-      MCSymbol *Sym = getSymbol(GV, Mang);<br>
+      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());<br>
     }<br>
<br>
@@ -654,24 +687,24 @@ const MCExpr *TargetLoweringObjectFileMa<br>
                         Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);<br>
   }<br>
<br>
-  return TargetLoweringObjectFile::<br>
-    getTTypeGlobalReference(GV, Encoding, Mang, MMI, Streamer);<br>
+  return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,<br>
+                                                           TM, MMI, Streamer);<br>
 }<br>
<br>
-MCSymbol *TargetLoweringObjectFileMachO::<br>
-getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
-                        MachineModuleInfo *MMI) const {<br>
+MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol(<br>
+    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,<br>
+    MachineModuleInfo *MMI) const {<br>
   // The mach-o version of this method defaults to returning a stub reference.<br>
   MachineModuleInfoMachO &MachOMMI =<br>
     MMI->getObjFileInfo<MachineModuleInfoMachO>();<br>
<br>
-  MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);<br>
+  MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);<br>
<br>
   // Add information about the stub reference to MachOMMI so that the stub<br>
   // gets emitted by the asmprinter.<br>
   MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);<br>
   if (StubSym.getPointer() == 0) {<br>
-    MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());<br>
   }<br>
<br>
@@ -717,9 +750,9 @@ getCOFFSectionFlags(SectionKind K) {<br>
   return Flags;<br>
 }<br>
<br>
-const MCSection *TargetLoweringObjectFileCOFF::<br>
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,<br>
-                         Mangler &Mang, const TargetMachine &TM) const {<br>
+const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(<br>
+    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,<br>
+    const TargetMachine &TM) const {<br>
   int Selection = 0;<br>
   unsigned Characteristics = getCOFFSectionFlags(Kind);<br>
   StringRef Name = GV->getSection();<br>
@@ -727,7 +760,7 @@ getExplicitSectionGlobal(const GlobalVal<br>
   if (GV->isWeakForLinker()) {<br>
     Selection = COFF::IMAGE_COMDAT_SELECT_ANY;<br>
     Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;<br>
-    MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     COMDATSymName = Sym->getName();<br>
   }<br>
   return getContext().getCOFFSection(Name,<br>
@@ -761,7 +794,7 @@ SelectSectionForGlobal(const GlobalValue<br>
     unsigned Characteristics = getCOFFSectionFlags(Kind);<br>
<br>
     Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;<br>
-    MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     return getContext().getCOFFSection(Name, Characteristics,<br>
                                        Kind, Sym->getName(),<br>
                                        COFF::IMAGE_COMDAT_SELECT_ANY);<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Tue Feb 18 16:24:57 2014<br>
@@ -27,6 +27,7 @@<br>
 #include "llvm/Support/ErrorHandling.h"<br>
 #include "llvm/Support/MemoryBuffer.h"<br>
 #include "llvm/Support/MutexGuard.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
<br>
 using namespace llvm;<br>
<br>
@@ -371,7 +372,7 @@ void *MCJIT::getPointerToFunction(Functi<br>
   // load address of the symbol, not the local address.<br>
   Mangler Mang(TM->getDataLayout());<br>
   SmallString<128> Name;<br>
-  Mang.getNameWithPrefix(Name, F);<br>
+  TM->getTargetLowering()->getNameWithPrefix(Name, F, Mang);<br>
   return (void*)Dyld.getSymbolLoadAddress(Name);<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/lib/IR/Mangler.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/IR/Mangler.cpp (original)<br>
+++ llvm/trunk/lib/IR/Mangler.cpp Tue Feb 18 16:24:57 2014<br>
@@ -76,12 +76,18 @@ static void AddFastCallStdCallSuffix(raw<br>
   OS << '@' << ArgWords;<br>
 }<br>
<br>
-void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const {<br>
+void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,<br>
+                                bool CannotUsePrivateLabel) const {<br>
   ManglerPrefixTy PrefixTy = Mangler::Default;<br>
-  if (GV->hasPrivateLinkage())<br>
-    PrefixTy = Mangler::Private;<br>
-  else if (GV->hasLinkerPrivateLinkage() || GV->hasLinkerPrivateWeakLinkage())<br>
+  if (GV->hasPrivateLinkage()) {<br>
+    if (CannotUsePrivateLabel)<br>
+      PrefixTy = Mangler::LinkerPrivate;<br>
+    else<br>
+      PrefixTy = Mangler::Private;<br>
+  } else if (GV->hasLinkerPrivateLinkage() ||<br>
+             GV->hasLinkerPrivateWeakLinkage()) {<br>
     PrefixTy = Mangler::LinkerPrivate;<br>
+  }<br>
<br>
   if (!GV->hasName()) {<br>
     // Get the ID for the global, assigning a new one if we haven't got one<br>
@@ -134,7 +140,8 @@ void Mangler::getNameWithPrefix(raw_ostr<br>
 }<br>
<br>
 void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,<br>
-                                const GlobalValue *GV) const {<br>
+                                const GlobalValue *GV,<br>
+                                bool CannotUsePrivateLabel) const {<br>
   raw_svector_ostream OS(OutName);<br>
-  getNameWithPrefix(OS, GV);<br>
+  getNameWithPrefix(OS, GV, CannotUsePrivateLabel);<br>
 }<br>
<br>
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)<br>
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Tue Feb 18 16:24:57 2014<br>
@@ -336,7 +336,7 @@ applyRestriction(GlobalValue &GV,<br>
                  SmallPtrSet<GlobalValue*, 8> &AsmUsed,<br>
                  Mangler &Mangler) {<br>
   SmallString<64> Buffer;<br>
-  Mangler.getNameWithPrefix(Buffer, &GV);<br>
+  TargetMach->getTargetLowering()->getNameWithPrefix(Buffer, &GV, Mangler);<br>
<br>
   if (GV.isDeclaration())<br>
     return;<br>
<br>
Modified: llvm/trunk/lib/LTO/LTOModule.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/LTO/LTOModule.cpp (original)<br>
+++ llvm/trunk/lib/LTO/LTOModule.cpp Tue Feb 18 16:24:57 2014<br>
@@ -381,7 +381,7 @@ void LTOModule::addDefinedSymbol(const G<br>
<br>
   // string is owned by _defines<br>
   SmallString<64> Buffer;<br>
-  _mangler.getNameWithPrefix(Buffer, def);<br>
+  _target->getTargetLowering()->getNameWithPrefix(Buffer, def, _mangler);<br>
<br>
   // set alignment part log2() can have rounding errors<br>
   uint32_t align = def->getAlignment();<br>
@@ -517,7 +517,7 @@ LTOModule::addPotentialUndefinedSymbol(c<br>
     return;<br>
<br>
   SmallString<64> name;<br>
-  _mangler.getNameWithPrefix(name, decl);<br>
+  _target->getTargetLowering()->getNameWithPrefix(name, decl, _mangler);<br>
<br>
   StringMap<NameAndAttributes>::value_type &entry =<br>
     _undefines.GetOrCreateValue(name);<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp Tue Feb 18 16:24:57 2014<br>
@@ -16,7 +16,7 @@<br>
 #include "llvm/MC/MCSectionELF.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
 #include "llvm/Support/ELF.h"<br>
-#include "llvm/Target/TargetMachine.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
 using namespace llvm;<br>
 using namespace dwarf;<br>
<br>
@@ -43,12 +43,12 @@ void ARMElfTargetObjectFile::Initialize(<br>
<br>
 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
   assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");<br>
<br>
-  return MCSymbolRefExpr::Create(getSymbol(GV, Mang),<br>
-                                 MCSymbolRefExpr::VK_ARM_TARGET2,<br>
-                                 getContext());<br>
+  return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),<br>
+                                 MCSymbolRefExpr::VK_ARM_TARGET2, getContext());<br>
 }<br>
<br>
 const MCExpr *ARMElfTargetObjectFile::<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h Tue Feb 18 16:24:57 2014<br>
@@ -28,10 +28,10 @@ public:<br>
<br>
   void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE;<br>
<br>
-  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                        unsigned Encoding, Mangler &Mang,<br>
-                                        MachineModuleInfo *MMI,<br>
-                                        MCStreamer &Streamer) const<br>
+  const MCExpr *<br>
+  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                          Mangler &Mang, const TargetMachine &TM,<br>
+                          MachineModuleInfo *MMI, MCStreamer &Streamer) const<br>
       LLVM_OVERRIDE;<br>
<br>
   /// \brief Describe a TLS variable address within debug info.<br>
<br>
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)<br>
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Tue Feb 18 16:24:57 2014<br>
@@ -25,7 +25,8 @@<br>
 #include "llvm/MC/MCAsmInfo.h"<br>
 #include "llvm/MC/MCExpr.h"<br>
 #include "llvm/MC/MCInst.h"<br>
-#include "llvm/Target/TargetMachine.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
+#include "llvm/Target/TargetLoweringObjectFile.h"<br>
 using namespace llvm;<br>
<br>
 static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) {<br>
@@ -34,7 +35,9 @@ static MachineModuleInfoMachO &getMachOM<br>
<br>
<br>
 static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){<br>
-  const DataLayout *DL = AP.TM.getDataLayout();<br>
+  const TargetMachine &TM = <a href="http://AP.TM" target="_blank">AP.TM</a>;<br>
+  Mangler *Mang = AP.Mang;<br>
+  const DataLayout *DL = TM.getDataLayout();<br>
   MCContext &Ctx = AP.OutContext;<br>
<br>
   SmallString<128> Name;<br>
@@ -51,10 +54,10 @@ static MCSymbol *GetSymbolFromOperand(co<br>
<br>
   if (!MO.isGlobal()) {<br>
     assert(MO.isSymbol() && "Isn't a symbol reference");<br>
-    AP.Mang->getNameWithPrefix(Name, MO.getSymbolName());<br>
+    Mang->getNameWithPrefix(Name, MO.getSymbolName());<br>
   } else {<br>
     const GlobalValue *GV = MO.getGlobal();<br>
-    AP.Mang->getNameWithPrefix(Name, GV);<br>
+    TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);<br>
   }<br>
<br>
   unsigned OrigLen = Name.size() - PrefixLen;<br>
<br>
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp Tue Feb 18 16:24:57 2014<br>
@@ -11,23 +11,25 @@<br>
 #include "MCTargetDesc/SparcMCExpr.h"<br>
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
<br>
 using namespace llvm;<br>
<br>
 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
<br>
   if (Encoding & dwarf::DW_EH_PE_pcrel) {<br>
     MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();<br>
<br>
-    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);<br>
+    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);<br>
<br>
     // Add information about the stub reference to ELFMMI so that the stub<br>
     // gets emitted by the asmprinter.<br>
     MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);<br>
     if (StubSym.getPointer() == 0) {<br>
-      MCSymbol *Sym = getSymbol(GV, Mang);<br>
+      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());<br>
     }<br>
<br>
@@ -37,5 +39,5 @@ const MCExpr *SparcELFTargetObjectFile::<br>
   }<br>
<br>
   return TargetLoweringObjectFileELF::getTTypeGlobalReference(<br>
-      GV, Encoding, Mang, MMI, Streamer);<br>
+      GV, Encoding, Mang, TM, MMI, Streamer);<br>
 }<br>
<br>
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h (original)<br>
+++ llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.h Tue Feb 18 16:24:57 2014<br>
@@ -23,10 +23,10 @@ public:<br>
     TargetLoweringObjectFileELF()<br>
   {}<br>
<br>
-  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                        unsigned Encoding, Mangler &Mang,<br>
-                                        MachineModuleInfo *MMI,<br>
-                                        MCStreamer &Streamer) const<br>
+  const MCExpr *<br>
+  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                          Mangler &Mang, const TargetMachine &TM,<br>
+                          MachineModuleInfo *MMI, MCStreamer &Streamer) const<br>
       LLVM_OVERRIDE;<br>
 };<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Feb 18 16:24:57 2014<br>
@@ -28,6 +28,7 @@<br>
 #include "llvm/Support/ErrorHandling.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
 #include "llvm/Target/TargetMachine.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
 #include "llvm/Target/TargetOptions.h"<br>
 using namespace llvm;<br>
<br>
@@ -99,30 +100,22 @@ static bool IsNullTerminatedString(const<br>
   return false;<br>
 }<br>
<br>
-/// Return the MCSymbol for the specified global value.  This<br>
-/// symbol is the main label that is the address of the global.<br>
-MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,<br>
-                                              Mangler &M) const {<br>
-  SmallString<60> NameStr;<br>
-  M.getNameWithPrefix(NameStr, GV);<br>
-  return Ctx->GetOrCreateSymbol(NameStr.str());<br>
-}<br>
-<br>
 MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(<br>
-    const GlobalValue *GV, StringRef Suffix, Mangler &M) const {<br>
+    const GlobalValue *GV, StringRef Suffix, Mangler &Mang,<br>
+    const TargetMachine &TM) const {<br>
   assert(!Suffix.empty());<br>
<br>
   SmallString<60> NameStr;<br>
   NameStr += DL->getPrivateGlobalPrefix();<br>
-  M.getNameWithPrefix(NameStr, GV);<br>
+  TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang);<br>
   NameStr.append(Suffix.begin(), Suffix.end());<br>
   return Ctx->GetOrCreateSymbol(NameStr.str());<br>
 }<br>
<br>
-MCSymbol *TargetLoweringObjectFile::<br>
-getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
-                        MachineModuleInfo *MMI) const {<br>
-  return getSymbol(GV, Mang);<br>
+MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(<br>
+    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,<br>
+    MachineModuleInfo *MMI) const {<br>
+  return TM.getTargetLowering()->getSymbol(GV, Mang);<br>
 }<br>
<br>
 void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,<br>
@@ -275,6 +268,10 @@ SectionForGlobal(const GlobalValue *GV,<br>
   return SelectSectionForGlobal(GV, Kind, Mang, TM);<br>
 }<br>
<br>
+bool TargetLoweringObjectFile::isSectionAtomizableBySymbols(<br>
+    const MCSection &Section) const {<br>
+  return false;<br>
+}<br>
<br>
 // Lame default implementation. Calculate the section name for global.<br>
 const MCSection *<br>
@@ -312,9 +309,11 @@ TargetLoweringObjectFile::getSectionForC<br>
 /// handling information.<br>
 const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
   const MCSymbolRefExpr *Ref =<br>
-      MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());<br>
+    MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),<br>
+                            getContext());<br>
<br>
   return getTTypeReference(Ref, Encoding, Streamer);<br>
 }<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Tue Feb 18 16:24:57 2014<br>
@@ -98,7 +98,7 @@ GetSymbolFromOperand(const MachineOperan<br>
<br>
   if (MO.isGlobal()) {<br>
     const GlobalValue *GV = MO.getGlobal();<br>
-    getMang()->getNameWithPrefix(Name, GV);<br>
+    AsmPrinter.getNameWithPrefix(Name, GV);<br>
   } else if (MO.isSymbol()) {<br>
     getMang()->getNameWithPrefix(Name, MO.getSymbolName());<br>
   } else if (MO.isMBB()) {<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Tue Feb 18 16:24:57 2014<br>
@@ -14,18 +14,20 @@<br>
 #include "llvm/MC/MCExpr.h"<br>
 #include "llvm/MC/MCSectionELF.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
+#include "llvm/Target/TargetLowering.h"<br>
<br>
 using namespace llvm;<br>
 using namespace dwarf;<br>
<br>
 const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(<br>
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,<br>
-    MachineModuleInfo *MMI, MCStreamer &Streamer) const {<br>
+    const TargetMachine &TM, MachineModuleInfo *MMI,<br>
+    MCStreamer &Streamer) const {<br>
<br>
   // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which<br>
   // is an indirect pc-relative reference.<br>
   if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {<br>
-    const MCSymbol *Sym = getSymbol(GV, Mang);<br>
+    const MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);<br>
     const MCExpr *Res =<br>
       MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());<br>
     const MCExpr *Four = MCConstantExpr::Create(4, getContext());<br>
@@ -33,13 +35,13 @@ const MCExpr *X86_64MachoTargetObjectFil<br>
   }<br>
<br>
   return TargetLoweringObjectFileMachO::getTTypeGlobalReference(<br>
-      GV, Encoding, Mang, MMI, Streamer);<br>
+      GV, Encoding, Mang, TM, MMI, Streamer);<br>
 }<br>
<br>
-MCSymbol *X86_64MachoTargetObjectFile::<br>
-getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
-                        MachineModuleInfo *MMI) const {<br>
-  return getSymbol(GV, Mang);<br>
+MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol(<br>
+    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,<br>
+    MachineModuleInfo *MMI) const {<br>
+  return TM.getTargetLowering()->getSymbol(GV, Mang);<br>
 }<br>
<br>
 void<br>
@@ -54,9 +56,8 @@ X86LinuxTargetObjectFile::getDebugThread<br>
   return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());<br>
 }<br>
<br>
-const MCExpr *<br>
-X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE,<br>
-                                                        Mangler &Mang) const {<br>
+const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(<br>
+    const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const {<br>
   // We are looking for the difference of two symbols, need a subtraction<br>
   // operation.<br>
   const SubOperator *Sub = dyn_cast<SubOperator>(CE);<br>
@@ -101,6 +102,7 @@ X86WindowsTargetObjectFile::getExecutabl<br>
   if (GVLHS->isThreadLocal())<br>
     return 0;<br>
<br>
-  return MCSymbolRefExpr::Create(<br>
-      getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());<br>
+  return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GVLHS, Mang),<br>
+                                 MCSymbolRefExpr::VK_COFF_IMGREL32,<br>
+                                 getContext());<br>
 }<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original)<br>
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Tue Feb 18 16:24:57 2014<br>
@@ -20,15 +20,16 @@ namespace llvm {<br>
   /// x86-64.<br>
   class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {<br>
   public:<br>
-    const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,<br>
-                                          unsigned Encoding, Mangler &Mang,<br>
-                                          MachineModuleInfo *MMI,<br>
-                                          MCStreamer &Streamer) const<br>
+    const MCExpr *<br>
+    getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,<br>
+                            Mangler &Mang, const TargetMachine &TM,<br>
+                            MachineModuleInfo *MMI, MCStreamer &Streamer) const<br>
         LLVM_OVERRIDE;<br>
<br>
     // getCFIPersonalitySymbol - The symbol that gets passed to<br>
     // .cfi_personality.<br>
     MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,<br>
+                                      const TargetMachine &TM,<br>
                                       MachineModuleInfo *MMI) const<br>
         LLVM_OVERRIDE;<br>
   };<br>
@@ -46,7 +47,8 @@ namespace llvm {<br>
   /// \brief This implementation is used for Windows targets on x86 and x86-64.<br>
   class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {<br>
     const MCExpr *getExecutableRelativeSymbol(const ConstantExpr *CE,<br>
-                                              Mangler &Mang) const<br>
+                                              Mangler &Mang,<br>
+                                              const TargetMachine &TM) const<br>
         LLVM_OVERRIDE;<br>
   };<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Tue Feb 18 16:24:57 2014<br>
@@ -118,9 +118,10 @@ static unsigned getXCoreSectionFlags(Sec<br>
   return Flags;<br>
 }<br>
<br>
-const MCSection *XCoreTargetObjectFile::<br>
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,<br>
-                         Mangler &Mang, const TargetMachine &TM) const {<br>
+const MCSection *<br>
+XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,<br>
+                                                SectionKind Kind, Mangler &Mang,<br>
+                                                const TargetMachine &TM) const {<br>
   StringRef SectionName = GV->getSection();<br>
   // Infer section flags from the section name if we can.<br>
   bool IsCPRel = SectionName.startswith(".cp.");<br>
<br>
Modified: llvm/trunk/test/CodeGen/PowerPC/private.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/private.ll?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/private.ll?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/test/CodeGen/PowerPC/private.ll (original)<br>
+++ llvm/trunk/test/CodeGen/PowerPC/private.ll Tue Feb 18 16:24:57 2014<br>
@@ -7,22 +7,22 @@<br>
 ; RUN: FileCheck --check-prefix=OSX %s<br>
<br>
 ; LINUX: .Lfoo:<br>
-; OSX: L_foo:<br>
+; OSX: l_foo:<br>
 define private void @foo() nounwind {<br>
         ret void<br>
 }<br>
<br>
 define i32 @bar() nounwind {<br>
 ; LINUX: bl{{.*}}.Lfoo<br>
-; OSX: bl{{.*}}L_foo<br>
+; OSX: bl{{.*}}l_foo<br>
         call void @foo()<br>
<br>
 ; LINUX: lis{{.*}}.Lbaz<br>
-; OSX:  lis{{.*}}L_baz<br>
+; OSX:  lis{{.*}}l_baz<br>
        %1 = load i32* @baz, align 4<br>
         ret i32 %1<br>
 }<br>
<br>
 ; LINUX: .Lbaz:<br>
-; OSX: L_baz:<br>
+; OSX: l_baz:<br>
 @baz = private global i32 4<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll Tue Feb 18 16:24:57 2014<br>
@@ -1,7 +1,7 @@<br>
 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s<br>
 ; rdar://7396984<br>
<br>
-@str = private constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1<br>
+@str = private unnamed_addr constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1<br>
<br>
 define void @t(i32 %count) ssp nounwind {<br>
 entry:<br>
<br>
Added: llvm/trunk/test/CodeGen/X86/osx-private-labels.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/osx-private-labels.ll?rev=201608&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/osx-private-labels.ll?rev=201608&view=auto</a><br>

==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/osx-private-labels.ll (added)<br>
+++ llvm/trunk/test/CodeGen/X86/osx-private-labels.ll Tue Feb 18 16:24:57 2014<br>
@@ -0,0 +1,71 @@<br>
+; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s<br>
+; Test all the cases where a L label is safe. Removing any entry from<br>
+; TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols should cause<br>
+; this to fail.<br>
+; We also test some noteworthy cases that require an l label.<br>
+<br>
+@private1 = private unnamed_addr constant [4 x i8] c"zed\00"<br>
+; CHECK: .section      __TEXT,__cstring,cstring_literals<br>
+; CHECK-NEXT: L_private1:<br>
+<br>
+@private2 = private unnamed_addr constant [5 x i16] [i16 116, i16 101,<br>
+                                                     i16 115, i16 116, i16 0]<br>
+; CHECK: .section      __TEXT,__ustring<br>
+; CHECK-NEXT: .align   1<br>
+; CHECK-NEXT: l_private2:<br>
+<br>
+; There is no dedicated 4 byte strings on MachO.<br>
+<br>
+%struct.NSConstantString = type { i32*, i32, i8*, i32 }<br>
+@private3 = private constant %struct.NSConstantString { i32* null, i32 1992, i8* null, i32 0 }, section "__DATA,__cfstring"<br>
+; CHECK: .section      __DATA,__cfstring<br>
+; CHECK-NEXT: .align   4<br>
+; CHECK-NEXT: L_private3:<br>
+<br>
+; There is no dedicated 1 or 2 byte constant section on MachO.<br>
+<br>
+@private4 = private unnamed_addr constant i32 42<br>
+; CHECK: .section      __TEXT,__literal4,4byte_literals<br>
+; CHECK-NEXT: .align   2<br>
+; CHECK-NEXT: L_private4:<br>
+<br>
+@private5 = private unnamed_addr constant i64 42<br>
+; CHECK: .section      __TEXT,__literal8,8byte_literals<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private5:<br>
+<br>
+@private6 = private unnamed_addr constant i128 42<br>
+; CHECK: .section      __TEXT,__literal16,16byte_literals<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private6:<br>
+<br>
+%struct._objc_class = type { i8* }<br>
+@private7 = private global %struct._objc_class* null, section "__OBJC,__cls_refs,literal_pointers,no_dead_strip"<br>
+; CHECK: .section      __OBJC,__cls_refs,literal_pointers,no_dead_strip<br>
+; CHECK: .align        3<br>
+; CHECK: L_private7:<br>
+<br>
+@private8 = private global i32* null, section "__DATA,__nl_symbol_ptr,non_lazy_symbol_pointers"<br>
+; CHECK: .section      __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private8:<br>
+<br>
+@private9 = private global i32* null, section "__DATA,__la_symbol_ptr,lazy_symbol_pointers"<br>
+; CHECK: .section      __DATA,__la_symbol_ptr,lazy_symbol_pointers<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private9:<br>
+<br>
+@private10 = private global i32* null, section "__DATA,__mod_init_func,mod_init_funcs"<br>
+; CHECK: .section      __DATA,__mod_init_func,mod_init_funcs<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private10:<br>
+<br>
+@private11 = private global i32* null, section "__DATA,__mod_term_func,mod_term_funcs"<br>
+; CHECK: .section      __DATA,__mod_term_func,mod_term_funcs<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private11:<br>
+<br>
+@private12 = private global i32* null, section "__DATA,__foobar,interposing"<br>
+; CHECK: .section      __DATA,__foobar,interposing<br>
+; CHECK-NEXT: .align   3<br>
+; CHECK-NEXT: L_private12:<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/pr10420.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr10420.ll?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr10420.ll?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/pr10420.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/pr10420.ll Tue Feb 18 16:24:57 2014<br>
@@ -14,7 +14,7 @@ define void @bar() {<br>
        ret void;<br>
 }<br>
<br>
-; CHECK: L_foo:                                   ## @foo<br>
+; CHECK: l_foo:                                   ## @foo<br>
 ; CHECK-NEXT: Ltmp0:<br>
<br>
 ; CHECK: _bar:                                   ## @bar<br>
@@ -34,7 +34,7 @@ define void @bar() {<br>
 ; CHECK-NEXT: {{.quad|.long}}   Ltmp[[NUM2]]<br>
<br>
<br>
-; OLD: L_foo:                                   ## @foo<br>
+; OLD: l_foo:                                   ## @foo<br>
 ; OLD-NEXT: Ltmp0:<br>
<br>
 ; OLD: _bar:                                   ## @bar<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/private-2.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/private-2.ll?rev=201608&r1=201607&r2=201608&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/private-2.ll?rev=201608&r1=201607&r2=201608&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/private-2.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/private-2.ll Tue Feb 18 16:24:57 2014<br>
@@ -2,7 +2,7 @@<br>
 ; Quote should be outside of private prefix.<br>
 ; rdar://6855766x<br>
<br>
-; CHECK: L__ZZ20<br>
+; CHECK: "l__ZZ20-[Example1 whatever]E4C.91"<br>
<br>
        %struct.A = type { i32*, i32 }<br>
 @"_ZZ20-[Example1 whatever]E4C.91" = private constant %struct.A { i32* null, i32 1 }           ; <%struct.A*> [#uses=1]<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>