Index: MinGW/Driver.cpp =================================================================== --- MinGW/Driver.cpp +++ MinGW/Driver.cpp @@ -187,7 +187,7 @@ Args.getLastArgValue(OPT_m) != "arm64pe" && !Args.hasArg(OPT_dynamicbase)) Add("-dynamicbase:no"); - if (Args.hasArg(OPT_no_insert_timestamp)) + if (Args.hasFlag(OPT_no_insert_timestamp, OPT_insert_timestamp, false)) Add("-timestamp:0"); if (Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false)) Index: MinGW/Options.td =================================================================== --- MinGW/Options.td +++ MinGW/Options.td @@ -16,6 +16,8 @@ def gc_sections: F<"gc-sections">, HelpText<"Remove unused sections">; def icf: J<"icf=">, HelpText<"Identical code folding">; def image_base: S<"image-base">, HelpText<"Base address of the program">; +def insert_timestamp: F<"insert-timestamp">, + HelpText<"Include PE header timestamp">; def kill_at: F<"kill-at">, HelpText<"Remove @n from exported symbols">; def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"">, HelpText<"Root name of library to use">; Index: test/MinGW/driver.test =================================================================== --- test/MinGW/driver.test +++ test/MinGW/driver.test @@ -153,4 +153,7 @@ LIBPATH: -libpath:libpath RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp | FileCheck -check-prefix NOTIMESTAMP %s +RUN: ld.lld -### -m i386pep foo.o --insert-timestamp --no-insert-timestamp | FileCheck -check-prefix NOTIMESTAMP %s NOTIMESTAMP: -timestamp:0 +RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp --insert-timestamp | FileCheck -check-prefix TIMESTAMP %s +TIMESTAMP-NOT: -timestamp:0