summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/TargetAsmInfo.cpp5
-rw-r--r--test/CodeGen/X86/global-sections.ll8
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 3edbe93e56..727c584e3a 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -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
index 0000000000..0b4ed3b360
--- /dev/null
+++ b/test/CodeGen/X86/global-sections.ll
@@ -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
+