OLD | NEW |
---|---|
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 import("//build/config/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
7 | 7 |
8 # compiler --------------------------------------------------------------------- | 8 # compiler --------------------------------------------------------------------- |
9 # | 9 # |
10 # Base compiler configuration. | 10 # Base compiler configuration. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 94 |
95 # CPU architecture. We may or may not be doing a cross compile now, so for | 95 # CPU architecture. We may or may not be doing a cross compile now, so for |
96 # simplicity we always explicitly set the architecture. | 96 # simplicity we always explicitly set the architecture. |
97 if (cpu_arch == "x64") { | 97 if (cpu_arch == "x64") { |
98 cflags += "-m64" | 98 cflags += "-m64" |
99 ldflags += "-m64" | 99 ldflags += "-m64" |
100 } else if (cpu_arch == "x86") { | 100 } else if (cpu_arch == "x86") { |
101 cflags += "-m32" | 101 cflags += "-m32" |
102 ldflags += "-m32" | 102 ldflags += "-m32" |
103 } | 103 } |
104 | |
105 defines += [ "_FILE_OFFSET_BITS=64" ] | |
106 | |
107 # Omit unwind support in official builds to save space. We can use breakpad | |
108 # for these builds. | |
109 if (is_chrome_branded && is_official_build) { | |
110 cflags += [ | |
111 "-fno-unwind-tables", | |
112 "-fno-asynchronous-unwind-tables", | |
113 ] | |
114 } else { | |
115 cflags += [ "-funwind-tables" ] | |
116 } | |
104 } | 117 } |
105 | 118 |
106 # Linux-specific compiler flags setup. | 119 # Linux-specific compiler flags setup. |
107 # ------------------------------------ | 120 # ------------------------------------ |
108 if (is_linux) { | 121 if (is_linux) { |
109 cflags += [ | 122 cflags += [ |
110 "-fPIC", | 123 "-fPIC", |
111 "-pipe", # Use pipes for communicating between sub-processes. Faster. | 124 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
112 ] | 125 ] |
113 if (!is_android) { | 126 if (!is_android) { |
114 cflags += [ "-pthread" ] | 127 cflags += [ "-pthread" ] |
115 } | 128 } |
116 | 129 |
117 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of | |
118 # address space, and it doesn't support cross-compiling). | |
119 if (cpu_arch == "x64") { | 130 if (cpu_arch == "x64") { |
131 # Enable libstdc++ debugging facilities to help catch problems early, see | |
132 # http://crbug.com/65151 . | |
133 # TODO(phajdan.jr): Should we enable this for all of POSIX? | |
scottmg
2014/01/10 19:58:07
indent
| |
134 defines += [ "__GLIBCXX_DEBUG=1" ] | |
135 | |
136 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of | |
137 # address space, and it doesn't support cross-compiling). | |
120 gold_path = rebase_path("//third_party/gold", ".", root_build_dir) | 138 gold_path = rebase_path("//third_party/gold", ".", root_build_dir) |
121 ldflags += [ | 139 ldflags += [ |
122 "-B$gold_path", | 140 "-B$gold_path", |
123 | 141 |
124 # There seems to be a conflict of --icf and -pie in gold which can | 142 # There seems to be a conflict of --icf and -pie in gold which can |
125 # generate crashy binaries. As a security measure, -pie takes | 143 # generate crashy binaries. As a security measure, -pie takes |
126 # precendence for now. | 144 # precendence for now. |
127 # TODO(brettw) common.gypi has this only for target toolset. | 145 # TODO(brettw) common.gypi has this only for target toolset. |
128 #"-Wl,--icf=safe", | 146 #"-Wl,--icf=safe", |
129 "-Wl,--icf=none", | 147 "-Wl,--icf=none", |
(...skipping 27 matching lines...) Expand all Loading... | |
157 "-Wl,-z,relro", | 175 "-Wl,-z,relro", |
158 ] | 176 ] |
159 } | 177 } |
160 | 178 |
161 # Clang-specific compiler flags setup. | 179 # Clang-specific compiler flags setup. |
162 # ------------------------------------ | 180 # ------------------------------------ |
163 if (is_clang) { | 181 if (is_clang) { |
164 cflags += [ | 182 cflags += [ |
165 "-fcolor-diagnostics", | 183 "-fcolor-diagnostics", |
166 ] | 184 ] |
185 cflags_cc += [ | |
186 "-std=gnu++11", | |
187 ] | |
167 } | 188 } |
168 | 189 |
169 # Android-specific flags setup. | 190 # Android-specific flags setup. |
170 # ----------------------------- | 191 # ----------------------------- |
171 if (is_android) { | 192 if (is_android) { |
172 cflags += [ | 193 cflags += [ |
173 "-ffunction-sections", | 194 "-ffunction-sections", |
174 "-funwind-tables", | 195 "-funwind-tables", |
175 "-fno-short-enums", | 196 "-fno-short-enums", |
176 ] | 197 ] |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 } else { | 617 } else { |
597 cflags = [ "-g1" ] | 618 cflags = [ "-g1" ] |
598 } | 619 } |
599 } | 620 } |
600 | 621 |
601 config("no_symbols") { | 622 config("no_symbols") { |
602 if (!is_win) { | 623 if (!is_win) { |
603 cflags = [ "-g0" ] | 624 cflags = [ "-g0" ] |
604 } | 625 } |
605 } | 626 } |
OLD | NEW |