diff --git a/lld/test/COFF/lib-module-asm.ll b/lld/test/COFF/lib-module-asm.ll --- a/lld/test/COFF/lib-module-asm.ll +++ b/lld/test/COFF/lib-module-asm.ll @@ -17,6 +17,7 @@ ; CHECK-NEXT: global_asm_sym in {{.*}}lib-module-asm.ll.tmp.obj ; CHECK: lib-module-asm.ll.tmp.obj:{{$}} +; CHECK-NEXT: T @feat.00 ; CHECK-NEXT: T global_asm_sym ; CHECK-NEXT: t local_asm_sym ; CHECK-NEXT: U undef_asm_sym diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -21,6 +21,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" +#include "llvm/BinaryFormat/COFF.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/MC/MCAsmInfo.h" @@ -884,9 +885,36 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // Create the initial section, if requested. - if (!NoInitialTextSection) + if (!NoInitialTextSection) { Out.InitSections(false); + if (Ctx.getObjectFileInfo()->getObjectFileType() == + MCObjectFileInfo::IsCOFF) { + // Emit an absolute @feat.00 symbol. This appears to be some kind of + // compiler features bitfield read by link.exe. + MCSymbol *Feat00Sym = getContext().getOrCreateSymbol("@feat.00"); + getStreamer().BeginCOFFSymbolDef(Feat00Sym); + getStreamer().EmitCOFFSymbolStorageClass(COFF::IMAGE_SYM_CLASS_STATIC); + getStreamer().EmitCOFFSymbolType(COFF::IMAGE_SYM_DTYPE_NULL); + getStreamer().EndCOFFSymbolDef(); + int64_t Feat00Flags = 0; + + if (getContext().getObjectFileInfo()->getTargetTriple().getArch() == + Triple::x86) { + // According to the PE-COFF spec, the LSB of this value marks the object + // for "registered SEH". This means that all SEH handler entry points + // must be registered in .sxdata. Use of any unregistered handlers will + // cause the process to terminate immediately. LLVM does not know how + // to register any SEH handlers, so its object files should be safe. + Feat00Flags |= 1; + } + + getStreamer().EmitSymbolAttribute(Feat00Sym, MCSA_Global); + getStreamer().EmitAssignment( + Feat00Sym, MCConstantExpr::create(Feat00Flags, getContext())); + } + } + // Prime the lexer. Lex(); diff --git a/llvm/test/MC/COFF/addrsig.s b/llvm/test/MC/COFF/addrsig.s --- a/llvm/test/MC/COFF/addrsig.s +++ b/llvm/test/MC/COFF/addrsig.s @@ -14,7 +14,7 @@ // CHECK-NEXT: IMAGE_SCN_LNK_REMOVE (0x800) // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( -// CHECK-NEXT: 0000: 080A0B02 +// CHECK-NEXT: 0000: 090B0C02 // CHECK-NEXT: ) // CHECK: Symbols [ @@ -32,9 +32,9 @@ // CHECK: Name: local // CHECK: Addrsig [ -// CHECK-NEXT: Sym: g1 (8) -// CHECK-NEXT: Sym: g3 (10) -// CHECK-NEXT: Sym: local (11) +// CHECK-NEXT: Sym: g1 (9) +// CHECK-NEXT: Sym: g3 (11) +// CHECK-NEXT: Sym: local (12) // CHECK-NEXT: Sym: .data (2) // CHECK-NEXT: ] diff --git a/llvm/test/MC/COFF/assoc-private.s b/llvm/test/MC/COFF/assoc-private.s --- a/llvm/test/MC/COFF/assoc-private.s +++ b/llvm/test/MC/COFF/assoc-private.s @@ -13,7 +13,8 @@ # CHECK: AUX scnlen 0x4 nreloc 0 nlnno 0 checksum 0x0 assoc 4 comdat 0 # CHECK: [ 8](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .CRT$XCU # CHECK: AUX scnlen 0x8 nreloc 1 nlnno 0 checksum 0x0 assoc 4 comdat 5 -# CHECK: [10](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 register_x +# CHECK: [10](sec -1)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 @feat.00 +# CHECK: [11](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 register_x .section .rdata,"dr" .p2align 2 # @x diff --git a/llvm/test/MC/COFF/basic-coff-64.s b/llvm/test/MC/COFF/basic-coff-64.s --- a/llvm/test/MC/COFF/basic-coff-64.s +++ b/llvm/test/MC/COFF/basic-coff-64.s @@ -23,114 +23,164 @@ .L_.str: # @.str .asciz "Hello World" -// CHECK: ImageFileHeader { -// CHECK: Machine: IMAGE_FILE_MACHINE_AMD64 -// CHECK: SectionCount: 3 -// CHECK: TimeDateStamp: {{[0-9]+}} -// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} -// CHECK: SymbolCount: 8 -// CHECK: OptionalHeaderSize: 0 -// CHECK: Characteristics [ (0x0) -// CHECK: ] -// CHECK: } -// CHECK: Sections [ -// CHECK: Section { -// CHECK: Number: [[TextNum:[0-9]+]] -// CHECK: Name: .text -// CHECK: VirtualSize: 0 -// CHECK: VirtualAddress: 0 -// CHECK: RawDataSize: [[TextSize:[0-9]+]] -// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} -// CHECK: PointerToLineNumbers: 0x0 -// CHECK: RelocationCount: 2 -// CHECK: LineNumberCount: 0 -// CHECK: Characteristics [ (0x60500020) -// CHECK: IMAGE_SCN_ALIGN_16BYTES -// CHECK: IMAGE_SCN_CNT_CODE -// CHECK: IMAGE_SCN_MEM_EXECUTE -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: ] -// CHECK: Relocations [ -// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_ADDR32 .data -// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_REL32 _printf -// CHECK: ] -// CHECK: } -// CHECK: Section { -// CHECK: Number: [[DataNum:[0-9]+]] -// CHECK: Name: .data -// CHECK: VirtualSize: 0 -// CHECK: VirtualAddress: 0 -// CHECK: RawDataSize: [[DataSize:[0-9]+]] -// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations: 0x0 -// CHECK: PointerToLineNumbers: 0x0 -// CHECK: RelocationCount: 0 -// CHECK: LineNumberCount: 0 -// CHECK: Characteristics [ (0xC0300040) -// CHECK: IMAGE_SCN_ALIGN_4BYTES -// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: IMAGE_SCN_MEM_WRITE -// CHECK: ] -// CHECK: Relocations [ -// CHECK: ] -// CHECK: SectionData ( -// CHECK: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| -// CHECK: ) -// CHECK: } -// CHECK: ] -// CHECK: Symbols [ -// CHECK: Symbol { -// CHECK: Name: .text -// CHECK: Value: 0 -// CHECK: Section: .text -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: Static -// CHECK: AuxSymbolCount: 1 -// CHECK: AuxSectionDef { -// CHECK: Length: [[TextSize]] -// CHECK: RelocationCount: 2 -// CHECK: LineNumberCount: 0 -// CHECK: Checksum: 0x8E1B6D20 -// CHECK: Number: [[TextNum]] -// CHECK: Selection: 0x0 -// CHECK: } -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: .data -// CHECK: Value: 0 -// CHECK: Section: .data -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: Static -// CHECK: AuxSymbolCount: 1 -// CHECK: AuxSectionDef { -// CHECK: Length: [[DataSize]] -// CHECK: RelocationCount: 0 -// CHECK: LineNumberCount: 0 -// CHECK: Checksum: 0x2B95CA92 -// CHECK: Number: [[DataNum]] -// CHECK: Selection: 0x0 -// CHECK: } -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: _main -// CHECK: Value: 0 -// CHECK: Section: .text -// CHECK: BaseType: Null -// CHECK: ComplexType: Function -// CHECK: StorageClass: External -// CHECK: AuxSymbolCount: 0 -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: _printf -// CHECK: Value: 0 -// CHECK: Section: IMAGE_SYM_UNDEFINED (0) -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: External -// CHECK: AuxSymbolCount: 0 -// CHECK: } -// CHECK: ] +// CHECK: ImageFileHeader { +// CHECK-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 +// CHECK-NEXT: SectionCount: 3 +// CHECK-NEXT: TimeDateStamp: {{[0-9]+}} +// CHECK-NEXT: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK-NEXT: SymbolCount: 9 +// CHECK-NEXT: OptionalHeaderSize: 0 +// CHECK-NEXT: Characteristics [ (0x0) +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: Sections [ +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: [[TextNum:[0-9]+]] +// CHECK-NEXT: Name: .text +// CHECK-NEXT: VirtualSize: 0 +// CHECK-NEXT: VirtualAddress: 0 +// CHECK-NEXT: RawDataSize: [[TextSize:[0-9]+]] +// CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 2 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0x60500020) +// CHECK-NEXT: IMAGE_SCN_ALIGN_16BYTES +// CHECK-NEXT: IMAGE_SCN_CNT_CODE +// CHECK-NEXT: IMAGE_SCN_MEM_EXECUTE +// CHECK-NEXT: IMAGE_SCN_MEM_READ +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_ADDR32 .data +// CHECK-NEXT: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_REL32 _printf +// CHECK-NEXT: ] +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 83EC0467 C7042400 000000E8 00000000 |...g..$.........| +// CHECK-NEXT: 0010: 31C083C4 04C3 |1.....| +// CHECK-NEXT: ) +// CHECK-NEXT: } +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: [[DataNum:[0-9]+]] +// CHECK-NEXT: Name: .data +// CHECK-NEXT: VirtualSize: 0 +// CHECK-NEXT: VirtualAddress: 0 +// CHECK-NEXT: RawDataSize: [[DataSize:[0-9]+]] +// CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToRelocations: 0x0 +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0xC0300040) +// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES +// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK-NEXT: IMAGE_SCN_MEM_READ +// CHECK-NEXT: IMAGE_SCN_MEM_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: ] +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| +// CHECK-NEXT: ) +// CHECK-NEXT: } +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: 3 +// CHECK-NEXT: Name: .bss (2E 62 73 73 00 00 00 00) +// CHECK-NEXT: VirtualSize: 0x0 +// CHECK-NEXT: VirtualAddress: 0x0 +// CHECK-NEXT: RawDataSize: 0 +// CHECK-NEXT: PointerToRawData: 0x0 +// CHECK-NEXT: PointerToRelocations: 0x0 +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0xC0300080) +// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000) +// CHECK-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80) +// CHECK-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +// CHECK-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000) +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .text +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: Static +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: [[TextSize]] +// CHECK-NEXT: RelocationCount: 2 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0x8E1B6D20 +// CHECK-NEXT: Number: [[TextNum]] +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .data +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .data +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: Static +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: [[DataSize]] +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0x2B95CA92 +// CHECK-NEXT: Number: [[DataNum]] +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .bss +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .bss (3) +// CHECK-NEXT: BaseType: Null (0x0) +// CHECK-NEXT: ComplexType: Null (0x0) +// CHECK-NEXT: StorageClass: Static (0x3) +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: 0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0x0 +// CHECK-NEXT: Number: 3 +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: @feat.00 +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1) +// CHECK-NEXT: BaseType: Null (0x0) +// CHECK-NEXT: ComplexType: Null (0x0) +// CHECK-NEXT: StorageClass: Static (0x3) +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _main +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Function +// CHECK-NEXT: StorageClass: External +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _printf +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0) +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: External +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/llvm/test/MC/COFF/basic-coff.s b/llvm/test/MC/COFF/basic-coff.s --- a/llvm/test/MC/COFF/basic-coff.s +++ b/llvm/test/MC/COFF/basic-coff.s @@ -23,114 +23,164 @@ L_.str: # @.str .asciz "Hello World" -// CHECK: ImageFileHeader { -// CHECK: Machine: IMAGE_FILE_MACHINE_I386 -// CHECK: SectionCount: 3 -// CHECK: TimeDateStamp: {{[0-9]+}} -// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} -// CHECK: SymbolCount: 8 -// CHECK: OptionalHeaderSize: 0 -// CHECK: Characteristics [ (0x0) -// CHECK: ] -// CHECK: } -// CHECK: Sections [ -// CHECK: Section { -// CHECK: Number: [[TextNum:[0-9]+]] -// CHECK: Name: .text -// CHECK: VirtualSize: 0 -// CHECK: VirtualAddress: 0 -// CHECK: RawDataSize: {{[0-9]+}} -// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} -// CHECK: PointerToLineNumbers: 0x0 -// CHECK: RelocationCount: 2 -// CHECK: LineNumberCount: 0 -// CHECK: Characteristics [ (0x60500020) -// CHECK: IMAGE_SCN_ALIGN_16BYTES -// CHECK: IMAGE_SCN_CNT_CODE -// CHECK: IMAGE_SCN_MEM_EXECUTE -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: ] -// CHECK: Relocations [ -// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_DIR32 .data -// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_REL32 _printf -// CHECK: ] -// CHECK: } -// CHECK: Section { -// CHECK: Number: [[DataNum:[0-9]+]] -// CHECK: Name: .data -// CHECK: VirtualSize: 0 -// CHECK: VirtualAddress: 0 -// CHECK: RawDataSize: {{[0-9]+}} -// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations: 0x0 -// CHECK: PointerToLineNumbers: 0x0 -// CHECK: RelocationCount: 0 -// CHECK: LineNumberCount: 0 -// CHECK: Characteristics [ (0xC0300040) -// CHECK: IMAGE_SCN_ALIGN_4BYTES -// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: IMAGE_SCN_MEM_WRITE -// CHECK: ] -// CHECK: Relocations [ -// CHECK: ] -// CHECK: SectionData ( -// CHECK: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| -// CHECK: ) -// CHECK: } -// CHECK: ] -// CHECK: Symbols [ -// CHECK: Symbol { -// CHECK: Name: .text -// CHECK: Value: 0 -// CHECK: Section: .text -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: Static -// CHECK: AuxSymbolCount: 1 -// CHECK: AuxSectionDef { -// CHECK: Length: 21 -// CHECK: RelocationCount: 2 -// CHECK: LineNumberCount: 0 -// CHECK: Checksum: 0xC6461CBE -// CHECK: Number: 1 -// CHECK: Selection: 0x0 -// CHECK: } -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: .data -// CHECK: Value: 0 -// CHECK: Section: .data -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: Static -// CHECK: AuxSymbolCount: 1 -// CHECK: AuxSectionDef { -// CHECK: Length: 12 -// CHECK: RelocationCount: 0 -// CHECK: LineNumberCount: 0 -// CHECK: Checksum: 0x2B95CA92 -// CHECK: Number: 2 -// CHECK: Selection: 0x0 -// CHECK: } -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: _main -// CHECK: Value: 0 -// CHECK: Section: .text -// CHECK: BaseType: Null -// CHECK: ComplexType: Function -// CHECK: StorageClass: External -// CHECK: AuxSymbolCount: 0 -// CHECK: } -// CHECK: Symbol { -// CHECK: Name: _printf -// CHECK: Value: 0 -// CHECK: Section: IMAGE_SYM_UNDEFINED (0) -// CHECK: BaseType: Null -// CHECK: ComplexType: Null -// CHECK: StorageClass: External -// CHECK: AuxSymbolCount: 0 -// CHECK: } -// CHECK: ] +// CHECK: ImageFileHeader { +// CHECK-NEXT: Machine: IMAGE_FILE_MACHINE_I386 +// CHECK-NEXT: SectionCount: 3 +// CHECK-NEXT: TimeDateStamp: {{[0-9]+}} +// CHECK-NEXT: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK-NEXT: SymbolCount: 9 +// CHECK-NEXT: OptionalHeaderSize: 0 +// CHECK-NEXT: Characteristics [ (0x0) +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: Sections [ +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: [[TextNum:[0-9]+]] +// CHECK-NEXT: Name: .text +// CHECK-NEXT: VirtualSize: 0 +// CHECK-NEXT: VirtualAddress: 0 +// CHECK-NEXT: RawDataSize: {{[0-9]+}} +// CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 2 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0x60500020) +// CHECK-NEXT: IMAGE_SCN_ALIGN_16BYTES +// CHECK-NEXT: IMAGE_SCN_CNT_CODE +// CHECK-NEXT: IMAGE_SCN_MEM_EXECUTE +// CHECK-NEXT: IMAGE_SCN_MEM_READ +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x{{[0-9A-F]+}} IMAGE_REL_I386_DIR32 .data +// CHECK-NEXT: 0x{{[0-9A-F]+}} IMAGE_REL_I386_REL32 _printf +// CHECK-NEXT: ] +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 83EC04C7 04240000 0000E800 00000031 |.....$.........1| +// CHECK-NEXT: 0010: C083C404 C3 |.....| +// CHECK-NEXT: ) +// CHECK-NEXT: } +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: [[DataNum:[0-9]+]] +// CHECK-NEXT: Name: .data +// CHECK-NEXT: VirtualSize: 0 +// CHECK-NEXT: VirtualAddress: 0 +// CHECK-NEXT: RawDataSize: {{[0-9]+}} +// CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK-NEXT: PointerToRelocations: 0x0 +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0xC0300040) +// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES +// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK-NEXT: IMAGE_SCN_MEM_READ +// CHECK-NEXT: IMAGE_SCN_MEM_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: ] +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| +// CHECK-NEXT: ) +// CHECK-NEXT: } +// CHECK-NEXT: Section { +// CHECK-NEXT: Number: 3 +// CHECK-NEXT: Name: .bss (2E 62 73 73 00 00 00 00) +// CHECK-NEXT: VirtualSize: 0x0 +// CHECK-NEXT: VirtualAddress: 0x0 +// CHECK-NEXT: RawDataSize: 0 +// CHECK-NEXT: PointerToRawData: 0x0 +// CHECK-NEXT: PointerToRelocations: 0x0 +// CHECK-NEXT: PointerToLineNumbers: 0x0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ (0xC0300080) +// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000) +// CHECK-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80) +// CHECK-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +// CHECK-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000) +// CHECK-NEXT: ] +// CHECK-NEXT: Relocations [ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: Symbols [ +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .text +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: Static +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: 21 +// CHECK-NEXT: RelocationCount: 2 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0xC6461CBE +// CHECK-NEXT: Number: 1 +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .data +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .data +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: Static +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: 12 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0x2B95CA92 +// CHECK-NEXT: Number: 2 +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .bss +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .bss (3) +// CHECK-NEXT: BaseType: Null (0x0) +// CHECK-NEXT: ComplexType: Null (0x0) +// CHECK-NEXT: StorageClass: Static (0x3) +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxSectionDef { +// CHECK-NEXT: Length: 0 +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Checksum: 0x0 +// CHECK-NEXT: Number: 3 +// CHECK-NEXT: Selection: 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: @feat.00 +// CHECK-NEXT: Value: 1 +// CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1) +// CHECK-NEXT: BaseType: Null (0x0) +// CHECK-NEXT: ComplexType: Null (0x0) +// CHECK-NEXT: StorageClass: Static (0x3) +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _main +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Function +// CHECK-NEXT: StorageClass: External +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: _printf +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0) +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: External +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/llvm/test/MC/COFF/cross-section-relative.s b/llvm/test/MC/COFF/cross-section-relative.s --- a/llvm/test/MC/COFF/cross-section-relative.s +++ b/llvm/test/MC/COFF/cross-section-relative.s @@ -87,25 +87,25 @@ // READOBJ-NEXT: Offset: 0x0 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4) // READOBJ-NEXT: Symbol: g3 -// READOBJ-NEXT: SymbolIndex: 12 +// READOBJ-NEXT: SymbolIndex: 13 // READOBJ-NEXT: } // READOBJ-NEXT: Relocation { // READOBJ-NEXT: Offset: 0x4 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_ADDR32NB (3) // READOBJ-NEXT: Symbol: g3 -// READOBJ-NEXT: SymbolIndex: 12 +// READOBJ-NEXT: SymbolIndex: 13 // READOBJ-NEXT: } // READOBJ-NEXT: Relocation { // READOBJ-NEXT: Offset: 0x20 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4) // READOBJ-NEXT: Symbol: g3 -// READOBJ-NEXT: SymbolIndex: 12 +// READOBJ-NEXT: SymbolIndex: 13 // READOBJ-NEXT: } // READOBJ-NEXT: Relocation { // READOBJ-NEXT: Offset: 0x28 // READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4) // READOBJ-NEXT: Symbol: foobar -// READOBJ-NEXT: SymbolIndex: 20 +// READOBJ-NEXT: SymbolIndex: 21 // READOBJ-NEXT: } // READOBJ-NEXT: } // READOBJ-NEXT:] diff --git a/llvm/test/MC/COFF/feat00.s b/llvm/test/MC/COFF/feat00.s --- a/llvm/test/MC/COFF/feat00.s +++ b/llvm/test/MC/COFF/feat00.s @@ -9,6 +9,6 @@ // CHECK: Section: IMAGE_SYM_ABSOLUTE (-1) // CHECK: BaseType: Null (0x0) // CHECK: ComplexType: Null (0x0) -// CHECK: StorageClass: External (0x2) +// CHECK: StorageClass: External (0x3) // CHECK: AuxSymbolCount: 0 // CHECK: } diff --git a/llvm/test/MC/COFF/symbol-fragment-offset-64.s b/llvm/test/MC/COFF/symbol-fragment-offset-64.s --- a/llvm/test/MC/COFF/symbol-fragment-offset-64.s +++ b/llvm/test/MC/COFF/symbol-fragment-offset-64.s @@ -39,7 +39,7 @@ // CHECK: SectionCount: 3 // CHECK: TimeDateStamp: {{[0-9]+}} // CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} -// CHECK: SymbolCount: 9 +// CHECK: SymbolCount: 10 // CHECK: OptionalHeaderSize: 0 // CHECK: Characteristics [ (0x0) // CHECK: ] diff --git a/llvm/test/MC/COFF/symbol-fragment-offset.s b/llvm/test/MC/COFF/symbol-fragment-offset.s --- a/llvm/test/MC/COFF/symbol-fragment-offset.s +++ b/llvm/test/MC/COFF/symbol-fragment-offset.s @@ -39,7 +39,7 @@ // CHECK: SectionCount: 3 // CHECK: TimeDateStamp: {{[0-9]+}} // CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} -// CHECK: SymbolCount: 9 +// CHECK: SymbolCount: 10 // CHECK: OptionalHeaderSize: 0 // CHECK: Characteristics [ (0x0) // CHECK: ] diff --git a/llvm/test/MC/COFF/weak-alias-local.s b/llvm/test/MC/COFF/weak-alias-local.s --- a/llvm/test/MC/COFF/weak-alias-local.s +++ b/llvm/test/MC/COFF/weak-alias-local.s @@ -28,7 +28,7 @@ // CHECK-NEXT: StorageClass: WeakExternal (0x69) // CHECK-NEXT: AuxSymbolCount: 1 // CHECK-NEXT: AuxWeakExternal { -// CHECK-NEXT: Linked: .weak.a.default (9) +// CHECK-NEXT: Linked: .weak.a.default (10) // CHECK-NEXT: Search: Alias (0x3) // CHECK-NEXT: } // CHECK-NEXT: } diff --git a/llvm/test/MC/COFF/weak-val.s b/llvm/test/MC/COFF/weak-val.s --- a/llvm/test/MC/COFF/weak-val.s +++ b/llvm/test/MC/COFF/weak-val.s @@ -18,7 +18,7 @@ // CHECK-NEXT: StorageClass: WeakExternal (0x69) // CHECK-NEXT: AuxSymbolCount: 1 // CHECK-NEXT: AuxWeakExternal { -// CHECK-NEXT: Linked: .weak.b.default (8) +// CHECK-NEXT: Linked: .weak.b.default (9) // CHECK-NEXT: Search: Alias (0x3) // CHECK-NEXT: } // CHECK-NEXT: }