[lld] r243565 - COFF: Add /safeseh command line option.
Rui Ueyama
ruiu at google.com
Wed Jul 29 13:25:40 PDT 2015
Author: ruiu
Date: Wed Jul 29 15:25:40 2015
New Revision: 243565
URL: http://llvm.org/viewvc/llvm-project?rev=243565&view=rev
Log:
COFF: Add /safeseh command line option.
If /safeseh is specified, all input files must be compatible with Safe SEH.
Added:
lld/trunk/test/COFF/safeseh.test
Modified:
lld/trunk/COFF/Driver.cpp
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=243565&r1=243564&r2=243565&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Jul 29 15:25:40 2015
@@ -693,6 +693,17 @@ bool LinkerDriver::link(llvm::ArrayRef<c
}
}
+ // Handle /safeseh.
+ if (Args.hasArg(OPT_safeseh)) {
+ for (ObjectFile *File : Symtab.ObjectFiles) {
+ if (File->SEHCompat)
+ continue;
+ llvm::errs() << "/safeseh: " << File->getName()
+ << " is not compatible with SEH\n";
+ return false;
+ }
+ }
+
// Windows specific -- when we are creating a .dll file, we also
// need to create a .lib file.
if (!Config->Exports.empty()) {
Added: lld/trunk/test/COFF/safeseh.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/safeseh.test?rev=243565&view=auto
==============================================================================
--- lld/trunk/test/COFF/safeseh.test (added)
+++ lld/trunk/test/COFF/safeseh.test Wed Jul 29 15:25:40 2015
@@ -0,0 +1,51 @@
+# RUN: sed s/FEAT_VALUE/1/ %s | yaml2obj > %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /subsystem:console /entry:main /safeseh %t.obj
+
+# RUN: sed s/FEAT_VALUE/0/ %s | yaml2obj > %t.obj
+# RUN: not lld -flavor link2 /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
+
+---
+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
+...
More information about the llvm-commits
mailing list