mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-10-09 04:14:11 +00:00
[PECOFF] Add a test for /SAFESEH:NO for non-x86 machine type.
llvm-svn: 202322
This commit is contained in:
parent
bc85ec702d
commit
1710fe7de9
@ -67,6 +67,7 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
|
||||
exports.insert(desc.ordinal);
|
||||
}
|
||||
|
||||
// Check for /align.
|
||||
std::bitset<64> alignment(_sectionDefaultAlignment);
|
||||
if (alignment.count() != 1) {
|
||||
diagnostics << "Section alignment must be a power of 2, but got "
|
||||
@ -74,6 +75,12 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// /safeseh is only valid for x86.
|
||||
if (getMachineType() != llvm::COFF::IMAGE_FILE_MACHINE_I386 && noSEH()) {
|
||||
diagnostics << "/SAFESEH:NO is only valid for x86.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Architectures other than x86/x64 is not supported yet.
|
||||
if (_machineType != llvm::COFF::IMAGE_FILE_MACHINE_I386 &&
|
||||
_machineType != llvm::COFF::IMAGE_FILE_MACHINE_AMD64) {
|
||||
|
@ -1,9 +1,16 @@
|
||||
# "hello.obj" does not have the symbol "@feat.00", so it's not
|
||||
# compatible with SEH.
|
||||
|
||||
# RUN: yaml2obj %p/Inputs/hello.obj.yaml > %t.obj
|
||||
# RUN: not lld -flavor link /safeseh /out:%t.exe /subsystem:console \
|
||||
# RUN: -- %t.obj 2> %t.err
|
||||
# RUN: FileCheck %s < %t.err
|
||||
# RUN: yaml2obj %p/Inputs/hello.obj.yaml > %t1.obj
|
||||
# RUN: not lld -flavor link /safeseh /out:%t1.exe /subsystem:console \
|
||||
# RUN: -- %t1.obj 2> %t1.err
|
||||
# RUN: FileCheck -check-prefix=INCOMPAT %s < %t1.err
|
||||
|
||||
CHECK: /SAFESEH is specified, but {{.*}} is not compatible with SEH.
|
||||
INCOMPAT: /SAFESEH is specified, but {{.*}} is not compatible with SEH.
|
||||
|
||||
# RUN: yaml2obj %p/Inputs/seh.obj.yaml > %t2.obj
|
||||
# RUN: not lld -flavor link /machine:x64 /safeseh:no /out:%t2.exe \
|
||||
# RUN: /subsystem:console -- %t2.obj 2> %t2.err
|
||||
# RUN: FileCheck -check-prefix=X64 %s < %t2.err
|
||||
|
||||
X64: /SAFESEH:NO is only valid for x86.
|
||||
|
Loading…
Reference in New Issue
Block a user