2015-07-09 09:25:49 +08:00
|
|
|
# RUN: yaml2obj < %p/Inputs/hello32.yaml > %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 \
|
2017-04-07 07:07:53 +08:00
|
|
|
# RUN: /entry:main@0 /out:%t.exe /appcontainer
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=HEADER %s
|
|
|
|
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
|
|
|
|
# RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
|
2015-07-09 09:25:49 +08:00
|
|
|
|
|
|
|
HEADER: Format: COFF-i386
|
|
|
|
HEADER-NEXT: Arch: i386
|
|
|
|
HEADER-NEXT: AddressSize: 32bit
|
|
|
|
HEADER-NEXT: ImageFileHeader {
|
|
|
|
HEADER-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
|
2015-07-10 04:36:59 +08:00
|
|
|
HEADER-NEXT: SectionCount: 4
|
2018-03-09 03:33:47 +08:00
|
|
|
HEADER-NEXT: TimeDateStamp:
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: PointerToSymbolTable: 0x0
|
|
|
|
HEADER-NEXT: SymbolCount: 0
|
2020-05-07 06:36:18 +08:00
|
|
|
HEADER-NEXT: StringTableSize: 0
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: OptionalHeaderSize: 224
|
|
|
|
HEADER-NEXT: Characteristics [ (0x102)
|
|
|
|
HEADER-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100)
|
|
|
|
HEADER-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
|
|
|
|
HEADER-NEXT: ]
|
|
|
|
HEADER-NEXT: }
|
|
|
|
HEADER-NEXT: ImageOptionalHeader {
|
2017-06-30 15:02:59 +08:00
|
|
|
HEADER-NEXT: Magic: 0x10B
|
2017-06-22 00:42:08 +08:00
|
|
|
HEADER-NEXT: MajorLinkerVersion: 14
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: MinorLinkerVersion: 0
|
|
|
|
HEADER-NEXT: SizeOfCode: 512
|
2015-07-10 04:36:59 +08:00
|
|
|
HEADER-NEXT: SizeOfInitializedData: 1536
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: SizeOfUninitializedData: 0
|
2018-04-05 03:15:55 +08:00
|
|
|
HEADER-NEXT: AddressOfEntryPoint: 0x1000
|
|
|
|
HEADER-NEXT: BaseOfCode: 0x1000
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: BaseOfData: 0x0
|
2015-07-26 05:42:33 +08:00
|
|
|
HEADER-NEXT: ImageBase: 0x400000
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: SectionAlignment: 4096
|
|
|
|
HEADER-NEXT: FileAlignment: 512
|
|
|
|
HEADER-NEXT: MajorOperatingSystemVersion: 6
|
|
|
|
HEADER-NEXT: MinorOperatingSystemVersion: 0
|
|
|
|
HEADER-NEXT: MajorImageVersion: 0
|
|
|
|
HEADER-NEXT: MinorImageVersion: 0
|
|
|
|
HEADER-NEXT: MajorSubsystemVersion: 6
|
|
|
|
HEADER-NEXT: MinorSubsystemVersion: 0
|
2017-10-26 07:00:40 +08:00
|
|
|
HEADER-NEXT: SizeOfImage: 20480
|
2018-03-08 22:27:28 +08:00
|
|
|
HEADER-NEXT: SizeOfHeaders: 1024
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
|
[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
|
|
|
HEADER-NEXT: Characteristics [ (0x9140)
|
2017-04-07 07:07:53 +08:00
|
|
|
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_APPCONTAINER (0x1000)
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
|
|
|
|
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
|
|
|
|
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
|
|
|
|
HEADER-NEXT: ]
|
|
|
|
HEADER-NEXT: SizeOfStackReserve: 1048576
|
|
|
|
HEADER-NEXT: SizeOfStackCommit: 4096
|
|
|
|
HEADER-NEXT: SizeOfHeapReserve: 1048576
|
|
|
|
HEADER-NEXT: SizeOfHeapCommit: 4096
|
|
|
|
HEADER-NEXT: NumberOfRvaAndSize: 16
|
|
|
|
HEADER-NEXT: DataDirectory {
|
|
|
|
HEADER-NEXT: ExportTableRVA: 0x0
|
|
|
|
HEADER-NEXT: ExportTableSize: 0x0
|
2018-04-18 07:28:52 +08:00
|
|
|
HEADER-NEXT: ImportTableRVA: 0x2000
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: ImportTableSize: 0x28
|
|
|
|
HEADER-NEXT: ResourceTableRVA: 0x0
|
|
|
|
HEADER-NEXT: ResourceTableSize: 0x0
|
|
|
|
HEADER-NEXT: ExceptionTableRVA: 0x0
|
|
|
|
HEADER-NEXT: ExceptionTableSize: 0x0
|
|
|
|
HEADER-NEXT: CertificateTableRVA: 0x0
|
|
|
|
HEADER-NEXT: CertificateTableSize: 0x0
|
2015-07-10 04:36:59 +08:00
|
|
|
HEADER-NEXT: BaseRelocationTableRVA: 0x4000
|
2015-07-15 08:25:38 +08:00
|
|
|
HEADER-NEXT: BaseRelocationTableSize: 0x10
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: DebugRVA: 0x0
|
|
|
|
HEADER-NEXT: DebugSize: 0x0
|
|
|
|
HEADER-NEXT: ArchitectureRVA: 0x0
|
|
|
|
HEADER-NEXT: ArchitectureSize: 0x0
|
|
|
|
HEADER-NEXT: GlobalPtrRVA: 0x0
|
|
|
|
HEADER-NEXT: GlobalPtrSize: 0x0
|
|
|
|
HEADER-NEXT: TLSTableRVA: 0x0
|
|
|
|
HEADER-NEXT: TLSTableSize: 0x0
|
|
|
|
HEADER-NEXT: LoadConfigTableRVA: 0x0
|
|
|
|
HEADER-NEXT: LoadConfigTableSize: 0x0
|
|
|
|
HEADER-NEXT: BoundImportRVA: 0x0
|
|
|
|
HEADER-NEXT: BoundImportSize: 0x0
|
2018-04-18 07:28:52 +08:00
|
|
|
HEADER-NEXT: IATRVA: 0x2034
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: IATSize: 0xC
|
|
|
|
HEADER-NEXT: DelayImportDescriptorRVA: 0x0
|
|
|
|
HEADER-NEXT: DelayImportDescriptorSize: 0x0
|
|
|
|
HEADER-NEXT: CLRRuntimeHeaderRVA: 0x0
|
|
|
|
HEADER-NEXT: CLRRuntimeHeaderSize: 0x0
|
|
|
|
HEADER-NEXT: ReservedRVA: 0x0
|
|
|
|
HEADER-NEXT: ReservedSize: 0x0
|
|
|
|
HEADER-NEXT: }
|
|
|
|
HEADER-NEXT: }
|
|
|
|
HEADER-NEXT: DOSHeader {
|
|
|
|
HEADER-NEXT: Magic: MZ
|
2018-03-08 22:27:28 +08:00
|
|
|
HEADER-NEXT: UsedBytesInTheLastPage: 120
|
|
|
|
HEADER-NEXT: FileSizeInPages: 1
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: NumberOfRelocationItems: 0
|
2018-03-08 22:27:28 +08:00
|
|
|
HEADER-NEXT: HeaderSizeInParagraphs: 4
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: MinimumExtraParagraphs: 0
|
|
|
|
HEADER-NEXT: MaximumExtraParagraphs: 0
|
|
|
|
HEADER-NEXT: InitialRelativeSS: 0
|
|
|
|
HEADER-NEXT: InitialSP: 0
|
|
|
|
HEADER-NEXT: Checksum: 0
|
|
|
|
HEADER-NEXT: InitialIP: 0
|
|
|
|
HEADER-NEXT: InitialRelativeCS: 0
|
|
|
|
HEADER-NEXT: AddressOfRelocationTable: 64
|
|
|
|
HEADER-NEXT: OverlayNumber: 0
|
|
|
|
HEADER-NEXT: OEMid: 0
|
|
|
|
HEADER-NEXT: OEMinfo: 0
|
2018-03-08 22:27:28 +08:00
|
|
|
HEADER-NEXT: AddressOfNewExeHeader: 120
|
2015-07-09 09:25:49 +08:00
|
|
|
HEADER-NEXT: }
|
|
|
|
|
|
|
|
IMPORTS: Format: COFF-i386
|
|
|
|
IMPORTS: Arch: i386
|
|
|
|
IMPORTS: AddressSize: 32bit
|
|
|
|
IMPORTS: Import {
|
|
|
|
IMPORTS: Name: std32.dll
|
2018-04-18 07:28:52 +08:00
|
|
|
IMPORTS: ImportLookupTableRVA: 0x2028
|
|
|
|
IMPORTS: ImportAddressTableRVA: 0x2034
|
2015-07-09 09:25:49 +08:00
|
|
|
IMPORTS: Symbol: ExitProcess (0)
|
|
|
|
IMPORTS: Symbol: MessageBoxA (1)
|
|
|
|
IMPORTS: }
|
2015-07-10 04:36:59 +08:00
|
|
|
|
|
|
|
BASEREL: BaseReloc [
|
|
|
|
BASEREL: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL: Address: 0x1005
|
2015-07-10 04:36:59 +08:00
|
|
|
BASEREL: }
|
|
|
|
BASEREL: Entry {
|
2015-07-25 07:24:45 +08:00
|
|
|
BASEREL: Type: HIGHLOW
|
2018-04-05 03:15:55 +08:00
|
|
|
BASEREL: Address: 0x100C
|
2015-07-10 04:36:59 +08:00
|
|
|
BASEREL: }
|
|
|
|
BASEREL: ]
|