diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 166f1201781..a42911d92b9 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -340,7 +340,10 @@ getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { Str.push_back('x'); if (Kind.isWriteable()) Str.push_back('w'); - if (Kind.isMergeableConst() || Kind.isMergeableCString()) + if (Kind.isMergeableCString() || + Kind.isMergeableConst4() || + Kind.isMergeableConst8() || + Kind.isMergeableConst16()) Str.push_back('M'); if (Kind.isMergeableCString()) Str.push_back('S'); diff --git a/test/CodeGen/X86/global-sections.ll b/test/CodeGen/X86/global-sections.ll index 18a585a9836..a674a3ee97b 100644 --- a/test/CodeGen/X86/global-sections.ll +++ b/test/CodeGen/X86/global-sections.ll @@ -68,3 +68,20 @@ ; DARWIN: .globl "_foo bar" ; DARWIN: .weak_definition "_foo bar" ; DARWIN: "_foo bar": + +; PR4650 +@G6 = weak_odr constant [1 x i8] c"\01" + +; LINUX: .type G6,@object +; LINUX: .section .gnu.linkonce.r.G6,"a",@progbits +; LINUX: .weak G6 +; LINUX: G6: # G6 +; LINUX: .size G6, 1 +; LINUX: .ascii "\001" + +; DARWIN: .section __TEXT,__const_coal,coalesced +; DARWIN: .globl _G6 +; DARWIN: .weak_definition _G6 +; DARWIN:_G6: +; DARWIN: .ascii "\001" +