mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
502d4ce2e4
Summary: The main change is that we can have SECREL and SECTION relocations against ___safe_se_handler_table, which is important for handling the debug info in the MSVCRT. Previously we were using DefinedRelative for __safe_se_handler_table and __ImageBase, and after we implement CFGuard, we plan to extend it to handle __guard_fids_table, __guard_longjmp_table, and more. However, DefinedRelative is really only suitable for implementing __ImageBase, because it lacks a Chunk, which you need in order to figure out the output section index and output section offset when resolving SECREl and SECTION relocations. This change renames DefinedRelative to DefinedSynthetic and gives it a Chunk. One wart is that __ImageBase doesn't have a chunk. It points to the PE header, effectively. We could split DefinedRelative and DefinedSynthetic if we think that's cleaner and creates fewer special cases. I also added safeseh.s, which checks that we don't emit a safe seh table entries pointing to garbage collected handlers and that we don't emit a table at all when there are no handlers. Reviewers: ruiu Reviewed By: ruiu Subscribers: inglorion, pcc, llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D34577 llvm-svn: 306293
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
# RUN: sed s/FEAT_VALUE/1/ %s | yaml2obj > %t.obj
|
|
# RUN: lld-link /out:%t.exe /subsystem:console /entry:main /safeseh %t.obj
|
|
|
|
# RUN: sed s/FEAT_VALUE/0/ %s | yaml2obj > %t.obj
|
|
# RUN: not lld-link /out:%t.exe /subsystem:console /entry:main \
|
|
# RUN: /safeseh %t.obj >& %t.log
|
|
# RUN: FileCheck %s < %t.log
|
|
|
|
# CHECK: /safeseh: {{.*}} is not compatible with SEH
|
|
|
|
--- !COFF
|
|
header:
|
|
Machine: IMAGE_FILE_MACHINE_I386
|
|
Characteristics: [ ]
|
|
sections:
|
|
- Name: .text
|
|
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
|
|
Alignment: 1
|
|
SectionData: 0000000000000000
|
|
symbols:
|
|
- Name: '@comp.id'
|
|
Value: 14766605
|
|
SectionNumber: 65535
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
- Name: '@feat.00'
|
|
Value: FEAT_VALUE
|
|
SectionNumber: 65535
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
- Name: .text
|
|
Value: 0
|
|
SectionNumber: 1
|
|
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
|
|
- Name: _main
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
...
|