Index: lld/COFF/Driver.cpp =================================================================== --- lld/COFF/Driver.cpp +++ lld/COFF/Driver.cpp @@ -1109,6 +1109,7 @@ parseMerge(".idata=.rdata"); parseMerge(".didat=.rdata"); parseMerge(".edata=.rdata"); + parseMerge(".bss=.data"); // Handle /section for (auto *Arg : Args.filtered(OPT_section)) Index: lld/test/COFF/common-alignment.test =================================================================== --- lld/test/COFF/common-alignment.test +++ lld/test/COFF/common-alignment.test @@ -23,10 +23,6 @@ - VirtualAddress: 6 SymbolName: bssdata4_align16 Type: IMAGE_REL_AMD64_ADDR32 - - Name: .data - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] - Alignment: 4 - SectionData: 03000000 - Name: .drectve Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] Alignment: 1 @@ -45,18 +41,6 @@ NumberOfLinenumbers: 0 CheckSum: 0 Number: 0 - - Name: .data - Value: 0 - SectionNumber: 2 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 4 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - Name: main Value: 0 SectionNumber: 1 Index: lld/test/COFF/common.test =================================================================== --- lld/test/COFF/common.test +++ lld/test/COFF/common.test @@ -35,10 +35,6 @@ - VirtualAddress: 21 SymbolName: bssdata16 Type: IMAGE_REL_AMD64_ADDR32 - - Name: .data - Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] - Alignment: 4 - SectionData: 03000000 symbols: - Name: .text Value: 0 @@ -52,18 +48,6 @@ NumberOfLinenumbers: 0 CheckSum: 0 Number: 0 - - Name: .data - Value: 0 - SectionNumber: 2 - SimpleType: IMAGE_SYM_TYPE_NULL - ComplexType: IMAGE_SYM_DTYPE_NULL - StorageClass: IMAGE_SYM_CLASS_STATIC - SectionDefinition: - Length: 4 - NumberOfRelocations: 0 - NumberOfLinenumbers: 0 - CheckSum: 0 - Number: 0 - Name: main Value: 0 SectionNumber: 1 Index: lld/test/COFF/pdb-globals.test =================================================================== --- lld/test/COFF/pdb-globals.test +++ lld/test/COFF/pdb-globals.test @@ -24,7 +24,7 @@ CHECK-NEXT: 312 | S_PROCREF [size = 40] `HelloPoint::HelloPoint` CHECK-NEXT: module = 1, sum name = 0, offset = 376 CHECK-NEXT: 232 | S_GDATA32 [size = 28] `__purecall` -CHECK-NEXT: type = 0x0403 (void*), addr = 0000:0000 +CHECK-NEXT: type = 0x0403 (void*), addr = 0003:0004 CHECK-NEXT: 260 | S_GDATA32 [size = 24] `GlobalVar` CHECK-NEXT: type = 0x100B (const int*), addr = 0003:0000 CHECK-NEXT: 284 | S_LDATA32 [size = 28] `ConstantVar` Index: lld/test/COFF/secrel-common.s =================================================================== --- lld/test/COFF/secrel-common.s +++ lld/test/COFF/secrel-common.s @@ -2,7 +2,7 @@ # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe # RUN: llvm-readobj %t.exe -sections -section-data | FileCheck %s -# Section relocations against common symbols resolve to .bss. +# Section relocations against common symbols resolve to .bss (merged into .data). # CHECK: Sections [ # CHECK: Section { @@ -15,16 +15,17 @@ # CHECK: } # CHECK: Section { # CHECK: Number: 2 -# CHECK: Name: .bss (2E 62 73 73 00 00 00 00) -# CHECK: VirtualSize: 0x4 -# CHECK: } -# CHECK: Section { -# CHECK: Number: 3 # CHECK: Name: .rdata (2E 72 64 61 74 61 00 00) # CHECK: SectionData ( -# CHECK: 0000: 00000000 02000000 |........| +# CHECK: 0000: 00020000 03000000 |........| # CHECK: ) # CHECK: } +# CHECK: Section { +# CHECK: Number: 3 +# CHECK: Name: .data (2E 64 61 74 61 00 00 00) +# CHECK: VirtualSize: 0x204 +# CHECK: RawDataSize: 512 +# CHECK: } # CHECK-NOT: Section # CHECK: ] @@ -39,3 +40,6 @@ .secrel32 common_global .secidx common_global .short 0 + +.section .data,"drw" +.zero 512 Index: lld/test/COFF/section-size.s =================================================================== --- lld/test/COFF/section-size.s +++ lld/test/COFF/section-size.s @@ -7,7 +7,7 @@ # Run: lld-link -entry:main %tmain.obj %t3.obj -out:%t.exe # RUN: not lld-link -entry:main %tmain.obj %t1.obj %t2.obj -out:%t.exe 2>&1 | FileCheck %s -# CHECK: error: section larger than 4 GiB: .bss +# CHECK: error: section larger than 4 GiB: .data .globl main main: