build_bring_back_node_with_ltcg_configuration.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Deepak Mohan <[email protected]>
  3. Date: Wed, 16 Oct 2019 13:41:12 -0700
  4. Subject: build: bring back node_with_ltcg configuration
  5. This was moved to code node.gyp as part of https://github.com/nodejs/node/pull/25931
  6. which caused native modules size increase which were depending on
  7. this configuration transitively https://github.com/nodejs/node/issues/29501.
  8. THe fix for this should land in node-gyp as discussed in above issue,
  9. landing this as temporary patch.
  10. diff --git a/common.gypi b/common.gypi
  11. index bb60a045c1132bf3a16d0b773ba34e5e9efb0f0c..59d987caa72dc96bfcec6ff9a03c58d655546b5e 100644
  12. --- a/common.gypi
  13. +++ b/common.gypi
  14. @@ -19,7 +19,7 @@
  15. 'node_use_v8_platform%': 'true',
  16. 'node_use_bundled_v8%': 'true',
  17. 'node_module_version%': '',
  18. - 'node_with_ltcg%': '',
  19. + 'node_with_ltcg%': 'true',
  20. 'node_shared_openssl%': 'false',
  21. 'node_tag%': '',
  22. @@ -211,6 +211,26 @@
  23. 'cflags': [ '-fPIE' ],
  24. 'ldflags': [ '-fPIE', '-pie' ]
  25. }],
  26. + ['node_with_ltcg=="true"', {
  27. + 'msvs_settings': {
  28. + 'VCCLCompilerTool': {
  29. + 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
  30. + },
  31. + 'VCLibrarianTool': {
  32. + 'AdditionalOptions': [
  33. + '/LTCG:INCREMENTAL', # incremental link-time code generation
  34. + ]
  35. + },
  36. + 'VCLinkerTool': {
  37. + 'OptimizeReferences': 2, # /OPT:REF
  38. + 'EnableCOMDATFolding': 2, # /OPT:ICF
  39. + 'LinkIncremental': 1, # disable incremental linking
  40. + 'AdditionalOptions': [
  41. + '/LTCG:INCREMENTAL', # incremental link-time code generation
  42. + ]
  43. + }
  44. + }
  45. + }]
  46. ],
  47. 'msvs_settings': {
  48. 'VCCLCompilerTool': {