fix PR4584 with a trivial patch now that the pieces are in place.
authorChris Lattner <sabre@nondot.org>
Wed, 29 Jul 2009 05:20:33 +0000 (05:20 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 29 Jul 2009 05:20:33 +0000 (05:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77434 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetLoweringObjectFile.cpp
test/CodeGen/X86/global-sections.ll

index 4f07f9036a8ed5fdfd2889386c13540d649fa0bc..e0b294173f0cbc1c67756b009670bf3798ec83f2 100644 (file)
@@ -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 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
   // 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;
index ddfb3523910638901d5a14f3438870c951427ce8..18a585a9836bb18d1cd9b8939570e41e7b0cb63e 100644 (file)
 ; DARWIN: _G5:
 ; DARWIN:    .long 47
 
+
+; PR4584
+@"foo bar" = linkonce global i32 42
+
+; LINUX: .type foo_20_bar,@object
+; LINUX:.section       .gnu.linkonce.d.foo_20_bar,"aw",@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":