| 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 # ASan, MSan and TSan need to override operator new, operator delete, and | 8 # ASan, MSan and TSan 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++") { |
| 92 sources = [ | 51 sources = [ |
| 93 "trunk/src/algorithm.cpp", | 52 "trunk/src/algorithm.cpp", |
| (...skipping 26 matching lines...) Expand all Loading... |
| 120 "trunk/src/valarray.cpp", | 79 "trunk/src/valarray.cpp", |
| 121 "trunk/src/variant.cpp", | 80 "trunk/src/variant.cpp", |
| 122 ] | 81 ] |
| 123 configs -= [ | 82 configs -= [ |
| 124 "//build/config/compiler:chromium_code", | 83 "//build/config/compiler:chromium_code", |
| 125 "//build/config/compiler:no_rtti", | 84 "//build/config/compiler:no_rtti", |
| 126 "//build/config/gcc:no_exceptions", | 85 "//build/config/gcc:no_exceptions", |
| 127 ] | 86 ] |
| 128 configs += [ | 87 configs += [ |
| 129 ":config", | 88 ":config", |
| 130 ":no_libstdcpp", | |
| 131 "//build/config/compiler:no_chromium_code", | 89 "//build/config/compiler:no_chromium_code", |
| 132 "//build/config/compiler:rtti", | 90 "//build/config/compiler:rtti", |
| 133 "//build/config/sanitizers:sanitizer_options_link_helper", | 91 "//build/config/sanitizers:sanitizer_options_link_helper", |
| 134 ] | 92 ] |
| 135 defines = [ "_LIBCPP_BUILDING_LIBRARY" ] | 93 defines = [ "_LIBCPP_BUILDING_LIBRARY" ] |
| 136 | 94 |
| 137 deps = [ | 95 deps = [ |
| 138 "//buildtools/third_party/libc++abi", | 96 "//buildtools/third_party/libc++abi", |
| 139 ] | 97 ] |
| 140 } | 98 } |
| 141 | |
| 142 group("libcxx_proxy") { | |
| 143 deps = [ | |
| 144 ":libc++", | |
| 145 ] | |
| 146 public_configs = [ ":no_libstdcpp" ] | |
| 147 } | |
| OLD | NEW |