aboutsummaryrefslogtreecommitdiff
path: root/lld/MinGW
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-07-27 23:44:41 +0300
committerMartin Storsjö <martin@martin.st>2020-07-28 21:08:37 +0300
commit745eb02496b515cc8292dd7f9d7f0db43e162013 (patch)
treeb11726d9b328d99a19bfb53281db0bb9ff791bce /lld/MinGW
parent5608f28f552793d115a7f8682559ab053f961924 (diff)
downloadllvm-project-745eb02496b515cc8292dd7f9d7f0db43e162013.tar.gz
[LLD] [MinGW] Implement the --no-seh flag
Previously this flag was just ignored. If set, set the IMAGE_DLL_CHARACTERISTICS_NO_SEH bit, regardless of the normal safeSEH machinery. In mingw configurations, the safeSEH bit might not be set in e.g. object files built from handwritten assembly, making it impossible to use the normal safeseh flag. As mingw setups don't generally use SEH on 32 bit x86 at all, it should be fine to set that flag bit though - hook up the existing GNU ld flag for controlling that. Differential Revision: https://reviews.llvm.org/D84701
Diffstat (limited to 'lld/MinGW')
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/MinGW/Options.td2
2 files changed, 3 insertions, 1 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index f33b5e19502c..d60765c70c09 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -288,6 +288,8 @@ bool mingw::link(ArrayRef<const char *> argsArr, bool canExitEarly,
add("-kill-at");
if (args.hasArg(OPT_appcontainer))
add("-appcontainer");
+ if (args.hasArg(OPT_no_seh))
+ add("-noseh");
if (args.getLastArgValue(OPT_m) != "thumb2pe" &&
args.getLastArgValue(OPT_m) != "arm64pe" && !args.hasArg(OPT_dynamicbase))
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td
index 3281951dc89d..fe4416660050 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -56,6 +56,7 @@ defm minor_subsystem_version: EqLong<"minor-subsystem-version",
"Set the OS and subsystem minor version">;
def no_insert_timestamp: F<"no-insert-timestamp">,
HelpText<"Don't include PE header timestamp">;
+def no_seh: F<"no-seh">, HelpText<"Set the 'no SEH' flag in the executable">;
def no_whole_archive: F<"no-whole-archive">,
HelpText<"No longer include all object files for following archives">;
def large_address_aware: Flag<["--"], "large-address-aware">,
@@ -111,7 +112,6 @@ def: Flag<["--"], "full-shutdown">;
def: F<"high-entropy-va">;
def: S<"major-image-version">;
def: S<"minor-image-version">;
-def: F<"no-seh">;
def: F<"nxcompat">;
def: F<"pic-executable">;
def: S<"plugin">;