build_bring_back_node_with_ltcg_configuration.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 f07e65f719a1a5939997dfcae7bc787ee6391f4d..69b5439a5c19230e5568450c3aca9ce27661d77c 100644
  12. --- a/common.gypi
  13. +++ b/common.gypi
  14. @@ -180,6 +180,26 @@
  15. 'cflags': [ '-fPIE' ],
  16. 'ldflags': [ '-fPIE', '-pie' ]
  17. }],
  18. + ['node_with_ltcg=="true"', {
  19. + 'msvs_settings': {
  20. + 'VCCLCompilerTool': {
  21. + 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
  22. + },
  23. + 'VCLibrarianTool': {
  24. + 'AdditionalOptions': [
  25. + '/LTCG:INCREMENTAL', # incremental link-time code generation
  26. + ]
  27. + },
  28. + 'VCLinkerTool': {
  29. + 'OptimizeReferences': 2, # /OPT:REF
  30. + 'EnableCOMDATFolding': 2, # /OPT:ICF
  31. + 'LinkIncremental': 1, # disable incremental linking
  32. + 'AdditionalOptions': [
  33. + '/LTCG:INCREMENTAL', # incremental link-time code generation
  34. + ]
  35. + }
  36. + }
  37. + }]
  38. ],
  39. 'msvs_settings': {
  40. 'VCCLCompilerTool': {