Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 951983002: Reland "Enable libc++ on Android" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 if (current_cpu == "arm") { 6 if (current_cpu == "arm") {
7 import("//build/config/arm.gni") 7 import("//build/config/arm.gni")
8 } 8 }
9 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 9 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
10 import("//build/config/mips.gni") 10 import("//build/config/mips.gni")
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (is_clang) { 442 if (is_clang) {
443 # Let clang find the ld.gold in the NDK. 443 # Let clang find the ld.gold in the NDK.
444 ldflags += [ "--gcc-toolchain=" + 444 ldflags += [ "--gcc-toolchain=" +
445 rebase_path(android_toolchain_root, root_build_dir) ] 445 rebase_path(android_toolchain_root, root_build_dir) ]
446 } 446 }
447 } 447 }
448 448
449 ldflags += [ 449 ldflags += [
450 "-Wl,--no-undefined", 450 "-Wl,--no-undefined",
451 451
452 # Don't allow visible symbols from libgcc or stlport to be 452 # Don't allow visible symbols from libgcc or libc++ to be
453 # re-exported. 453 # re-exported.
454 "-Wl,--exclude-libs=libgcc.a", 454 "-Wl,--exclude-libs=libgcc.a",
455 "-Wl,--exclude-libs=libstlport_static.a", 455 "-Wl,--exclude-libs=libc++_static.a",
456 456
457 # Don't allow visible symbols from libraries that contain 457 # Don't allow visible symbols from libraries that contain
458 # assembly code with symbols that aren't hidden properly. 458 # assembly code with symbols that aren't hidden properly.
459 # http://crbug.com/448386 459 # http://crbug.com/448386
460 "-Wl,--exclude-libs=libvpx_assembly_arm.a", 460 "-Wl,--exclude-libs=libvpx_assembly_arm.a",
461 ] 461 ]
462 if (current_cpu == "arm") { 462 if (current_cpu == "arm") {
463 ldflags += [ 463 ldflags += [
464 # Enable identical code folding to reduce size. 464 # Enable identical code folding to reduce size.
465 "-Wl,--icf=safe", 465 "-Wl,--icf=safe",
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 defines += [ 531 defines += [
532 "__STD_C", 532 "__STD_C",
533 "__STDC_CONSTANT_MACROS", 533 "__STDC_CONSTANT_MACROS",
534 "__STDC_FORMAT_MACROS", 534 "__STDC_FORMAT_MACROS",
535 "_CRT_RAND_S", 535 "_CRT_RAND_S",
536 "_CRT_SECURE_NO_DEPRECATE", 536 "_CRT_SECURE_NO_DEPRECATE",
537 "_SCL_SECURE_NO_DEPRECATE", 537 "_SCL_SECURE_NO_DEPRECATE",
538 ] 538 ]
539 } 539 }
540 540
541 # Stlport setup. Android uses a different (smaller) version of the STL. 541 # Android standard library setup.
542 if (is_android) { 542 if (is_android) {
543 if (is_clang) { 543 if (is_clang) {
544 # Work around incompatibilities between bionic and clang headers. 544 # Work around incompatibilities between bionic and clang headers.
545 defines += [ 545 defines += [
546 "__compiler_offsetof=__builtin_offsetof", 546 "__compiler_offsetof=__builtin_offsetof",
547 "nan=__builtin_nan", 547 "nan=__builtin_nan",
548 ] 548 ]
549 } 549 }
550 550
551 defines += [ 551 defines += [ "__GNU_SOURCE=1" ] # Necessary for clone().
552 "USE_STLPORT=1",
553 "_STLP_USE_PTR_SPECIALIZATIONS=1",
554 "__GNU_SOURCE=1", # Necessary for clone().
555 ]
556 552
557 # TODO(jdduke) Re-enable on mips after resolving linking 553 # TODO(jdduke) Re-enable on mips after resolving linking
558 # issues with libc++ (crbug.com/456380). 554 # issues with libc++ (crbug.com/456380).
559 if (cpu_arch != "mipsel" && cpu_arch != "mips64el") { 555 if (cpu_arch != "mipsel" && cpu_arch != "mips64el") {
560 ldflags += [ "-Wl,--warn-shared-textrel" ] 556 ldflags += [ "-Wl,--warn-shared-textrel" ]
561 } 557 }
562 ldflags += [ "-nostdlib" ] 558 ldflags += [ "-nostdlib" ]
563 559
564 # NOTE: The stlport header include paths below are specified in cflags 560 # NOTE: The libc++ header include paths below are specified in cflags
565 # rather than include_dirs because they need to come after include_dirs. 561 # rather than include_dirs because they need to come after include_dirs.
566 # Think of them like system headers, but don't use '-isystem' because the 562 # Think of them like system headers, but don't use '-isystem' because the
567 # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit 563 # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
568 # strange errors. The include ordering here is important; change with 564 # strange errors. The include ordering here is important; change with
569 # caution. 565 # caution.
570 android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport" 566 android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
571 567
572 cflags += [ "-isystem" + 568 cflags += [
573 rebase_path("$android_stlport_root/stlport", root_build_dir) ] 569 "-isystem" +
574 lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ] 570 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir),
571 "-isystem" + rebase_path(
572 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/includ e",
573 root_build_dir),
574 "-isystem" +
575 rebase_path("$android_ndk_root/sources/android/support/include",
576 root_build_dir),
577 ]
578
579 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
575 580
576 if (component_mode == "shared_library") { 581 if (component_mode == "shared_library") {
577 libs += [ "stlport_shared" ] 582 android_libcpp_library = "c++_shared"
578 } else { 583 } else {
579 libs += [ "stlport_static" ] 584 android_libcpp_library = "c++_static"
580 }
581
582 if (current_cpu == "mipsel") {
583 libs += [
584 # ld linker is used for mips Android, and ld does not accept library
585 # absolute path prefixed by "-l"; Since libgcc does not exist in mips
586 # sysroot the proper library will be linked.
587 # TODO(gordanac): Remove once gold linker is used for mips Android.
588 "gcc",
589 ]
590 } else {
591 libs += [
592 # Manually link the libgcc.a that the cross compiler uses. This is
593 # absolute because the linker will look inside the sysroot if it's not.
594 rebase_path(android_libgcc_file),
595 ]
596 } 585 }
597 586
598 libs += [ 587 libs += [
588 "$android_libcpp_library",
589 "atomic",
590
591 # Manually link the libgcc.a that the cross compiler uses. This is
592 # absolute because the linker will look inside the sysroot if it's not.
593 rebase_path(android_libgcc_file),
594 "m",
599 "c", 595 "c",
600 "dl", 596 "dl",
601 "m",
602 ] 597 ]
603 } 598 }
604 } 599 }
605 600
606 # chromium_code --------------------------------------------------------------- 601 # chromium_code ---------------------------------------------------------------
607 # 602 #
608 # Toggles between higher and lower warnings for code that is (or isn't) 603 # Toggles between higher and lower warnings for code that is (or isn't)
609 # part of Chromium. 604 # part of Chromium.
610 605
611 config("chromium_code") { 606 config("chromium_code") {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 cflags += [ "-gsplit-dwarf" ] 1076 cflags += [ "-gsplit-dwarf" ]
1082 } 1077 }
1083 } 1078 }
1084 } 1079 }
1085 1080
1086 config("no_symbols") { 1081 config("no_symbols") {
1087 if (!is_win) { 1082 if (!is_win) {
1088 cflags = [ "-g0" ] 1083 cflags = [ "-g0" ]
1089 } 1084 }
1090 } 1085 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698