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 import("//build/toolchain/toolchain.gni") |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 "-Wl,--no-as-needed", | 307 "-Wl,--no-as-needed", |
308 "-lpthread", | 308 "-lpthread", |
309 ] | 309 ] |
310 } | 310 } |
311 ldflags += [ "-Wl,--as-needed" ] | 311 ldflags += [ "-Wl,--as-needed" ] |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 # Linux-specific compiler flags setup. | 315 # Linux-specific compiler flags setup. |
316 # ------------------------------------ | 316 # ------------------------------------ |
| 317 if (is_android && is_clang) { |
| 318 _rebased_android_toolchain_root = |
| 319 rebase_path(android_toolchain_root, root_build_dir) |
| 320 |
| 321 # Let clang find the linker in the NDK. |
| 322 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] |
| 323 } |
| 324 |
317 if (is_posix && use_lld && !is_nacl) { | 325 if (is_posix && use_lld && !is_nacl) { |
318 ldflags += [ "-fuse-ld=lld" ] | 326 ldflags += [ "-fuse-ld=lld" ] |
319 } else if (use_gold) { | 327 } else if (use_gold) { |
320 ldflags += [ "-fuse-ld=gold" ] | 328 ldflags += [ "-fuse-ld=gold" ] |
321 if (is_android) { | 329 if (is_android) { |
322 if (is_clang) { | |
323 _rebased_android_toolchain_root = | |
324 rebase_path(android_toolchain_root, root_build_dir) | |
325 | |
326 # Let clang find the ld.gold in the NDK. | |
327 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] | |
328 } | |
329 | |
330 # Use -mstackrealign due to a bug on ia32 Jelly Bean. | 330 # Use -mstackrealign due to a bug on ia32 Jelly Bean. |
331 # See crbug.com/521527 | 331 # See crbug.com/521527 |
332 if (current_cpu == "x86") { | 332 if (current_cpu == "x86") { |
333 cflags += [ "-mstackrealign" ] | 333 cflags += [ "-mstackrealign" ] |
334 } | 334 } |
335 } else { | 335 } else { |
| 336 # On Android, this isn't needed. gcc in the NDK knows to look next to |
| 337 # it with -fuse-ld=gold, and clang gets a --gcc-toolchain flag passed |
| 338 # above. |
336 ldflags += [ "-B$gold_path" ] | 339 ldflags += [ "-B$gold_path" ] |
337 | 340 |
338 if (linux_use_bundled_binutils) { | 341 if (linux_use_bundled_binutils) { |
339 ldflags += [ | 342 ldflags += [ |
340 # Experimentation found that using four linking threads | 343 # Experimentation found that using four linking threads |
341 # saved ~20% of link time. | 344 # saved ~20% of link time. |
342 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 | 345 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 |
343 # Only apply this to the target linker, since the host | 346 # Only apply this to the target linker, since the host |
344 # linker might not be gold, but isn't used much anyway. | 347 # linker might not be gold, but isn't used much anyway. |
345 "-Wl,--threads", | 348 "-Wl,--threads", |
346 "-Wl,--thread-count=4", | 349 "-Wl,--thread-count=4", |
347 ] | 350 ] |
348 } | 351 } |
349 } | 352 } |
350 | 353 |
351 if (gdb_index) { | 354 if (gdb_index) { |
352 ldflags += [ "-Wl,--gdb-index" ] | 355 ldflags += [ "-Wl,--gdb-index" ] |
353 } | 356 } |
354 | 357 |
355 # TODO(thestig): Make this flag work with GN. | 358 # TODO(thestig): Make this flag work with GN. |
356 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { | 359 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { |
357 # ldflags += [ | 360 # ldflags += [ |
358 # "-Wl,--detect-odr-violations", | 361 # "-Wl,--detect-odr-violations", |
359 # ] | 362 # ] |
360 #} | 363 #} |
361 } else if (linux_use_bundled_binutils) { | 364 } else if (linux_use_bundled_binutils) { |
362 # Gold is the default linker for the bundled binutils so we explicitly | 365 # Gold is the default linker for the bundled binutils so we explicitly |
363 # enable the bfd linker when use_gold is not set. | 366 # enable the bfd linker when use_gold is not set. |
364 ldflags += [ "-fuse-ld=bfd" ] | 367 ldflags += [ "-fuse-ld=bfd" ] |
365 } else if (is_android && is_clang && | |
366 (current_cpu == "mipsel" || current_cpu == "mips64el")) { | |
367 # Let clang find the ld.bfd in the NDK. | |
368 _rebased_android_toolchain_root = | |
369 rebase_path(android_toolchain_root, root_build_dir) | |
370 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] | |
371 } | 368 } |
372 | 369 |
373 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer && | 370 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer && |
374 !(is_android && use_order_profiling)) { | 371 !(is_android && use_order_profiling)) { |
375 # TODO(crbug.com/576197) - gcc on x86 platforms + gold + icf=all | 372 # TODO(crbug.com/576197) - gcc on x86 platforms + gold + icf=all |
376 # doesn't currently work on non-chromeos platforms. | 373 # doesn't currently work on non-chromeos platforms. |
377 # Additionally, on Android x86 --icf=safe seems to cause issues as well. | 374 # Additionally, on Android x86 --icf=safe seems to cause issues as well. |
378 # Additionally, on cast Android x86, --icf=all causes issues. | 375 # Additionally, on cast Android x86, --icf=all causes issues. |
379 if (is_android && current_cpu == "x86") { | 376 if (is_android && current_cpu == "x86") { |
380 ldflags += [ "-Wl,--icf=none" ] | 377 ldflags += [ "-Wl,--icf=none" ] |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 | 1614 |
1618 if (is_ios || is_mac) { | 1615 if (is_ios || is_mac) { |
1619 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1616 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1620 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1617 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1621 config("enable_arc") { | 1618 config("enable_arc") { |
1622 common_flags = [ "-fobjc-arc" ] | 1619 common_flags = [ "-fobjc-arc" ] |
1623 cflags_objc = common_flags | 1620 cflags_objc = common_flags |
1624 cflags_objcc = common_flags | 1621 cflags_objcc = common_flags |
1625 } | 1622 } |
1626 } | 1623 } |
OLD | NEW |