COFF: Merge .xdata into .rdata by default.

Differential Revision: https://reviews.llvm.org/D45804

llvm-svn: 330484
This commit is contained in:
Peter Collingbourne 2018-04-20 21:32:37 +00:00
parent 326f419335
commit 3d636edc56
4 changed files with 25 additions and 28 deletions

View File

@ -1109,6 +1109,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
parseMerge(".idata=.rdata");
parseMerge(".didat=.rdata");
parseMerge(".edata=.rdata");
parseMerge(".xdata=.rdata");
parseMerge(".bss=.data");
// Handle /section

View File

@ -1,13 +1,25 @@
# RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj
# RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata 2>&1 \
# RUN: | FileCheck %s --check-prefix=WARN
# RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=XDATA
# RUN: lld-link %t.obj -dll -noentry -out:%t.dll
# RUN: llvm-readobj -sections %t.dll | FileCheck %s
# RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=RDATA
# There shouldn't be much xdata, because all three .pdata entries (12 bytes
# each) should use the same .xdata unwind info.
# CHECK: Name: .pdata
# CHECK-NEXT: VirtualSize: 0x24
# CHECK: Name: .xdata
# CHECK-NEXT: VirtualSize: 0x8
# XDATA: Name: .rdata
# XDATA-NEXT: VirtualSize: 0x73
# XDATA: Name: .pdata
# XDATA-NEXT: VirtualSize: 0x24
# XDATA: Name: .xdata
# XDATA-NEXT: VirtualSize: 0x8
#
# WARN: warning: .xdata=.rdata: already merged into .xdata
#
# RDATA: Name: .rdata
# RDATA-NEXT: VirtualSize: 0x7C
# RDATA: Name: .pdata
# RDATA-NEXT: VirtualSize: 0x24
.text
callee:

View File

@ -245,19 +245,6 @@ RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: SECTION HEADER #4
RAW-NEXT: .xdata name
RAW-NEXT: 8 virtual size
RAW-NEXT: 4000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: A00 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: Original Section Headers
RAW-NEXT: ============================================================
RAW-NEXT: PDB does not contain the requested image section header type
@ -274,9 +261,9 @@ RAW-NEXT: SC[.rdata] | mod = 2, 0002:0000, size = {{[0-9]+}}, data crc = 0, r
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.rdata] | mod = 2, 0002:0028, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.pdata] | mod = 0, 0003:0000, size = 12, data crc = 361370162, reloc crc = 0
RAW-NEXT: SC[.rdata] | mod = 0, 0002:0148, size = {{[0-9]+}}, data crc = 264583633, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.xdata] | mod = 0, 0004:0000, size = {{[0-9]+}}, data crc = 264583633, reloc crc = 0
RAW-NEXT: SC[.pdata] | mod = 0, 0003:0000, size = 12, data crc = 361370162, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NOT: SC[
RAW: Section Map
@ -292,8 +279,5 @@ RAW-NEXT: Section 0002 | ovl = 0, group = 0, frame = 3, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0003 | ovl = 0, group = 0, frame = 4, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0004 | ovl = 0, group = 0, frame = 5, name = 65535
RAW-NEXT: class = 65535, offset = 0, size = 4294967295
RAW-NEXT: flags = 32 bit addr | absolute addr

View File

@ -15,13 +15,13 @@
# HEADER-MERGE: ExceptionTableRVA: 0x2004
# HEADER-MERGE-NEXT: ExceptionTableSize: 0x30
# HEADER-MERGE: Name: .rdata
# HEADER-MERGE-NEXT: VirtualSize: 0x34
# HEADER-MERGE-NEXT: VirtualSize: 0x78
# HEADER-MERGE-NEXT: VirtualAddress: 0x2000
#
# UNWIND: Function Table:
# UNWIND: Start Address: 0x1000
# UNWIND: End Address: 0x101b
# UNWIND: Unwind Info Address: 0x4000
# UNWIND: Unwind Info Address: 0x2004
# UNWIND: Version: 1
# UNWIND: Flags: 1 UNW_ExceptionHandler
# UNWIND: Size of prolog: 18
@ -38,7 +38,7 @@
# UNWIND: Function Table:
# UNWIND: Start Address: 0x1012
# UNWIND: End Address: 0x1012
# UNWIND: Unwind Info Address: 0x401c
# UNWIND: Unwind Info Address: 0x2020
# UNWIND: Version: 1
# UNWIND: Flags: 4 UNW_ChainInfo
# UNWIND: Size of prolog: 0
@ -47,7 +47,7 @@
# UNWIND: Function Table:
# UNWIND: Start Address: 0x101b
# UNWIND: End Address: 0x101c
# UNWIND: Unwind Info Address: 0x402c
# UNWIND: Unwind Info Address: 0x2030
# UNWIND: Version: 1
# UNWIND: Flags: 0
# UNWIND: Size of prolog: 0
@ -56,7 +56,7 @@
# UNWIND: Function Table:
# UNWIND: Start Address: 0x101c
# UNWIND: End Address: 0x1039
# UNWIND: Unwind Info Address: 0x4034
# UNWIND: Unwind Info Address: 0x2038
# UNWIND: Version: 1
# UNWIND: Flags: 0
# UNWIND: Size of prolog: 14