[llvm-commits] [llvm] r77434 - in /llvm/trunk: lib/Target/TargetLoweringObjectFile.cpp test/CodeGen/X86/global-sections.ll

Chris Lattner sabre at nondot.org
Tue Jul 28 22:20:34 PDT 2009


Author: lattner
Date: Wed Jul 29 00:20:33 2009
New Revision: 77434

URL: http://llvm.org/viewvc/llvm-project?rev=77434&view=rev
Log:
fix PR4584 with a trivial patch now that the pieces are in place.


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

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77434&r1=77433&r2=77434&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jul 29 00:20:33 2009
@@ -16,6 +16,7 @@
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/GlobalVariable.h"
+#include "llvm/Support/Mangler.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetOptions.h"
@@ -407,9 +408,8 @@
   // into a 'uniqued' section name, create and return the section now.
   if (Kind.isWeak()) {
     const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
-    // FIXME: Use mangler interface (PR4584).
-    std::string Name = Prefix+GV->getNameStr();
-    return getOrCreateSection(Name.c_str(), false, Kind.getKind());
+    std::string Name = Mang->makeNameProper(GV->getNameStr());
+    return getOrCreateSection((Prefix+Name).c_str(), false, Kind.getKind());
   }
   
   if (Kind.isText()) return TextSection;

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=77434&r1=77433&r2=77434&view=diff

==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Wed Jul 29 00:20:33 2009
@@ -55,3 +55,16 @@
 ; DARWIN: _G5:
 ; DARWIN:    .long 47
 
+
+; PR4584
+@"foo bar" = linkonce global i32 42
+
+; LINUX: .type	foo_20_bar, at object
+; LINUX:.section	.gnu.linkonce.d.foo_20_bar,"aw", at progbits
+; LINUX: .weak	foo_20_bar
+; LINUX: foo_20_bar:
+
+; DARWIN: .section		__DATA,__datacoal_nt,coalesced
+; DARWIN: .globl	"_foo bar"
+; DARWIN:	.weak_definition "_foo bar"
+; DARWIN: "_foo bar":





More information about the llvm-commits mailing list