2018-06-06 21:56:51 +08:00
|
|
|
# REQUIRES: x86
|
2015-07-08 09:45:29 +08:00
|
|
|
# RUN: yaml2obj < %s > %t.obj
|
[COFF] Implement /safeseh:no and check @feat.00 flags by default
Summary:
Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and
defined __safe_se_handler_table & size. Now, /safeseh:no leaves those
undefined.
Additionally, we were checking for the safeseh @feat.00 flag in two
places: once to emit errors, and once during safeseh table construction.
The error was set up to be off by default, but safeseh is supposed to be
on by default. I combined the two checks, so now LLD emits an error if
an input object lacks @feat.00 and safeseh is enabled. This caused the
majority of 32-bit LLD tests to fail, since many test input object files
lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to
preserve behavior.
Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any
input file wasn't compiled for safeseh.
Reviewers: mstorsjo, ruiu, thakis
Reviewed By: ruiu, thakis
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63570
llvm-svn: 366238
2019-07-17 02:17:33 +08:00
|
|
|
# RUN: lld-link -safeseh:no /out:%t.exe /entry:main /base:0x400000 %t.obj
|
2015-07-08 09:45:29 +08:00
|
|
|
# RUN: llvm-objdump -d %t.exe | FileCheck %s
|
|
|
|
|
|
|
|
# CHECK: .text:
|
2015-07-30 00:30:45 +08:00
|
|
|
# CHECK: 1000: a1 00 00 00 00
|
|
|
|
# CHECK: 1005: a1 03 20 40 00
|
|
|
|
# CHECK: 100a: a1 03 20 00 00
|
|
|
|
# CHECK: 100f: a1 ef 0f 00 00
|
|
|
|
# CHECK: 1014: a1 00 00 02 00
|
|
|
|
# CHECK: 1019: a1 03 00 00 00
|
2015-07-08 09:45:29 +08:00
|
|
|
|
2016-06-28 04:17:08 +08:00
|
|
|
--- !COFF
|
2015-07-08 09:45:29 +08:00
|
|
|
header:
|
|
|
|
Machine: IMAGE_FILE_MACHINE_I386
|
|
|
|
Characteristics: []
|
|
|
|
sections:
|
|
|
|
- Name: .text
|
|
|
|
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
|
|
Alignment: 4096
|
|
|
|
SectionData: A100000000A100000000A100000000A100000000A100000000A100000000
|
|
|
|
Relocations:
|
|
|
|
- VirtualAddress: 1
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_ABSOLUTE
|
|
|
|
- VirtualAddress: 6
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_DIR32
|
|
|
|
- VirtualAddress: 11
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_DIR32NB
|
|
|
|
- VirtualAddress: 16
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_REL32
|
|
|
|
- VirtualAddress: 23
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_SECTION
|
|
|
|
- VirtualAddress: 26
|
2015-07-30 00:30:45 +08:00
|
|
|
SymbolName: _foo
|
2015-07-08 09:45:29 +08:00
|
|
|
Type: IMAGE_REL_I386_SECREL
|
2015-07-30 00:30:45 +08:00
|
|
|
- Name: .zzz
|
|
|
|
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
|
|
|
|
Alignment: 4096
|
|
|
|
SectionData: 0000000000000000
|
2015-07-08 09:45:29 +08:00
|
|
|
symbols:
|
|
|
|
- Name: .text
|
|
|
|
Value: 0
|
|
|
|
SectionNumber: 1
|
|
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
|
|
SectionDefinition:
|
|
|
|
Length: 6
|
|
|
|
NumberOfRelocations: 0
|
|
|
|
NumberOfLinenumbers: 0
|
|
|
|
CheckSum: 0
|
|
|
|
Number: 0
|
2015-07-30 00:30:45 +08:00
|
|
|
- Name: .zzz
|
|
|
|
Value: 0
|
|
|
|
SectionNumber: 2
|
|
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
|
|
SectionDefinition:
|
|
|
|
Length: 8
|
|
|
|
NumberOfRelocations: 0
|
|
|
|
NumberOfLinenumbers: 0
|
|
|
|
CheckSum: 0
|
|
|
|
Number: 0
|
2015-07-10 03:54:13 +08:00
|
|
|
- Name: _main
|
2015-07-08 09:45:29 +08:00
|
|
|
Value: 0
|
|
|
|
SectionNumber: 1
|
|
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
2015-07-30 00:30:45 +08:00
|
|
|
- Name: _foo
|
|
|
|
Value: 3
|
|
|
|
SectionNumber: 2
|
|
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
2015-07-08 09:45:29 +08:00
|
|
|
...
|