2017-07-19 02:40:50 +08:00
|
|
|
# REQUIRES: x86
|
2020-08-21 06:00:25 +08:00
|
|
|
# RUN: yaml2obj %p/Inputs/hello32.yaml -o %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 %t.obj %p/Inputs/std32.lib /subsystem:console \
|
2015-07-16 07:01:36 +08:00
|
|
|
# RUN: /entry:main@0 /alternatename:___delayLoadHelper2@8=_main@0 \
|
2018-04-18 07:28:52 +08:00
|
|
|
# RUN: /delayload:std32.dll /out:%t.exe
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
|
|
|
|
# RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
|
2020-03-16 08:47:44 +08:00
|
|
|
# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s
|
2015-07-14 06:31:45 +08:00
|
|
|
|
2015-07-16 07:01:36 +08:00
|
|
|
IMPORT: Format: COFF-i386
|
|
|
|
IMPORT-NEXT: Arch: i386
|
|
|
|
IMPORT-NEXT: AddressSize: 32bit
|
|
|
|
IMPORT-NEXT: DelayImport {
|
|
|
|
IMPORT-NEXT: Name: std32.dll
|
|
|
|
IMPORT-NEXT: Attributes: 0x1
|
2018-04-05 03:15:55 +08:00
|
|
|
IMPORT-NEXT: ModuleHandle: 0x3018
|
|
|
|
IMPORT-NEXT: ImportAddressTable: 0x3020
|
2018-04-18 07:28:52 +08:00
|
|
|
IMPORT-NEXT: ImportNameTable: 0x2040
|
2015-07-16 07:01:36 +08:00
|
|
|
IMPORT-NEXT: BoundDelayImportTable: 0x0
|
|
|
|
IMPORT-NEXT: UnloadDelayImportTable: 0x0
|
|
|
|
IMPORT-NEXT: Import {
|
|
|
|
IMPORT-NEXT: Symbol: ExitProcess (0)
|
2018-04-05 03:15:55 +08:00
|
|
|
IMPORT-NEXT: Address: 0x401029
|
2015-07-16 07:01:36 +08:00
|
|
|
IMPORT-NEXT: }
|
|
|
|
IMPORT-NEXT: Import {
|
|
|
|
IMPORT-NEXT: Symbol: MessageBoxA (0)
|
2019-07-12 05:19:11 +08:00
|
|
|
IMPORT-NEXT: Address: 0x401033
|
2015-07-16 07:01:36 +08:00
|
|
|
IMPORT-NEXT: }
|
|
|
|
IMPORT-NEXT: }
|
2015-07-16 06:26:57 +08:00
|
|
|
|
|
|
|
BASEREL: BaseReloc [
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x1005
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x100C
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x101F
|
2015-07-16 06:26:57 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x1025
|
2015-07-16 06:26:57 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2019-07-12 05:19:11 +08:00
|
|
|
BASEREL-NEXT: Address: 0x102A
|
2015-07-16 06:26:57 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2019-07-12 05:19:11 +08:00
|
|
|
BASEREL-NEXT: Address: 0x1034
|
2015-07-16 06:26:57 +08:00
|
|
|
BASEREL-NEXT: }
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x1041
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2019-07-12 05:19:11 +08:00
|
|
|
BASEREL-NEXT: Type: ABSOLUTE
|
|
|
|
BASEREL-NEXT: Address: 0x1000
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x3020
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
|
|
|
BASEREL-NEXT: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL-NEXT: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL-NEXT: Address: 0x3024
|
2015-07-16 07:01:36 +08:00
|
|
|
BASEREL-NEXT: }
|
2015-07-16 06:26:57 +08:00
|
|
|
BASEREL-NEXT: ]
|
2015-07-16 07:01:36 +08:00
|
|
|
|
2019-07-12 05:19:11 +08:00
|
|
|
DISASM: 1029: b8 20 30 40 00 movl $4206624, %eax
|
2020-03-23 06:03:10 +08:00
|
|
|
DISASM-NEXT: 102e: e9 0a 00 00 00 jmp 0x40103d <.text+0x3d>
|
2019-07-12 05:19:11 +08:00
|
|
|
DISASM-NEXT: 1033: b8 24 30 40 00 movl $4206628, %eax
|
2020-03-23 06:03:10 +08:00
|
|
|
DISASM-NEXT: 1038: e9 00 00 00 00 jmp 0x40103d <.text+0x3d>
|
2019-07-12 05:19:11 +08:00
|
|
|
DISASM-NEXT: 103d: 51 pushl %ecx
|
|
|
|
DISASM-NEXT: 103e: 52 pushl %edx
|
|
|
|
DISASM-NEXT: 103f: 50 pushl %eax
|
|
|
|
DISASM-NEXT: 1040: 68 00 20 40 00 pushl $4202496
|
2020-03-23 06:03:10 +08:00
|
|
|
DISASM-NEXT: 1045: e8 b6 ff ff ff calll 0x401000 <.text>
|
2019-07-12 05:19:11 +08:00
|
|
|
DISASM-NEXT: 104a: 5a popl %edx
|
|
|
|
DISASM-NEXT: 104b: 59 popl %ecx
|
|
|
|
DISASM-NEXT: 104c: ff e0 jmpl *%eax
|