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/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 import("//build/config/chromecast_build.gni") | 7 import("//build/config/chromecast_build.gni") |
8 import("//build/config/compiler/compiler.gni") | 8 import("//build/config/compiler/compiler.gni") |
9 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } else if (is_android) { | 165 } else if (is_android) { |
166 configs += [ "//build/config/android:compiler" ] | 166 configs += [ "//build/config/android:compiler" ] |
167 } else if (is_linux) { | 167 } else if (is_linux) { |
168 configs += [ "//build/config/linux:compiler" ] | 168 configs += [ "//build/config/linux:compiler" ] |
169 } else if (is_nacl) { | 169 } else if (is_nacl) { |
170 configs += [ "//build/config/nacl:compiler" ] | 170 configs += [ "//build/config/nacl:compiler" ] |
171 } else if (is_mac) { | 171 } else if (is_mac) { |
172 configs += [ "//build/config/mac:compiler" ] | 172 configs += [ "//build/config/mac:compiler" ] |
173 } else if (is_ios) { | 173 } else if (is_ios) { |
174 configs += [ "//build/config/ios:compiler" ] | 174 configs += [ "//build/config/ios:compiler" ] |
| 175 } else if (current_os == "aix") { |
| 176 configs += [ "//build/config/aix:compiler" ] |
175 } | 177 } |
176 | 178 |
177 # See the definitions below. | 179 # See the definitions below. |
178 configs += [ | 180 configs += [ |
179 ":compiler_cpu_abi", | 181 ":compiler_cpu_abi", |
180 ":compiler_codegen", | 182 ":compiler_codegen", |
181 ] | 183 ] |
182 | 184 |
183 # In general, Windows is totally different, but all the other builds share | 185 # In general, Windows is totally different, but all the other builds share |
184 # some common GCC configuration. | 186 # some common GCC configuration. |
185 if (!is_win) { | 187 if (!is_win) { |
186 # Common GCC compiler flags setup. | 188 # Common GCC compiler flags setup. |
187 # -------------------------------- | 189 # -------------------------------- |
188 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 | 190 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 |
189 cflags_cc += [ | 191 |
190 # Not exporting C++ inline functions can generally be applied anywhere | 192 # Visibility attribute is not supported on AIX. |
191 # so we do so here. Normal function visibility is controlled by | 193 if (current_os != "aix") { |
192 # //build/config/gcc:symbol_visibility_hidden. | 194 cflags_cc += [ |
193 "-fvisibility-inlines-hidden", | 195 # Not exporting C++ inline functions can generally be applied anywhere |
194 ] | 196 # so we do so here. Normal function visibility is controlled by |
| 197 # //build/config/gcc:symbol_visibility_hidden. |
| 198 "-fvisibility-inlines-hidden", |
| 199 ] |
| 200 } |
195 | 201 |
196 # Stack protection. | 202 # Stack protection. |
197 if (is_mac) { | 203 if (is_mac) { |
198 # The strong variant of the stack protector significantly increases | 204 # The strong variant of the stack protector significantly increases |
199 # binary size, so only enable it in debug mode. | 205 # binary size, so only enable it in debug mode. |
200 if (is_debug) { | 206 if (is_debug) { |
201 cflags += [ "-fstack-protector-strong" ] | 207 cflags += [ "-fstack-protector-strong" ] |
202 } else { | 208 } else { |
203 cflags += [ "-fstack-protector" ] | 209 cflags += [ "-fstack-protector" ] |
204 } | 210 } |
205 } else if (is_posix && !is_chromeos && !is_nacl) { | 211 } else if (is_posix && !is_chromeos && !is_nacl) { |
206 # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. | 212 # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. |
207 # See also https://crbug.com/533294 | 213 # See also https://crbug.com/533294 |
208 cflags += [ "--param=ssp-buffer-size=4" ] | 214 cflags += [ "--param=ssp-buffer-size=4" ] |
209 | 215 |
210 # The x86 toolchain currently has problems with stack-protector. | 216 # The x86 toolchain currently has problems with stack-protector. |
211 if (is_android && current_cpu == "x86") { | 217 if (is_android && current_cpu == "x86") { |
212 cflags += [ "-fno-stack-protector" ] | 218 cflags += [ "-fno-stack-protector" ] |
213 } else { | 219 } else if (current_os != "aix") { |
| 220 # Not available on aix. |
214 cflags += [ "-fstack-protector" ] | 221 cflags += [ "-fstack-protector" ] |
215 } | 222 } |
216 } | 223 } |
217 | 224 |
218 # Linker warnings. | 225 # Linker warnings. |
219 if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && | 226 if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && |
220 !(is_android && use_order_profiling) && !is_mac && !is_ios) { | 227 !(is_android && use_order_profiling) && !is_mac && !is_ios && |
| 228 current_os != "aix") { |
221 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 229 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
222 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 | 230 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 |
223 # crbug.com/485542 | 231 # crbug.com/485542 |
224 ldflags += [ "-Wl,--fatal-warnings" ] | 232 ldflags += [ "-Wl,--fatal-warnings" ] |
225 } | 233 } |
226 } | 234 } |
227 | 235 |
228 # Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for | 236 # Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for |
229 # deterministic build. See https://crbug.com/314403 | 237 # deterministic build. See https://crbug.com/314403 |
230 if (!is_official_build) { | 238 if (!is_official_build) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 # clang-cl (used if is_win) doesn't expose this flag. | 447 # clang-cl (used if is_win) doesn't expose this flag. |
440 # Currently disabled for nacl since its toolchain lacks this flag (too old). | 448 # Currently disabled for nacl since its toolchain lacks this flag (too old). |
441 # TODO(zforman): Once nacl's toolchain is updated, remove check. | 449 # TODO(zforman): Once nacl's toolchain is updated, remove check. |
442 if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) { | 450 if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) { |
443 absolute_path = rebase_path("//.") | 451 absolute_path = rebase_path("//.") |
444 cflags += [ "-fdebug-prefix-map=$absolute_path=." ] | 452 cflags += [ "-fdebug-prefix-map=$absolute_path=." ] |
445 } | 453 } |
446 | 454 |
447 # C++11 compiler flags setup. | 455 # C++11 compiler flags setup. |
448 # --------------------------- | 456 # --------------------------- |
449 if (is_linux || is_android || (is_nacl && is_clang)) { | 457 if (is_linux || is_android || (is_nacl && is_clang) || current_os == "aix") { |
450 # gnu++11 instead of c++11 is needed because some code uses typeof() (a | 458 # gnu++11 instead of c++11 is needed because some code uses typeof() (a |
451 # GNU extension). | 459 # GNU extension). |
452 # TODO(thakis): Eventually switch this to c++11 instead, | 460 # TODO(thakis): Eventually switch this to c++11 instead, |
453 # http://crbug.com/427584 | 461 # http://crbug.com/427584 |
454 cflags_cc += [ "-std=gnu++11" ] | 462 cflags_cc += [ "-std=gnu++11" ] |
455 } else if (!is_win && !is_nacl) { | 463 } else if (!is_win && !is_nacl) { |
456 # TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu++11 | 464 # TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu++11 |
457 # or c++11; we technically don't need this toolchain any more, but there | 465 # or c++11; we technically don't need this toolchain any more, but there |
458 # are still a few buildbots using it, so until those are turned off | 466 # are still a few buildbots using it, so until those are turned off |
459 # we need the !is_nacl clause and the (is_nacl && is_clang) clause, above. | 467 # we need the !is_nacl clause and the (is_nacl && is_clang) clause, above. |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 } | 1170 } |
1163 | 1171 |
1164 # In Chromium code, we define __STDC_foo_MACROS in order to get the | 1172 # In Chromium code, we define __STDC_foo_MACROS in order to get the |
1165 # C99 macros on Mac and Linux. | 1173 # C99 macros on Mac and Linux. |
1166 defines = [ | 1174 defines = [ |
1167 "__STDC_CONSTANT_MACROS", | 1175 "__STDC_CONSTANT_MACROS", |
1168 "__STDC_FORMAT_MACROS", | 1176 "__STDC_FORMAT_MACROS", |
1169 ] | 1177 ] |
1170 | 1178 |
1171 if (!is_debug && !using_sanitizer && | 1179 if (!is_debug && !using_sanitizer && |
1172 (!is_linux || !is_clang || is_official_build)) { | 1180 (!is_linux || !is_clang || is_official_build) && |
| 1181 current_cpu != "s390x" && current_cpu != "s390" && |
| 1182 current_cpu != "ppc64" && current_cpu != "ppc64") { |
1173 # _FORTIFY_SOURCE isn't really supported by Clang now, see | 1183 # _FORTIFY_SOURCE isn't really supported by Clang now, see |
1174 # http://llvm.org/bugs/show_bug.cgi?id=16821. | 1184 # http://llvm.org/bugs/show_bug.cgi?id=16821. |
1175 # It seems to work fine with Ubuntu 12 headers though, so use it in | 1185 # It seems to work fine with Ubuntu 12 headers though, so use it in |
1176 # official builds. | 1186 # official builds. |
1177 # | 1187 # |
1178 # Non-chromium code is not guaranteed to compile cleanly with | 1188 # Non-chromium code is not guaranteed to compile cleanly with |
1179 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are | 1189 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
1180 # disabled, so only do that for Release build. | 1190 # disabled, so only do that for Release build. |
1181 defines += [ "_FORTIFY_SOURCE=2" ] | 1191 defines += [ "_FORTIFY_SOURCE=2" ] |
1182 } | 1192 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 "-Wl,--warn-shared-textrel", | 1392 "-Wl,--warn-shared-textrel", |
1383 ] | 1393 ] |
1384 } | 1394 } |
1385 } | 1395 } |
1386 | 1396 |
1387 if (is_mac || is_ios) { | 1397 if (is_mac || is_ios) { |
1388 if (symbol_level == 2) { | 1398 if (symbol_level == 2) { |
1389 # Mac dead code stripping requires symbols. | 1399 # Mac dead code stripping requires symbols. |
1390 common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] | 1400 common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] |
1391 } | 1401 } |
1392 } else { | 1402 } else if (current_os != "aix") { |
1393 # Non-Mac Posix flags. | 1403 # Non-Mac Posix flags. |
| 1404 # Aix does not support these. |
1394 | 1405 |
1395 common_optimize_on_cflags += [ | 1406 common_optimize_on_cflags += [ |
1396 # Don't emit the GCC version ident directives, they just end up in the | 1407 # Don't emit the GCC version ident directives, they just end up in the |
1397 # .comment section taking up binary size. | 1408 # .comment section taking up binary size. |
1398 "-fno-ident", | 1409 "-fno-ident", |
1399 | 1410 |
1400 # Put data and code in their own sections, so that unused symbols | 1411 # Put data and code in their own sections, so that unused symbols |
1401 # can be removed at link time with --gc-sections. | 1412 # can be removed at link time with --gc-sections. |
1402 "-fdata-sections", | 1413 "-fdata-sections", |
1403 "-ffunction-sections", | 1414 "-ffunction-sections", |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 | 1764 |
1754 if (is_ios || is_mac) { | 1765 if (is_ios || is_mac) { |
1755 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1766 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1756 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1767 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1757 config("enable_arc") { | 1768 config("enable_arc") { |
1758 common_flags = [ "-fobjc-arc" ] | 1769 common_flags = [ "-fobjc-arc" ] |
1759 cflags_objc = common_flags | 1770 cflags_objc = common_flags |
1760 cflags_objcc = common_flags | 1771 cflags_objcc = common_flags |
1761 } | 1772 } |
1762 } | 1773 } |
OLD | NEW |