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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 "-fPIC", | 275 "-fPIC", |
276 "-pipe", # Use pipes for communicating between sub-processes. Faster. | 276 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
277 ] | 277 ] |
278 | 278 |
279 ldflags += [ | 279 ldflags += [ |
280 "-fPIC", | 280 "-fPIC", |
281 "-Wl,-z,noexecstack", | 281 "-Wl,-z,noexecstack", |
282 "-Wl,-z,now", | 282 "-Wl,-z,now", |
283 "-Wl,-z,relro", | 283 "-Wl,-z,relro", |
284 ] | 284 ] |
285 if (!using_sanitizer && !use_cfi_diag) { | 285 if (!using_sanitizer) { |
286 ldflags += [ "-Wl,-z,defs" ] | 286 if (!use_cfi_diag) { |
| 287 ldflags += [ "-Wl,-z,defs" ] |
| 288 } |
| 289 |
| 290 # Functions interposed by the sanitizers can make ld think |
| 291 # that some libraries aren't needed when they actually are, |
| 292 # http://crbug.com/234010. As workaround, disable --as-needed. |
| 293 if (!is_nacl && !is_android) { |
| 294 # TODO(pcc): Fix linker bug which requires us to link pthread |
| 295 # unconditionally here (crbug.com/623236). |
| 296 ldflags += [ |
| 297 "-Wl,--no-as-needed", |
| 298 "-lpthread", |
| 299 ] |
| 300 } |
| 301 ldflags += [ "-Wl,--as-needed" ] |
287 } | 302 } |
288 } | 303 } |
289 | 304 |
290 # Linux-specific compiler flags setup. | 305 # Linux-specific compiler flags setup. |
291 # ------------------------------------ | 306 # ------------------------------------ |
292 if (is_posix && use_lld && !is_nacl) { | 307 if (is_posix && use_lld && !is_nacl) { |
293 ldflags += [ "-fuse-ld=lld" ] | 308 ldflags += [ "-fuse-ld=lld" ] |
294 } else if (use_gold) { | 309 } else if (use_gold) { |
295 ldflags += [ "-fuse-ld=gold" ] | 310 ldflags += [ "-fuse-ld=gold" ] |
296 if (is_android) { | 311 if (is_android) { |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 "-fdata-sections", | 1285 "-fdata-sections", |
1271 "-ffunction-sections", | 1286 "-ffunction-sections", |
1272 ] | 1287 ] |
1273 | 1288 |
1274 common_optimize_on_ldflags += [ | 1289 common_optimize_on_ldflags += [ |
1275 # Specifically tell the linker to perform optimizations. | 1290 # Specifically tell the linker to perform optimizations. |
1276 # See http://lwn.net/Articles/192624/ . | 1291 # See http://lwn.net/Articles/192624/ . |
1277 "-Wl,-O1", | 1292 "-Wl,-O1", |
1278 "-Wl,--gc-sections", | 1293 "-Wl,--gc-sections", |
1279 ] | 1294 ] |
1280 | |
1281 if (!using_sanitizer) { | |
1282 # Functions interposed by the sanitizers can make ld think | |
1283 # that some libraries aren't needed when they actually are, | |
1284 # http://crbug.com/234010. As workaround, disable --as-needed. | |
1285 if (!is_nacl && !is_android) { | |
1286 # TODO(pcc): Fix linker bug which requires us to link pthread | |
1287 # unconditionally here (crbug.com/623236). | |
1288 common_optimize_on_ldflags += [ | |
1289 "-Wl,--no-as-needed", | |
1290 "-lpthread", | |
1291 ] | |
1292 } | |
1293 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] | |
1294 } | |
1295 } | 1295 } |
1296 } | 1296 } |
1297 | 1297 |
1298 config("default_stack_frames") { | 1298 config("default_stack_frames") { |
1299 if (is_posix && !(is_mac || is_ios)) { | 1299 if (is_posix && !(is_mac || is_ios)) { |
1300 if (using_sanitizer || enable_profiling || is_debug || | 1300 if (using_sanitizer || enable_profiling || is_debug || |
1301 current_cpu == "arm64") { | 1301 current_cpu == "arm64") { |
1302 # Explicitly ask for frame pointers, otherwise: | 1302 # Explicitly ask for frame pointers, otherwise: |
1303 # * Stacks may be missing for sanitizer and profiling builds. | 1303 # * Stacks may be missing for sanitizer and profiling builds. |
1304 # * Debug tcmalloc can crash (crbug.com/636489). | 1304 # * Debug tcmalloc can crash (crbug.com/636489). |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 | 1585 |
1586 if (is_ios || is_mac) { | 1586 if (is_ios || is_mac) { |
1587 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1587 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1588 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1588 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1589 config("enable_arc") { | 1589 config("enable_arc") { |
1590 common_flags = [ "-fobjc-arc" ] | 1590 common_flags = [ "-fobjc-arc" ] |
1591 cflags_objc = common_flags | 1591 cflags_objc = common_flags |
1592 cflags_objcc = common_flags | 1592 cflags_objcc = common_flags |
1593 } | 1593 } |
1594 } | 1594 } |
OLD | NEW |