Index: MinGW/Driver.cpp =================================================================== --- MinGW/Driver.cpp +++ MinGW/Driver.cpp @@ -156,6 +156,10 @@ Add("-debug:dwarf"); if (Args.hasArg(OPT_large_address_aware)) Add("-largeaddressaware"); + if (Args.hasArg(OPT_dynamicbase)) + Add("-dynamicbase"); + else + Add("-dynamicbase:no"); if (auto *A = Args.getLastArg(OPT_m)) { StringRef S = A->getValue(); Index: MinGW/Options.td =================================================================== --- MinGW/Options.td +++ 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: test/MinGW/driver.test =================================================================== --- test/MinGW/driver.test +++ 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 -