Chromium Code Reviews| Index: build/config/compiler/BUILD.gn |
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
| index 3ee4412ed255fbde3e0b94f81b767bd353851eac..31b27dc5e810aa71429dec2fa540d53c34fa9fb1 100644 |
| --- a/build/config/compiler/BUILD.gn |
| +++ b/build/config/compiler/BUILD.gn |
| @@ -45,10 +45,14 @@ declare_args() { |
| # Requires profiling to be set to true. |
| enable_full_stack_frames_for_profiling = false |
| + # Set to true to use lld, the LLVM linker. |
|
brettw
2016/04/27 22:55:46
It seems this is Posixonly. If so, can you wrap th
pcc1
2016/04/27 23:21:05
It's also available on Windows. I've added more in
|
| + use_lld = false |
| + |
| # TODO(GYP): We should be using 64-bit gold for linking on both 64-bit Linux |
| # and 32-bit linux; 32-bit Gold runs out of address-space on 32-bit builds. |
| # However, something isn't quite working right on the 32-bit builds. |
| - use_gold = is_linux && (current_cpu == "x64" || current_cpu == "arm") |
| + use_gold = |
| + is_linux && (current_cpu == "x64" || current_cpu == "arm") && !use_lld |
|
brettw
2016/04/27 22:55:46
This won't actually do what you want. The build ov
pcc1
2016/04/27 23:21:05
Done.
|
| # When we are going to use gold we need to find it. |
| # This is initialized below, after use_gold might have been overridden. |
| @@ -292,7 +296,9 @@ config("compiler") { |
| # Linux-specific compiler flags setup. |
| # ------------------------------------ |
| - if (use_gold) { |
| + if (is_posix && use_lld) { |
| + ldflags += [ "-fuse-ld=lld" ] |
| + } else if (use_gold) { |
| ldflags += [ |
| "-B$gold_path", |
| @@ -316,11 +322,6 @@ config("compiler") { |
| ldflags += [ "-Wl,--gdb-index" ] |
| } |
| - if (!using_sanitizer && !(is_android && use_order_profiling)) { |
| - # TODO(brettw) common.gypi has this only for target toolset. |
| - ldflags += [ "-Wl,--icf=all" ] |
| - } |
| - |
| # TODO(thestig): Make this flag work with GN. |
| #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) { |
| # ldflags += [ |
| @@ -333,6 +334,12 @@ config("compiler") { |
| ldflags += [ "-fuse-ld=bfd" ] |
| } |
| + if (is_posix && (use_gold || use_lld) && !using_sanitizer && |
| + !(is_android && use_order_profiling)) { |
| + # TODO(brettw) common.gypi has this only for target toolset. |
|
brettw
2016/04/27 22:55:46
I think you can delete this comment.
pcc1
2016/04/27 23:21:05
Done.
|
| + ldflags += [ "-Wl,--icf=all" ] |
| + } |
| + |
| if (linux_use_bundled_binutils) { |
| cflags += [ "-B$binutils_path" ] |
| } |
| @@ -413,7 +420,11 @@ config("compiler") { |
| # Apply a lower LTO optimization level as the default is too slow. |
| if (is_linux) { |
| - ldflags += [ "-Wl,-plugin-opt,O1" ] |
| + if (use_lld) { |
| + ldflags += [ "-Wl,--lto-O1" ] |
| + } else { |
| + ldflags += [ "-Wl,-plugin-opt,O1" ] |
| + } |
| } else if (is_mac) { |
| ldflags += [ "-Wl,-mllvm,-O1" ] |
| } |