OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 import("//build/config/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
8 import("//build/config/nacl/config.gni") | 8 import("//build/config/nacl/config.gni") |
9 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
10 import("//build/toolchain/toolchain.gni") | |
10 | 11 |
11 if (current_cpu == "arm") { | 12 if (current_cpu == "arm") { |
12 import("//build/config/arm.gni") | 13 import("//build/config/arm.gni") |
13 } | 14 } |
14 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 15 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
15 import("//build/config/mips.gni") | 16 import("//build/config/mips.gni") |
16 } | 17 } |
17 if (is_win) { | 18 if (is_win) { |
18 import("//build/config/win/visual_studio_version.gni") | 19 import("//build/config/win/visual_studio_version.gni") |
19 } | 20 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 cflags_cc += [ "-stdlib=libc++" ] | 364 cflags_cc += [ "-stdlib=libc++" ] |
364 ldflags += [ "-stdlib=libc++" ] | 365 ldflags += [ "-stdlib=libc++" ] |
365 if (!is_component_build && !is_asan) { | 366 if (!is_component_build && !is_asan) { |
366 ldflags += [ | 367 ldflags += [ |
367 "-L", | 368 "-L", |
368 rebase_path("//third_party/libc++-static", root_build_dir), | 369 rebase_path("//third_party/libc++-static", root_build_dir), |
369 ] | 370 ] |
370 } | 371 } |
371 } | 372 } |
372 | 373 |
374 # Add flags for link-time optimization. These flags enable | |
375 # optimizations/transformations that require whole-program visibility at link | |
376 # time, so they need to be applied to all translation units, and we may end up | |
377 # with miscompiles if only part of the program is compiled with LTO flags. For | |
378 # that reason, we cannot allow targets to enable or disable these flags, for | |
379 # example by disabling the optimize configuration. | |
380 # TODO(pcc): Make this conditional on is_official_build rather than on gn | |
381 # flags for specific features. | |
382 if (!is_debug && (allow_posix_link_time_opt || is_cfi) && !is_nacl) { | |
383 cflags += [ "-flto" ] | |
384 ldflags += [ "-flto" ] | |
385 | |
386 # Apply a lower LTO optimization level as the default is too slow. | |
387 if (is_linux) { | |
388 ldflags += [ "-Wl,-plugin-opt,O1" ] | |
389 } else if (is_mac) { | |
390 ldflags += [ "-Wl,-mllvm,-O1" ] | |
391 } | |
392 | |
393 # Work-around for http://openradar.appspot.com/20356002 | |
394 if (is_mac) { | |
395 ldflags += [ "-Wl,-all_load" ] | |
396 } | |
397 | |
398 # Allows the linker to apply ICF to the LTO object file. Also, when targetin g | |
brettw
2016/04/06 06:25:36
80 cols.
pcc1
2016/04/06 21:42:01
Done.
| |
399 # ARM, without this flag, LTO produces a .text section that is larger than t he | |
400 # maximum call displacement, preventing the linker from relocating calls | |
401 # (http://llvm.org/PR22999). | |
402 if (is_linux) { | |
403 ldflags += [ "-Wl,-plugin-opt,-function-sections" ] | |
404 } | |
405 | |
406 # TODO(pcc): Make these flags work correctly with CFI. | |
407 if (!is_cfi) { | |
408 cflags += [ | |
409 "-fwhole-program-vtables", | |
410 | |
411 # TODO(pcc): Remove this flag once the upstream interface change | |
412 # (http://reviews.llvm.org/D18635) lands. | |
413 "-fwhole-program-vtables-blacklist=" + | |
414 rebase_path("//tools/cfi/blacklist.txt", root_build_dir), | |
415 ] | |
416 ldflags += [ "-fwhole-program-vtables" ] | |
417 } | |
418 } | |
419 | |
373 # Pass the same C/C++ flags to the objective C/C++ compiler. | 420 # Pass the same C/C++ flags to the objective C/C++ compiler. |
374 cflags_objc += cflags_c | 421 cflags_objc += cflags_c |
375 cflags_objcc += cflags_cc | 422 cflags_objcc += cflags_cc |
376 | 423 |
377 # Assign any flags set for the C compiler to asmflags so that they are sent | 424 # Assign any flags set for the C compiler to asmflags so that they are sent |
378 # to the assembler. The Windows assembler takes different types of flags | 425 # to the assembler. The Windows assembler takes different types of flags |
379 # so only do so for posix platforms. | 426 # so only do so for posix platforms. |
380 if (is_posix) { | 427 if (is_posix) { |
381 asmflags += cflags | 428 asmflags += cflags |
382 asmflags += cflags_c | 429 asmflags += cflags_c |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1322 if (symbol_level == 0) { | 1369 if (symbol_level == 0) { |
1323 configs = [ ":no_symbols" ] | 1370 configs = [ ":no_symbols" ] |
1324 } else if (symbol_level == 1) { | 1371 } else if (symbol_level == 1) { |
1325 configs = [ ":minimal_symbols" ] | 1372 configs = [ ":minimal_symbols" ] |
1326 } else if (symbol_level == 2) { | 1373 } else if (symbol_level == 2) { |
1327 configs = [ ":symbols" ] | 1374 configs = [ ":symbols" ] |
1328 } else { | 1375 } else { |
1329 assert(false) | 1376 assert(false) |
1330 } | 1377 } |
1331 } | 1378 } |
OLD | NEW |