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

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

Issue 2023703002: Beginning work on GN build (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Really add //build. Add dart_bootstrap rule. Created 4 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 | « build/config/features.gni ('k') | build/config/ios/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/config/compiler/compiler.gni")
6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/sysroot.gni")
8 import("//build/toolchain/toolchain.gni")
9
10 # This config causes functions not to be automatically exported from shared
11 # libraries. By default, all symbols are exported but this means there are
12 # lots of exports that slow everything down. In general we explicitly mark
13 # which functiosn we want to export from components.
14 #
15 # Some third_party code assumes all functions are exported so this is separated
16 # into its own config so such libraries can remove this config to make symbols
17 # public again.
18 #
19 # See http://gcc.gnu.org/wiki/Visibility
20 config("symbol_visibility_hidden") {
21 # Note that -fvisibility-inlines-hidden is set globally in the compiler
22 # config since that can almost always be applied.
23 cflags = [ "-fvisibility=hidden" ]
24 }
25
26 # This config is usually set when :symbol_visibility_hidden is removed.
27 # It's often a good idea to set visibility explicitly, as there're flags
28 # which would error out otherwise (e.g. -fsanitize=cfi-unrelated-cast)
29 config("symbol_visibility_default") {
30 cflags = [ "-fvisibility=default" ]
31 }
32
33 # The rpath is the dynamic library search path. Setting this config on a link
34 # step will put the directory where the build generates shared libraries into
35 # the rpath.
36 #
37 # It's important that this *not* be used for release builds we push out.
38 # Chrome uses some setuid binaries, and hard links preserve setuid bits. An
39 # unprivileged user could gain root privileges by hardlinking a setuid
40 # executable and then adding in whatever binaries they want to run into the lib
41 # directory.
42 #
43 # Example bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520126
44 #
45 # This is required for component builds since the build generates many shared
46 # libraries in the build directory that we expect to be automatically loaded.
47 # It will be automatically applied in this case by :executable_ldconfig.
48 #
49 # In non-component builds, certain test binaries may expect to load dynamic
50 # libraries from the current directory. As long as these aren't distributed,
51 # this is OK. For these cases use something like this:
52 #
53 # if (is_linux && !is_component_build) {
54 # configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
55 # }
56 config("rpath_for_built_shared_libraries") {
57 if (!is_android) {
58 # Note: Android doesn't support rpath.
59 if (shlib_subdir != ".") {
60 rpath_link = "${shlib_subdir}/"
61 } else {
62 rpath_link = "."
63 }
64 ldflags = [
65 # Want to pass "\$". GN will re-escape as required for ninja.
66 "-Wl,-rpath=\$ORIGIN/${rpath_link}",
67 "-Wl,-rpath-link=${rpath_link}",
68 ]
69 }
70 }
71
72 # Settings for executables.
73 config("executable_ldconfig") {
74 ldflags = []
75 if (is_android) {
76 ldflags += [
77 "-Bdynamic",
78 "-Wl,-z,nocopyreloc",
79 ]
80 } else {
81 # See the rpath_for... config above for why this is necessary for component
82 # builds. Sanitizers use a custom libc++ where this is also necessary.
83 if (is_component_build || using_sanitizer) {
84 configs = [ ":rpath_for_built_shared_libraries" ]
85 }
86 if (current_cpu == "mipsel") {
87 ldflags += [ "-pie" ]
88 }
89 }
90
91 if (!is_android || !use_gold) {
92 # Find the path containing shared libraries for this toolchain
93 # relative to the build directory. ${root_out_dir} will be a
94 # subdirectory of ${root_build_dir} when cross compiling.
95 _rpath_link = rebase_path(root_out_dir, root_build_dir)
96 if (shlib_subdir != ".") {
97 _rpath_link += "/$shlib_subdir"
98 }
99 if (is_android) {
100 _rebased_sysroot = rebase_path(sysroot, root_build_dir)
101 _rpath_link += ":$_rebased_sysroot/usr/lib"
102 }
103
104 ldflags += [
105 "-Wl,-rpath-link=$_rpath_link",
106
107 # TODO(GYP): Do we need a check on the binutils version here?
108 #
109 # Newer binutils don't set DT_RPATH unless you disable "new" dtags
110 # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
111 "-Wl,--disable-new-dtags",
112 ]
113 }
114 }
115
116 config("no_exceptions") {
117 cflags_cc = [ "-fno-exceptions" ]
118 cflags_objcc = cflags_cc
119 }
OLDNEW
« no previous file with comments | « build/config/features.gni ('k') | build/config/ios/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698