add("-kill-at");
if (args.hasArg(OPT_appcontainer))
add("-appcontainer");
- if (args.hasArg(OPT_no_seh))
+ if (args.hasFlag(OPT_no_seh, OPT_disable_no_seh, false))
add("-noseh");
if (args.getLastArgValue(OPT_m) != "thumb2pe" &&
args.getLastArgValue(OPT_m) != "arm64pe" &&
- args.hasArg(OPT_no_dynamicbase))
+ args.hasFlag(OPT_disable_dynamicbase, OPT_dynamicbase, false))
add("-dynamicbase:no");
+ if (args.hasFlag(OPT_disable_high_entropy_va, OPT_high_entropy_va, false))
+ add("-highentropyva:no");
+ if (args.hasFlag(OPT_disable_nxcompat, OPT_nxcompat, false))
+ add("-nxcompat:no");
+ if (args.hasFlag(OPT_disable_tsaware, OPT_tsaware, false))
+ add("-tsaware:no");
if (args.hasFlag(OPT_no_insert_timestamp, OPT_insert_timestamp, false))
add("-timestamp:0");
def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
}
+multiclass B_disable<string name, string help1, string help2> {
+ def NAME: Flag<["--", "-"], name>, HelpText<help1>;
+ def disable_ # NAME: Flag<["--", "-"], "disable-" # name>, HelpText<help2>;
+}
+
def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
HelpText<"Add a directory to the library search path">;
defm allow_multiple_definition: B<"allow-multiple-definition",
HelpText<"Don't do automatic imports that require runtime fixups">;
def disable_stdcall_fixup: F<"disable-stdcall-fixup">,
HelpText<"Don't resolve stdcall/fastcall/vectorcall to undecorated symbols">;
-defm dynamicbase: B<"dynamicbase", "Enable ASLR", "Disable ASLR">;
+defm dynamicbase: B_disable<"dynamicbase", "Enable ASLR", "Disable ASLR">;
def enable_auto_import: F<"enable-auto-import">,
HelpText<"Automatically import data symbols from other DLLs where needed">;
def enable_runtime_pseudo_reloc: F<"enable-runtime-pseudo-reloc">,
"Remove unused sections",
"Don't remove unused sections">;
def help: F<"help">, HelpText<"Print option help">;
+defm high_entropy_va: B_disable<"high-entropy-va",
+ "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">;
defm icf: Eq<"icf", "Identical code folding">;
defm image_base: Eq<"image-base", "Base address of the program">;
defm insert_timestamp: B<"insert-timestamp",
"Set the OS and subsystem minor version">;
defm minor_subsystem_version: EqLong<"minor-subsystem-version",
"Set the OS and subsystem minor version">;
-def no_seh: F<"no-seh">, HelpText<"Set the 'no SEH' flag in the executable">;
+defm no_seh: B_disable<"no-seh",
+ "Set the 'no SEH' flag in the executable", "Don't set the 'no SEH' flag">;
+defm nxcompat: B_disable<"nxcompat",
+ "Set the 'nxcompat' flag in the executable", "Don't set the 'nxcompat' flag">;
def large_address_aware: Flag<["--"], "large-address-aware">,
HelpText<"Enable large addresses">;
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
"Write a tar file containing input files and command line options to reproduce link">;
defm require_defined: Eq<"require-defined",
"Force symbol to be added to symbol table as an undefined one">;
+defm tsaware: B_disable<"tsaware",
+ "Set the 'Terminal Server aware' flag", "Don't set the 'Terminal Server aware' flag">;
defm undefined: Eq<"undefined", "Include symbol in the link, if available">;
defm whole_archive: B<"whole-archive",
"Include all object files for following archives",
def alias_Bstatic_non_shared: Flag<["-"], "non_shared">, Alias<Bstatic>;
def alias_Bstatic_static: Flag<["-"], "static">, Alias<Bstatic>;
def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
+def alias_no_dynamicbase: F<"no-dynamicbase">, Alias<disable_dynamicbase>;
def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>;
def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
def: F<"enable-auto-image-base">;
def: F<"end-group">;
def: Flag<["--"], "full-shutdown">;
-def: F<"high-entropy-va">;
defm: EqNoHelp<"major-image-version">;
defm: EqNoHelp<"minor-image-version">;
def: F<"no-undefined">;
-def: F<"nxcompat">;
def: F<"pic-executable">;
defm: EqNoHelp<"plugin">;
defm: EqNoHelp<"plugin-opt">;
defm: EqNoHelp<"sysroot">;
def: F<"start-group">;
-def: F<"tsaware">;
RUN: ld.lld -### -m i386pep foo.o --large-address-aware 2>&1 | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
LARGE-ADDRESS-AWARE: -largeaddressaware
-RUN: ld.lld -### -m i386pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
+RUN: ld.lld -### -m i386pe foo.o --dynamicbase --no-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
+RUN: ld.lld -### -m i386pe foo.o --dynamicbase --disable-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
DISABLE-DYNAMICBASE: -dynamicbase:no
-RUN: ld.lld -### -m i386pe --dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
+RUN: ld.lld -### -m i386pe --disable-dynamicbase --dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
RUN: ld.lld -### -m i386pep -dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
RUN: ld.lld -### -m i386pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
RUN: ld.lld -### -m arm64pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
NO-DISABLE-DYNAMICBASE-NOT: -dynamicbase:no
+RUN: ld.lld -### -m i386pe foo.o -high-entropy-va -disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
+RUN: ld.lld -### -m i386pe foo.o --high-entropy-va --disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
+DISABLE-HIGH-ENTROPY-VA: -highentropyva:no
+RUN: ld.lld -### -m i386pe foo.o -disable-high-entropy-va -high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
+RUN: ld.lld -### -m i386pe foo.o --disable-high-entropy-va --high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
+NO-DISABLE-HIGH-ENTROPY-VA-NOT: -highentropyva:no
+
+RUN: ld.lld -### -m i386pe foo.o -nxcompat -disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
+RUN: ld.lld -### -m i386pe foo.o --nxcompat --disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
+DISABLE-NXCOMPAT: -nxcompat:no
+RUN: ld.lld -### -m i386pe foo.o -disable-nxcompat -nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
+RUN: ld.lld -### -m i386pe foo.o --disable-nxcompat --nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
+NO-DISABLE-NXCOMPAT-NOT: -nxcompat:no
+
+RUN: ld.lld -### -m i386pe foo.o -tsaware -disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
+RUN: ld.lld -### -m i386pe foo.o --tsaware --disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
+DISABLE-TSAWARE: -tsaware:no
+RUN: ld.lld -### -m i386pe foo.o -disable-tsaware -tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
+RUN: ld.lld -### -m i386pe foo.o --disable-tsaware --tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
+NO-DISABLE-TSAWARE-NOT: -tsaware:no
+
RUN: ld.lld -### -m i386pep foo.o --image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
RUN: ld.lld -### -m i386pep foo.o -image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
RUN: ld.lld -### -m i386pep foo.o --image-base=0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
RUN: ld.lld -### -m i386pep foo.o -section-alignment=0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
ALIGN: -align:0x2000
-RUN: ld.lld -### -m i386pe foo.o -no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
-RUN: ld.lld -### -m i386pe foo.o --no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
+RUN: ld.lld -### -m i386pe foo.o -disable-no-seh -no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
+RUN: ld.lld -### -m i386pe foo.o --disable-no-seh --no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
+RUN: ld.lld -### -m i386pe foo.o -no-seh -disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
+RUN: ld.lld -### -m i386pe foo.o --no-seh --disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
NOSEH: -noseh
+DISABLE-NOSEH-NOT: -noseh
RUN: ld.lld -### -m i386pep foo.o --no-allow-multiple-definition --allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
RUN: ld.lld -### -m i386pep foo.o -no-allow-multiple-definition -allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s