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/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
8 import("//build/config/nacl/config.gni") | 8 import("//build/config/nacl/config.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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 # This is here so that all files get recompiled after a clang roll and | 224 # This is here so that all files get recompiled after a clang roll and |
225 # when turning clang on or off. (defines are passed via the command line, | 225 # when turning clang on or off. (defines are passed via the command line, |
226 # and build system rebuild things when their commandline changes). Nothing | 226 # and build system rebuild things when their commandline changes). Nothing |
227 # should ever read this define. | 227 # should ever read this define. |
228 defines += [ "CR_CLANG_REVISION=$clang_revision" ] | 228 defines += [ "CR_CLANG_REVISION=$clang_revision" ] |
229 } | 229 } |
230 | 230 |
231 # Non-Mac Posix compiler flags setup. | 231 # Non-Mac Posix compiler flags setup. |
232 # ----------------------------------- | 232 # ----------------------------------- |
233 if (is_posix && !(is_mac || is_ios)) { | 233 if (is_posix && !(is_mac || is_ios)) { |
234 if (enable_profiling || is_debug) { | 234 if (enable_profiling) { |
235 # Explicitly ask for frame pointers, otherwise they are omitted when | 235 # Explicitly ask for frame pointers. Otherwise they are omitted when |
236 # any optimization level is used (Android debug builds use -Os.) | 236 # any optimization level is used (and Android debug builds use -Os). |
237 # This prevents stack frames from working when profiling, and can cause | |
238 # crashes when unwinding stack frames (crbug.com/636489). | |
239 cflags += [ "-fno-omit-frame-pointer" ] | 237 cflags += [ "-fno-omit-frame-pointer" ] |
240 | |
241 if (!is_debug) { | 238 if (!is_debug) { |
242 cflags += [ "-g" ] | 239 cflags += [ "-g" ] |
243 | 240 |
244 if (enable_full_stack_frames_for_profiling) { | 241 if (enable_full_stack_frames_for_profiling) { |
245 cflags += [ | 242 cflags += [ |
246 "-fno-inline", | 243 "-fno-inline", |
247 "-fno-optimize-sibling-calls", | 244 "-fno-optimize-sibling-calls", |
248 ] | 245 ] |
249 } | 246 } |
250 } | 247 } |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 # Don't emit the GCC version ident directives, they just end up in the | 1267 # Don't emit the GCC version ident directives, they just end up in the |
1271 # .comment section taking up binary size. | 1268 # .comment section taking up binary size. |
1272 "-fno-ident", | 1269 "-fno-ident", |
1273 | 1270 |
1274 # Put data and code in their own sections, so that unused symbols | 1271 # Put data and code in their own sections, so that unused symbols |
1275 # can be removed at link time with --gc-sections. | 1272 # can be removed at link time with --gc-sections. |
1276 "-fdata-sections", | 1273 "-fdata-sections", |
1277 "-ffunction-sections", | 1274 "-ffunction-sections", |
1278 ] | 1275 ] |
1279 | 1276 |
1280 if (is_debug) { | |
1281 # Explicitly ask for frame pointers, otherwise they are omitted when | |
1282 # any optimization level is used and can cause crashes when unwinding | |
1283 # stack frames (crbug.com/636489). | |
1284 common_optimize_on_cflags += [ "-fno-omit-frame-pointer" ] | |
1285 } | |
1286 | |
1287 common_optimize_on_ldflags += [ | 1277 common_optimize_on_ldflags += [ |
1288 # Specifically tell the linker to perform optimizations. | 1278 # Specifically tell the linker to perform optimizations. |
1289 # See http://lwn.net/Articles/192624/ . | 1279 # See http://lwn.net/Articles/192624/ . |
1290 "-Wl,-O1", | 1280 "-Wl,-O1", |
1291 "-Wl,--gc-sections", | 1281 "-Wl,--gc-sections", |
1292 ] | 1282 ] |
1293 | 1283 |
1294 if (!using_sanitizer) { | 1284 if (!using_sanitizer) { |
1295 # Functions interposed by the sanitizers can make ld think | 1285 # Functions interposed by the sanitizers can make ld think |
1296 # that some libraries aren't needed when they actually are, | 1286 # that some libraries aren't needed when they actually are, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 | 1568 |
1579 if (is_ios || is_mac) { | 1569 if (is_ios || is_mac) { |
1580 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1570 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1581 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1571 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1582 config("enable_arc") { | 1572 config("enable_arc") { |
1583 common_flags = [ "-fobjc-arc" ] | 1573 common_flags = [ "-fobjc-arc" ] |
1584 cflags_objc = common_flags | 1574 cflags_objc = common_flags |
1585 cflags_objcc = common_flags | 1575 cflags_objcc = common_flags |
1586 } | 1576 } |
1587 } | 1577 } |
OLD | NEW |