Revert "Merge .xdata into .rdata by default"

This reverts commit r318699, it is breaking 32-bit SEH handlers in
Chromium.

llvm-svn: 319508
This commit is contained in:
Reid Kleckner 2017-12-01 01:04:31 +00:00
parent 1a468481c0
commit 3e89b08303
3 changed files with 28 additions and 27 deletions

View File

@ -969,10 +969,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
for (auto *Arg : Args.filtered(OPT_merge))
parseMerge(Arg->getValue());
// Add default section merging rules after user rules. User rules take
// precedence, but we will emit a warning if there is a conflict.
parseMerge(".xdata=.rdata");
// Handle /section
for (auto *Arg : Args.filtered(OPT_section))
parseSection(Arg->getValue());

View File

@ -1,23 +1,13 @@
# 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 --check-prefix=RDATA
# RUN: llvm-readobj -sections %t.dll | FileCheck %s
# There shouldn't be much xdata, because all three .pdata entries (12 bytes
# each) should use the same .xdata unwind info.
# XDATA: Name: .pdata
# XDATA-NEXT: VirtualSize: 0x24
# XDATA: Name: .xdata
# XDATA-NEXT: VirtualSize: 0x8
#
# WARN: warning: .xdata=.rdata: already merged into .xdata
#
# RDATA: Name: .pdata
# RDATA-NEXT: VirtualSize: 0x24
# RDATA: Name: .rdata
# RDATA-NEXT: VirtualSize: 0x8
# CHECK: Name: .pdata
# CHECK-NEXT: VirtualSize: 0x24
# CHECK: Name: .xdata
# CHECK-NEXT: VirtualSize: 0x8
.text
callee:

View File

@ -201,7 +201,7 @@ RAW-NEXT: .pdata name
RAW-NEXT: virtual size
RAW-NEXT: 1000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 200 file pointer to raw data
RAW-NEXT: 400 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
@ -214,7 +214,7 @@ RAW-NEXT: .text name
RAW-NEXT: virtual size
RAW-NEXT: 2000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 400 file pointer to raw data
RAW-NEXT: 600 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
@ -224,11 +224,24 @@ RAW-NEXT: IMAGE_SCN_CNT_CODE
RAW-NEXT: IMAGE_SCN_MEM_EXECUTE
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: SECTION HEADER #3
RAW-NEXT: .rdata name
RAW-NEXT: .xdata name
RAW-NEXT: virtual size
RAW-NEXT: 3000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 600 file pointer to raw data
RAW-NEXT: 800 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: SECTION HEADER #4
RAW-NEXT: .rdata name
RAW-NEXT: 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
@ -236,7 +249,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-NOT: SECTION HEADER
RAW: Original Section Headers
RAW-NEXT: ============================================================
RAW-NEXT: PDB does not contain the requested image section header type
@ -250,11 +262,11 @@ RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.text] | mod = 1, 0002:0016, size = 6, data crc = 2139436471, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 0, 0003:0000, size = 8, data crc = 264583633, reloc crc = 0
RAW-NEXT: SC[.xdata] | mod = 0, 0003:0000, size = 8, data crc = 264583633, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 2, 0003:0008, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: SC[???] | mod = 2, 0004:0000, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 2, 0003:0036, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: SC[???] | mod = 2, 0004:0028, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NOT: SC[
RAW: Section Map
@ -270,4 +282,7 @@ 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 =
RAW-NEXT: flags = 32 bit addr | absolute addr