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/config/nacl/config.gni") | 9 import("//build/config/nacl/config.gni") |
10 import("//build/toolchain/cc_wrapper.gni") | 10 import("//build/toolchain/cc_wrapper.gni") |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (is_win) { | 158 if (is_win) { |
159 configs += [ "//build/config/win:compiler" ] | 159 configs += [ "//build/config/win:compiler" ] |
160 } else if (is_android) { | 160 } else if (is_android) { |
161 configs += [ "//build/config/android:compiler" ] | 161 configs += [ "//build/config/android:compiler" ] |
162 } else if (is_linux) { | 162 } else if (is_linux) { |
163 configs += [ "//build/config/linux:compiler" ] | 163 configs += [ "//build/config/linux:compiler" ] |
164 } else if (is_nacl) { | 164 } else if (is_nacl) { |
165 configs += [ "//build/config/nacl:compiler" ] | 165 configs += [ "//build/config/nacl:compiler" ] |
166 } else if (is_ios || is_mac) { | 166 } else if (is_ios || is_mac) { |
167 configs += [ "//build/config/mac:compiler" ] | 167 configs += [ "//build/config/mac:compiler" ] |
| 168 } else if (current_os == "aix") { |
| 169 configs += [ "//build/config/aix:compiler" ] |
168 } | 170 } |
169 | 171 |
170 # See the definitions below. | 172 # See the definitions below. |
171 configs += [ | 173 configs += [ |
172 ":compiler_cpu_abi", | 174 ":compiler_cpu_abi", |
173 ":compiler_codegen", | 175 ":compiler_codegen", |
174 ] | 176 ] |
175 | 177 |
176 # In general, Windows is totally different, but all the other builds share | 178 # In general, Windows is totally different, but all the other builds share |
177 # some common GCC configuration. | 179 # some common GCC configuration. |
178 if (!is_win) { | 180 if (!is_win) { |
179 # Common GCC compiler flags setup. | 181 # Common GCC compiler flags setup. |
180 # -------------------------------- | 182 # -------------------------------- |
181 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 | 183 if (!is_power_or_z) { |
182 cflags_cc += [ | 184 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 |
183 # Not exporting C++ inline functions can generally be applied anywhere | 185 cflags_cc += [ |
184 # so we do so here. Normal function visibility is controlled by | 186 # Not exporting C++ inline functions can generally be applied anywhere |
185 # //build/config/gcc:symbol_visibility_hidden. | 187 # so we do so here. Normal function visibility is controlled by |
186 "-fvisibility-inlines-hidden", | 188 # //build/config/gcc:symbol_visibility_hidden. |
187 ] | 189 "-fvisibility-inlines-hidden", |
| 190 ] |
| 191 } |
188 | 192 |
189 # Stack protection. | 193 # Stack protection. |
190 if (is_mac) { | 194 if (is_mac) { |
191 # The strong variant of the stack protector significantly increases | 195 # The strong variant of the stack protector significantly increases |
192 # binary size, so only enable it in debug mode. | 196 # binary size, so only enable it in debug mode. |
193 if (is_debug) { | 197 if (is_debug) { |
194 cflags += [ "-fstack-protector-strong" ] | 198 cflags += [ "-fstack-protector-strong" ] |
195 } else { | 199 } else { |
196 cflags += [ "-fstack-protector" ] | 200 cflags += [ "-fstack-protector" ] |
197 } | 201 } |
198 } else if (is_posix && !is_chromeos && !is_nacl) { | 202 } else if (is_posix && !is_chromeos && !is_nacl) { |
199 # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. | 203 # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. |
200 # See also https://crbug.com/533294 | 204 # See also https://crbug.com/533294 |
201 cflags += [ "--param=ssp-buffer-size=4" ] | 205 cflags += [ "--param=ssp-buffer-size=4" ] |
202 | 206 |
203 # The x86 toolchain currently has problems with stack-protector. | 207 # The x86 toolchain currently has problems with stack-protector. |
204 if (is_android && current_cpu == "x86") { | 208 if (is_android && current_cpu == "x86") { |
205 cflags += [ "-fno-stack-protector" ] | 209 cflags += [ "-fno-stack-protector" ] |
206 } else { | 210 } else if (current_os != "aix") { |
| 211 # Not available on aix. |
207 cflags += [ "-fstack-protector" ] | 212 cflags += [ "-fstack-protector" ] |
208 } | 213 } |
209 } | 214 } |
210 | 215 |
211 # Linker warnings. | 216 # Linker warnings. |
212 if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && | 217 if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && |
213 !(is_android && use_order_profiling) && !is_mac && !is_ios) { | 218 !(is_android && use_order_profiling) && !is_mac && !is_ios && |
| 219 current_os != "aix") { |
214 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 220 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
215 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 | 221 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 |
216 # crbug.com/485542 | 222 # crbug.com/485542 |
217 ldflags += [ "-Wl,--fatal-warnings" ] | 223 ldflags += [ "-Wl,--fatal-warnings" ] |
218 } | 224 } |
219 } | 225 } |
220 | 226 |
221 # Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for | 227 # Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for |
222 # deterministic build. See https://crbug.com/314403 | 228 # deterministic build. See https://crbug.com/314403 |
223 if (!is_official_build) { | 229 if (!is_official_build) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 # clang-cl (used if is_win) doesn't expose this flag. | 438 # clang-cl (used if is_win) doesn't expose this flag. |
433 # Currently disabled for nacl since its toolchain lacks this flag (too old). | 439 # Currently disabled for nacl since its toolchain lacks this flag (too old). |
434 # TODO(zforman): Once nacl's toolchain is updated, remove check. | 440 # TODO(zforman): Once nacl's toolchain is updated, remove check. |
435 if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) { | 441 if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) { |
436 absolute_path = rebase_path("//.") | 442 absolute_path = rebase_path("//.") |
437 cflags += [ "-fdebug-prefix-map=$absolute_path=." ] | 443 cflags += [ "-fdebug-prefix-map=$absolute_path=." ] |
438 } | 444 } |
439 | 445 |
440 # C++11 compiler flags setup. | 446 # C++11 compiler flags setup. |
441 # --------------------------- | 447 # --------------------------- |
442 if (is_linux || is_android || (is_nacl && is_clang)) { | 448 if (is_linux || is_android || (is_nacl && is_clang) || current_os == "aix") { |
443 # gnu++11 instead of c++11 is needed because some code uses typeof() (a | 449 # gnu++11 instead of c++11 is needed because some code uses typeof() (a |
444 # GNU extension). | 450 # GNU extension). |
445 # TODO(thakis): Eventually switch this to c++11 instead, | 451 # TODO(thakis): Eventually switch this to c++11 instead, |
446 # http://crbug.com/427584 | 452 # http://crbug.com/427584 |
447 cflags_cc += [ "-std=gnu++11" ] | 453 cflags_cc += [ "-std=gnu++11" ] |
448 } else if (!is_win && !is_nacl) { | 454 } else if (!is_win && !is_nacl) { |
449 # TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu++11 | 455 # TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu++11 |
450 # or c++11; we technically don't need this toolchain any more, but there | 456 # or c++11; we technically don't need this toolchain any more, but there |
451 # are still a few buildbots using it, so until those are turned off | 457 # are still a few buildbots using it, so until those are turned off |
452 # we need the !is_nacl clause and the (is_nacl && is_clang) clause, above. | 458 # we need the !is_nacl clause and the (is_nacl && is_clang) clause, above. |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 } | 1150 } |
1145 | 1151 |
1146 # In Chromium code, we define __STDC_foo_MACROS in order to get the | 1152 # In Chromium code, we define __STDC_foo_MACROS in order to get the |
1147 # C99 macros on Mac and Linux. | 1153 # C99 macros on Mac and Linux. |
1148 defines = [ | 1154 defines = [ |
1149 "__STDC_CONSTANT_MACROS", | 1155 "__STDC_CONSTANT_MACROS", |
1150 "__STDC_FORMAT_MACROS", | 1156 "__STDC_FORMAT_MACROS", |
1151 ] | 1157 ] |
1152 | 1158 |
1153 if (!is_debug && !using_sanitizer && | 1159 if (!is_debug && !using_sanitizer && |
1154 (!is_linux || !is_clang || is_official_build)) { | 1160 (!is_linux || !is_clang || is_official_build) && !is_power_or_z) { |
1155 # _FORTIFY_SOURCE isn't really supported by Clang now, see | 1161 # _FORTIFY_SOURCE isn't really supported by Clang now, see |
1156 # http://llvm.org/bugs/show_bug.cgi?id=16821. | 1162 # http://llvm.org/bugs/show_bug.cgi?id=16821. |
1157 # It seems to work fine with Ubuntu 12 headers though, so use it in | 1163 # It seems to work fine with Ubuntu 12 headers though, so use it in |
1158 # official builds. | 1164 # official builds. |
1159 # | 1165 # |
1160 # Non-chromium code is not guaranteed to compile cleanly with | 1166 # Non-chromium code is not guaranteed to compile cleanly with |
1161 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are | 1167 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
1162 # disabled, so only do that for Release build. | 1168 # disabled, so only do that for Release build. |
1163 defines += [ "_FORTIFY_SOURCE=2" ] | 1169 defines += [ "_FORTIFY_SOURCE=2" ] |
1164 } | 1170 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 "-Wl,--warn-shared-textrel", | 1370 "-Wl,--warn-shared-textrel", |
1365 ] | 1371 ] |
1366 } | 1372 } |
1367 } | 1373 } |
1368 | 1374 |
1369 if (is_mac || is_ios) { | 1375 if (is_mac || is_ios) { |
1370 if (symbol_level == 2) { | 1376 if (symbol_level == 2) { |
1371 # Mac dead code stripping requires symbols. | 1377 # Mac dead code stripping requires symbols. |
1372 common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] | 1378 common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] |
1373 } | 1379 } |
1374 } else { | 1380 } else if (current_os != "aix") { |
1375 # Non-Mac Posix flags. | 1381 # Non-Mac Posix flags. |
| 1382 # Aix does not support these. |
1376 | 1383 |
1377 common_optimize_on_cflags += [ | 1384 common_optimize_on_cflags += [ |
1378 # Don't emit the GCC version ident directives, they just end up in the | 1385 # Don't emit the GCC version ident directives, they just end up in the |
1379 # .comment section taking up binary size. | 1386 # .comment section taking up binary size. |
1380 "-fno-ident", | 1387 "-fno-ident", |
1381 | 1388 |
1382 # Put data and code in their own sections, so that unused symbols | 1389 # Put data and code in their own sections, so that unused symbols |
1383 # can be removed at link time with --gc-sections. | 1390 # can be removed at link time with --gc-sections. |
1384 "-fdata-sections", | 1391 "-fdata-sections", |
1385 "-ffunction-sections", | 1392 "-ffunction-sections", |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 | 1738 |
1732 if (is_ios || is_mac) { | 1739 if (is_ios || is_mac) { |
1733 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1740 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1734 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1741 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1735 config("enable_arc") { | 1742 config("enable_arc") { |
1736 common_flags = [ "-fobjc-arc" ] | 1743 common_flags = [ "-fobjc-arc" ] |
1737 cflags_objc = common_flags | 1744 cflags_objc = common_flags |
1738 cflags_objcc = common_flags | 1745 cflags_objcc = common_flags |
1739 } | 1746 } |
1740 } | 1747 } |
OLD | NEW |