diff options
author | Jesse Chan <jc@linux.com> | 2021-05-21 04:39:23 +0300 |
---|---|---|
committer | gengjiawen <technicalcute@gmail.com> | 2021-05-25 08:09:44 +0300 |
commit | ab71af34533a43e4d8d788e8ed678bf572672458 (patch) | |
tree | a72f6a4e95ca3aa88c12c6ff61d8cbbb208fc0bc /common.gypi | |
parent | 9a7cbe25de88d87429a69050a1a1971234558d97 (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"', { |