Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -157,6 +157,8 @@
if (Args.hasArg(OPT_large_address_aware))
Add("-largeaddressaware");
+ Add(Args.hasArg(OPT_dynamicbase) ? "-dynamicbase" : "-dynamicbase:no");
+
if (auto *A = Args.getLastArg(OPT_m)) {
StringRef S = A->getValue();
if (S == "i386pe")
Index: lld/trunk/MinGW/Options.td
===================================================================
--- lld/trunk/MinGW/Options.td
+++ lld/trunk/MinGW/Options.td
@@ -6,6 +6,7 @@
def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"
">,
HelpText<"Add a directory to the library search path">;
+def dynamicbase: F<"dynamicbase">, HelpText<"Enable ASLR">;
def entry: S<"entry">, MetaVarName<"">,
HelpText<"Name of entry point symbol">;
def export_all_symbols: F<"export-all-symbols">,
@@ -45,9 +46,12 @@
def enable_auto_image_base: F<"enable-auto-image-base">;
def enable_auto_import: F<"enable-auto-import">;
def full_shutdown: Flag<["--"], "full-shutdown">;
+def high_entropy_va: F<"high-entropy-va">, HelpText<"Enable 64-bit ASLR">;
def major_image_version: S<"major-image-version">;
def minor_image_version: S<"minor-image-version">;
+def nxcompat: F<"nxcompat">, HelpText<"Enable data execution prevention">;
def sysroot: J<"sysroot">, HelpText<"Sysroot">;
+def tsaware: F<"tsaware">, HelpText<"Create Terminal Server aware executable">;
def v: Flag<["-"], "v">, HelpText<"Display the version number">;
def version: F<"version">, HelpText<"Display the version number and exit">;
Index: lld/trunk/test/MinGW/driver.test
===================================================================
--- lld/trunk/test/MinGW/driver.test
+++ lld/trunk/test/MinGW/driver.test
@@ -92,3 +92,12 @@
RUN: ld.lld -### -m i386pep foo.o --large-address-aware | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
LARGE-ADDRESS-AWARE: -largeaddressaware
+
+RUN: ld.lld -### -m i386pep foo.o | FileCheck -check-prefix DEFAULT-DISABLE-FLAGS %s
+DEFAULT-DISABLE-FLAGS: -dynamicbase:no
+
+# The extra '-' in the following check pattern is intentional, to make sure
+# that a check for "-dynamicbase" doesn't match the default "-dynamicbase:no".
+RUN: ld.lld -### -m i386pep foo.o --dynamicbase | FileCheck -check-prefix DYNAMICBASE %s
+RUN: ld.lld -### -m i386pep foo.o -dynamicbase | FileCheck -check-prefix DYNAMICBASE %s
+DYNAMICBASE: -dynamicbase -