timestamp.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From f4743f40894d1dcd4ba131af3ad86a34c6d54598 Mon Sep 17 00:00:00 2001
  2. From: Martin Storsjo <martin@martin.st>
  3. Date: Tue, 5 Feb 2019 08:16:06 +0000
  4. Subject: [PATCH] Hook up the --no-insert-timestamp option
  5. This fixes PR40582.
  6. Patch by Georg Koppen!
  7. Differential Revision: https://reviews.llvm.org/D57679
  8. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353145 91177308-0d34-0410-b5e6-96231b3b80d8
  9. diff --git a/MinGW/Driver.cpp b/MinGW/Driver.cpp
  10. index 27a5550ec..d79ebe82e 100644
  11. --- a/MinGW/Driver.cpp
  12. +++ b/MinGW/Driver.cpp
  13. @@ -170,6 +170,9 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
  14. Args.getLastArgValue(OPT_m) != "arm64pe" && !Args.hasArg(OPT_dynamicbase))
  15. Add("-dynamicbase:no");
  16. + if (Args.hasArg(OPT_no_insert_timestamp))
  17. + Add("-timestamp:0");
  18. +
  19. if (Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false))
  20. Add("-opt:ref");
  21. else
  22. diff --git a/MinGW/Options.td b/MinGW/Options.td
  23. index ad699f711..5cc339a4a 100644
  24. --- a/MinGW/Options.td
  25. +++ b/MinGW/Options.td
  26. @@ -20,6 +20,8 @@ def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
  27. def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
  28. def map: S<"Map">, HelpText<"Output a linker map">;
  29. def map_eq: J<"Map=">, Alias<map>;
  30. +def no_insert_timestamp: F<"no-insert-timestamp">,
  31. + HelpText<"Don't include PE header timestamp">;
  32. def no_whole_archive: F<"no-whole-archive">,
  33. HelpText<"No longer include all object files for following archives">;
  34. def large_address_aware: Flag<["--"], "large-address-aware">,
  35. diff --git a/test/MinGW/driver.test b/test/MinGW/driver.test
  36. index 3222bb111..b853527a0 100644
  37. --- a/test/MinGW/driver.test
  38. +++ b/test/MinGW/driver.test
  39. @@ -151,3 +151,6 @@ REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
  40. RUN: ld.lld -### -m i386pep foo.o -Llibpath | FileCheck -check-prefix LIBPATH %s
  41. LIBPATH: -libpath:libpath
  42. +
  43. +RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp | FileCheck -check-prefix NOTIMESTAMP %s
  44. +NOTIMESTAMP: -timestamp:0
  45. --
  46. 2.23.0.rc1