diff options
author | Jesse Chan <jc@linux.com> | 2021-05-21 04:39:23 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-05-31 22:34:53 +0300 |
commit | 80c32b7a9a79056f96f3181308379a71bbde4ef4 (patch) | |
tree | 2fb44804aa2b5c35562c0a137267bd53eec47c4d /common.gypi | |
parent | 30c0020885bc3362d55e0292b95a861d2622b6b5 (diff) |
build: allow LTO with Clang 3.9.1+
Bug: #38568
Test: manual,
- arm64-apple-darwin20.5.0 / Apple clang version 12.0.5 (clang-1205.0.22.9)
- x86_64-pc-linux-gnu / Ubuntu clang version 13.0.0-++20210520052624+48780527dd68-1~exp1~20210520153429.417
Signed-off-by: Jesse Chan <jc@linux.com>
PR-URL: https://github.com/nodejs/node/pull/38751
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'common.gypi')
-rw-r--r-- | common.gypi | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/common.gypi b/common.gypi index 4bc75c7c41c..ee91fb1df6d 100644 --- a/common.gypi +++ b/common.gypi @@ -164,17 +164,28 @@ 'v8_enable_handle_zapping': 0, 'pgo_generate': ' -fprofile-generate ', 'pgo_use': ' -fprofile-use -fprofile-correction ', - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', 'conditions': [ ['node_shared != "true"', { 'MSVC_runtimeType': 0 # MultiThreaded (/MT) }, { 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD) }], + ['llvm_version=="0.0"', { + 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC + }, { + 'lto': ' -flto ', # Clang + }], ], }, 'cflags': [ '-O3' ], 'conditions': [ + ['enable_lto=="true"', { + 'cflags': ['<(lto)'], + 'ldflags': ['<(lto)'], + 'xcode_settings': { + 'LLVM_LTO': 'YES', + }, + }], ['OS=="linux"', { 'conditions': [ ['node_section_ordering_info!=""', { @@ -206,10 +217,6 @@ 'cflags': ['<(pgo_use)'], 'ldflags': ['<(pgo_use)'], },], - ['enable_lto=="true"', { - 'cflags': ['<(lto)'], - 'ldflags': ['<(lto)'], - },], ], },], ['OS == "android"', { |