[lld] r202322 - [PECOFF] Add a test for /SAFESEH:NO for non-x86 machine type.
Rui Ueyama
ruiu at google.com
Wed Feb 26 16:05:43 PST 2014
Author: ruiu
Date: Wed Feb 26 18:05:43 2014
New Revision: 202322
URL: http://llvm.org/viewvc/llvm-project?rev=202322&view=rev
Log:
[PECOFF] Add a test for /SAFESEH:NO for non-x86 machine type.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/test/pecoff/safeseh.test
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=202322&r1=202321&r2=202322&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Wed Feb 26 18:05:43 2014
@@ -67,6 +67,7 @@ bool PECOFFLinkingContext::validateImpl(
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(
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) {
Modified: lld/trunk/test/pecoff/safeseh.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/safeseh.test?rev=202322&r1=202321&r2=202322&view=diff
==============================================================================
--- lld/trunk/test/pecoff/safeseh.test (original)
+++ lld/trunk/test/pecoff/safeseh.test Wed Feb 26 18:05:43 2014
@@ -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.
More information about the llvm-commits
mailing list