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

Side by Side Diff: third_party/libc++/BUILD.gn

Issue 2937433003: Make operator new/delete symbols have default visibility (Closed)
Patch Set: update comment Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
11 libcpp_is_static = !is_component_build && !using_sanitizer 11 libcpp_is_static = !is_component_build && !using_sanitizer
12 12
13 # Used by libc++ and libc++abi. 13 # Used by libc++ and libc++abi.
14 config("config") { 14 config("config") {
15 defines = [ "LIBCXX_BUILDING_LIBCXXABI" ] 15 defines = [ "LIBCXX_BUILDING_LIBCXXABI" ]
16 if (libcpp_is_static) { 16 if (libcpp_is_static) {
17 # Don't leak any symbols on a static build. 17 # Don't leak any symbols on a static build.
18 defines += [ 18 defines += [
19 "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", 19 "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
20 "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", 20 "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
21
22 # This resets the visibility to default only for the various
23 # flavors of operator new and operator delete. These symbols
24 # are weak and get overriden by Chromium-provided ones, but if
25 # these symbols had hidden visibility, this would make the
26 # Chromium symbols hidden too because elf visibility rules
27 # require that linkers use the least visible form when merging,
28 # and if this is hidden, then when we merge it with tcmalloc's
29 # operator new, hidden visibility would win. However, tcmalloc
30 # needs a visible operator new to also override operator new
31 # references from system libraries.
32 # TODO(lld): Ask lld for a --force-public-visibility flag or
33 # similar to that overrides the default elf merging rules, and
34 # make tcmalloc's gn config pass that to all its dependencies,
35 # then remove this override here.
36 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\"))) ",
21 ] 37 ]
22 } 38 }
23 cflags = [ 39 cflags = [
24 "-fPIC", 40 "-fPIC",
25 "-fstrict-aliasing", 41 "-fstrict-aliasing",
26 ] 42 ]
27 cflags_cc = [ 43 cflags_cc = [
28 "-nostdinc++", 44 "-nostdinc++",
29 "-isystem" + rebase_path("trunk/include", root_build_dir), 45 "-isystem" + rebase_path("trunk/include", root_build_dir),
30 "-isystem" + rebase_path("../libc++abi/trunk/include", root_build_dir), 46 "-isystem" + rebase_path("../libc++abi/trunk/include", root_build_dir),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 # Normally the generator takes care of RPATH. Our case is special because 151 # Normally the generator takes care of RPATH. Our case is special because
136 # the generator is unaware of the libc++.so dependency. Note that setting 152 # the generator is unaware of the libc++.so dependency. Note that setting
137 # RPATH here is a potential security issue. See the following for another 153 # RPATH here is a potential security issue. See the following for another
138 # example of this issue: https://code.google.com/p/gyp/issues/detail?id=31 5 154 # example of this issue: https://code.google.com/p/gyp/issues/detail?id=31 5
139 "-Wl,-rpath,\$ORIGIN/", 155 "-Wl,-rpath,\$ORIGIN/",
140 ] 156 ]
141 } 157 }
142 158
143 lib_dirs = [ root_build_dir ] 159 lib_dirs = [ root_build_dir ]
144 } 160 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698