diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp --- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp @@ -159,16 +159,17 @@ bool COFFAsmParser::ParseSectionFlags(StringRef SectionName, StringRef FlagsString, unsigned *Flags) { enum { - None = 0, - Alloc = 1 << 0, - Code = 1 << 1, - Load = 1 << 2, - InitData = 1 << 3, - Shared = 1 << 4, - NoLoad = 1 << 5, - NoRead = 1 << 6, - NoWrite = 1 << 7, + None = 0, + Alloc = 1 << 0, + Code = 1 << 1, + Load = 1 << 2, + InitData = 1 << 3, + Shared = 1 << 4, + NoLoad = 1 << 5, + NoRead = 1 << 6, + NoWrite = 1 << 7, Discardable = 1 << 8, + Info = 1 << 9, }; bool ReadOnlyRemoved = false; @@ -238,6 +239,10 @@ SecFlags |= NoRead | NoWrite; break; + case 'i': // info + SecFlags |= Info; + break; + default: return TokError("unknown flag"); } @@ -265,6 +270,8 @@ *Flags |= COFF::IMAGE_SCN_MEM_WRITE; if (SecFlags & Shared) *Flags |= COFF::IMAGE_SCN_MEM_SHARED; + if (SecFlags & Info) + *Flags |= COFF::IMAGE_SCN_LNK_INFO; return false; } diff --git a/llvm/lib/MC/MCSectionCOFF.cpp b/llvm/lib/MC/MCSectionCOFF.cpp --- a/llvm/lib/MC/MCSectionCOFF.cpp +++ b/llvm/lib/MC/MCSectionCOFF.cpp @@ -63,6 +63,8 @@ if ((getCharacteristics() & COFF::IMAGE_SCN_MEM_DISCARDABLE) && !isImplicitlyDiscardable(getName())) OS << 'D'; + if (getCharacteristics() & COFF::IMAGE_SCN_LNK_INFO) + OS << 'i'; OS << '"'; if (getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT) { diff --git a/llvm/test/CodeGen/ARM/global-merge-dllexport.ll b/llvm/test/CodeGen/ARM/global-merge-dllexport.ll --- a/llvm/test/CodeGen/ARM/global-merge-dllexport.ll +++ b/llvm/test/CodeGen/ARM/global-merge-dllexport.ll @@ -13,7 +13,7 @@ } ; CHECK: .lcomm .L_MergedGlobals,8,4 -; CHECK: .section .drectve,"yn" +; CHECK: .section .drectve,"yni" ; CHECK: .ascii " /EXPORT:y,DATA" ; CHECK: .globl x ; CHECK: .set x, .L_MergedGlobals diff --git a/llvm/test/MC/COFF/linker-options.ll b/llvm/test/MC/COFF/linker-options.ll --- a/llvm/test/MC/COFF/linker-options.ll +++ b/llvm/test/MC/COFF/linker-options.ll @@ -10,7 +10,7 @@ ret void } -; CHECK: .section .drectve,"yn" +; CHECK: .section .drectve,"yni" ; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib" ; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib" ; CHECK: .ascii " /DEFAULTLIB:secur32.lib" diff --git a/llvm/test/MC/COFF/section.s b/llvm/test/MC/COFF/section.s --- a/llvm/test/MC/COFF/section.s +++ b/llvm/test/MC/COFF/section.s @@ -37,6 +37,7 @@ .section s_w,"w"; .long 1 .section s_x,"x"; .long 1 .section s_y,"y"; .long 1 +.section s_i,"i"; .long 1 // CHECK: Section { // CHECK: Name: s @@ -143,6 +144,15 @@ // CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES // CHECK-NEXT: ] // CHECK: } +// CHECK: Section { +// CHECK: Name: s_i +// CHECK: Characteristics [ +// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES +// CHECK-NEXT: IMAGE_SCN_LNK_INFO +// CHECK-NEXT: IMAGE_SCN_MEM_READ +// CHECK-NEXT: IMAGE_SCN_MEM_WRITE +// CHECK-NEXT: ] +// CHECK: } // w makes read-only to readable .section s_rw,"rw"; .long 1