Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
| 6 import("//build/toolchain/toolchain.gni") | 6 import("//build/toolchain/toolchain.gni") |
| 7 | 7 |
| 8 # Sanitizer builds need to override operator new, operator delete, and | 8 # Sanitizer builds need to override operator new, operator delete, and |
| 9 # some exception handling symbols, so libc++ must be a shared library | 9 # some exception handling symbols, so libc++ must be a shared library |
| 10 # to prevent duplicate symbol errors when linking. | 10 # to prevent duplicate symbol errors when linking. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 # similar to that overrides the default elf merging rules, and | 33 # similar to that overrides the default elf merging rules, and |
| 34 # make tcmalloc's gn config pass that to all its dependencies, | 34 # make tcmalloc's gn config pass that to all its dependencies, |
| 35 # then remove this override here. | 35 # then remove this override here. |
| 36 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\"))) ", | 36 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\"))) ", |
| 37 ] | 37 ] |
| 38 } | 38 } |
| 39 cflags = [ | 39 cflags = [ |
| 40 "-fPIC", | 40 "-fPIC", |
| 41 "-fstrict-aliasing", | 41 "-fstrict-aliasing", |
| 42 ] | 42 ] |
| 43 cflags_cc = [ | |
| 44 "-nostdinc++", | |
| 45 "-isystem" + rebase_path("trunk/include", root_build_dir), | |
| 46 "-isystem" + rebase_path("../libc++abi/trunk/include", root_build_dir), | |
| 47 "-std=c++11", | |
| 48 ] | |
| 49 if (is_linux && current_cpu == "arm") { | |
| 50 cflags_c = [ "-isystem" + | |
| 51 rebase_path("../libunwind/trunk/include", root_build_dir) ] | |
| 52 cflags_cc += [ "-isystem" + | |
| 53 rebase_path("../libunwind/trunk/include", root_build_dir) ] | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 config("no_libstdcpp") { | |
| 58 # Make sure we don't link against libc++ or libstdc++. | |
| 59 ldflags = [ "-nodefaultlibs" ] | |
| 60 | |
| 61 # Unfortunately, there's no way to disable linking against just | |
| 62 # libc++ (besides using clang instead of clang++); -nodefaultlibs | |
| 63 # removes all of the default libraries, so add back the ones that we | |
| 64 # need. | |
| 65 libs = [ | |
| 66 "c", | |
| 67 "m", | |
| 68 ] | |
| 69 | |
| 70 if (!is_mac) { | |
| 71 libs += [ | |
| 72 "gcc_s", | |
| 73 "rt", | |
| 74 ] | |
| 75 } | |
| 76 | |
| 77 if (is_mac && using_sanitizer) { | |
| 78 lib_dirs = [ "//third_party/llvm-build/Release+Asserts/lib/clang/$clang_vers ion/lib/darwin" ] | |
| 79 | |
| 80 if (is_asan) { | |
| 81 libs += [ "clang_rt.asan_osx_dynamic" ] | |
| 82 } | |
| 83 } | |
| 84 } | 43 } |
| 85 | 44 |
| 86 if (libcpp_is_static) { | 45 if (libcpp_is_static) { |
| 87 link_target_type = "source_set" | 46 link_target_type = "source_set" |
| 88 } else { | 47 } else { |
| 89 link_target_type = "shared_library" | 48 link_target_type = "shared_library" |
| 90 } | 49 } |
| 91 target(link_target_type, "libc++") { | 50 target(link_target_type, "libc++") { |
| 51 visibility = [ "//build/config:exe_and_shlib_deps" ] | |
|
Nico
2017/06/30 20:07:04
Hmm, this adds a cycling dependency between files
Tom Anderson
2017/06/30 21:08:28
Wouldn't that just require rolling buildtools at t
Michael Achenbach
2017/07/03 06:37:57
Our deps roller usually auto-rolls build and build
| |
| 92 sources = [ | 52 sources = [ |
| 93 "trunk/src/algorithm.cpp", | 53 "trunk/src/algorithm.cpp", |
| 94 "trunk/src/any.cpp", | 54 "trunk/src/any.cpp", |
| 95 "trunk/src/bind.cpp", | 55 "trunk/src/bind.cpp", |
| 96 "trunk/src/chrono.cpp", | 56 "trunk/src/chrono.cpp", |
| 97 "trunk/src/condition_variable.cpp", | 57 "trunk/src/condition_variable.cpp", |
| 98 "trunk/src/debug.cpp", | 58 "trunk/src/debug.cpp", |
| 99 "trunk/src/exception.cpp", | 59 "trunk/src/exception.cpp", |
| 100 "trunk/src/functional.cpp", | 60 "trunk/src/functional.cpp", |
| 101 "trunk/src/future.cpp", | 61 "trunk/src/future.cpp", |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 120 "trunk/src/valarray.cpp", | 80 "trunk/src/valarray.cpp", |
| 121 "trunk/src/variant.cpp", | 81 "trunk/src/variant.cpp", |
| 122 ] | 82 ] |
| 123 configs -= [ | 83 configs -= [ |
| 124 "//build/config/compiler:chromium_code", | 84 "//build/config/compiler:chromium_code", |
| 125 "//build/config/compiler:no_rtti", | 85 "//build/config/compiler:no_rtti", |
| 126 "//build/config/gcc:no_exceptions", | 86 "//build/config/gcc:no_exceptions", |
| 127 ] | 87 ] |
| 128 configs += [ | 88 configs += [ |
| 129 ":config", | 89 ":config", |
| 130 ":no_libstdcpp", | |
| 131 "//build/config/compiler:no_chromium_code", | 90 "//build/config/compiler:no_chromium_code", |
| 132 "//build/config/compiler:rtti", | 91 "//build/config/compiler:rtti", |
| 133 "//build/config/sanitizers:sanitizer_options_link_helper", | 92 "//build/config/sanitizers:sanitizer_options_link_helper", |
| 134 ] | 93 ] |
| 135 defines = [ "_LIBCPP_BUILDING_LIBRARY" ] | 94 defines = [ "_LIBCPP_BUILDING_LIBRARY" ] |
| 136 | 95 |
| 137 deps = [ | 96 deps = [ |
| 138 "//buildtools/third_party/libc++abi", | 97 "//buildtools/third_party/libc++abi", |
| 139 ] | 98 ] |
| 140 } | 99 } |
| 141 | |
| 142 group("libcxx_proxy") { | |
| 143 deps = [ | |
| 144 ":libc++", | |
| 145 ] | |
| 146 public_configs = [ ":no_libstdcpp" ] | |
| 147 } | |
| OLD | NEW |