add the most expedient hack to fix PR4619, along with a testcase.
authorChris Lattner <sabre@nondot.org>
Sat, 25 Jul 2009 17:57:37 +0000 (17:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Jul 2009 17:57:37 +0000 (17:57 +0000)
Thanks to Rafael for the great example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77083 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetAsmInfo.cpp
test/CodeGen/X86/global-sections.ll [new file with mode: 0644]

index 3edbe93e561ffe07c5ce06bf3d706b10f7c30c2b..727c584e3a827d437039748e348b8e59e56bb220 100644 (file)
@@ -326,6 +326,11 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
 
       // FIXME: Use mangler interface (PR4584).
       std::string Name = Prefix+GV->getNameStr();
+      
+      // Pick up the flags for the uniquing section.
+      // FIXME: HACK.
+      Flags |= getFlagsForNamedSection(Name.c_str());
+
       return getNamedSection(Name.c_str(), Flags);
     }
   }
diff --git a/test/CodeGen/X86/global-sections.ll b/test/CodeGen/X86/global-sections.ll
new file mode 100644 (file)
index 0000000..0b4ed3b
--- /dev/null
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
+
+@G1 = common global i32 0
+
+; LINUX: .type   G1,@object
+; LINUX: .section .gnu.linkonce.b.G1,"aw",@nobits
+; LINUX: .comm  G1,4,4
+