| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/arm.gni") | 6 import("//build/config/arm.gni") |
| 7 import("//build/config/chrome_build.gni") | 7 import("//build/config/chrome_build.gni") |
| 8 import("//build/config/chromecast_build.gni") | 8 import("//build/config/chromecast_build.gni") |
| 9 import("//build/config/compiler/pgo/pgo.gni") | 9 import("//build/config/compiler/pgo/pgo.gni") |
| 10 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//build/config/sanitizers/sanitizers.gni") |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 # Note that doing a link repro uses a lot of disk space and slows down the | 59 # Note that doing a link repro uses a lot of disk space and slows down the |
| 60 # build, so this shouldn't be enabled on too many targets. | 60 # build, so this shouldn't be enabled on too many targets. |
| 61 # | 61 # |
| 62 # See crbug.com/669854. | 62 # See crbug.com/669854. |
| 63 linkrepro_root_dir = "" | 63 linkrepro_root_dir = "" |
| 64 | 64 |
| 65 # Whether or not we should use position independent code. | 65 # Whether or not we should use position independent code. |
| 66 use_pic = true | 66 use_pic = true |
| 67 } | 67 } |
| 68 | 68 |
| 69 # Whether to emit frame pointers by default. | 69 # Determine the default setting for enable_frame_pointers, based on the platform |
| 70 # and build arguments. |
| 70 if (is_mac || is_ios) { | 71 if (is_mac || is_ios) { |
| 71 enabled_frame_pointers = true | 72 _default_enable_frame_pointers = true |
| 72 } else if (is_win) { | 73 } else if (is_win) { |
| 73 # 64-bit Windows ABI doesn't support frame pointers. | 74 # 64-bit Windows ABI doesn't support frame pointers. |
| 74 if (target_cpu == "x64") { | 75 if (target_cpu == "x64") { |
| 75 enabled_frame_pointers = false | 76 _default_enable_frame_pointers = false |
| 76 } else { | 77 } else { |
| 77 enabled_frame_pointers = true | 78 _default_enable_frame_pointers = true |
| 78 } | 79 } |
| 80 } else if (current_cpu == "arm64") { |
| 81 # Ensure that stacks from arm64 crash dumps are usable (crbug.com/391706). |
| 82 _default_enable_frame_pointers = true |
| 83 } else if (is_chromeos && current_cpu == "arm" && arm_use_thumb) { |
| 84 # TODO(711784): Building ARM Thumb without frame pointers can lead to code |
| 85 # in ChromeOS which triggers some ARM A12/A17 errata. |
| 86 _default_enable_frame_pointers = true |
| 79 } else { | 87 } else { |
| 80 # Explicitly ask for frame pointers, otherwise: | 88 # Explicitly ask for frame pointers, otherwise: |
| 81 # * Stacks may be missing for sanitizer and profiling builds. | 89 # * Stacks may be missing for sanitizer and profiling builds. |
| 82 # * Debug tcmalloc can crash (crbug.com/636489). | 90 # * Debug tcmalloc can crash (crbug.com/636489). |
| 83 # * Stacks may be missing for arm64 crash dumps (crbug.com/391706). | 91 _default_enable_frame_pointers = |
| 84 enabled_frame_pointers = | 92 using_sanitizer || enable_profiling || is_debug |
| 85 using_sanitizer || enable_profiling || is_debug || current_cpu == "arm64" | |
| 86 } | 93 } |
| 87 | 94 |
| 88 # Unwinding with frame pointers requires that they are enabled by default for | 95 declare_args() { |
| 96 # True if frame pointers should be generated, false otherwise. |
| 97 enable_frame_pointers = _default_enable_frame_pointers |
| 98 } |
| 99 |
| 100 # In general assume that if we have frame pointers then we can use them to |
| 101 # unwind the stack. However, this requires that they are enabled by default for |
| 89 # most translation units, that they are emitted correctly, and that the | 102 # most translation units, that they are emitted correctly, and that the |
| 90 # compiler or platform provides a way to access them. | 103 # compiler or platform provides a way to access them. |
| 104 can_unwind_with_frame_pointers = enable_frame_pointers |
| 91 if (current_cpu == "arm" && arm_use_thumb) { | 105 if (current_cpu == "arm" && arm_use_thumb) { |
| 92 # ARM Thumb builds do not emit frame pointers correctly. | 106 # We cannot currently unwind ARM Thumb frame pointers correctly. |
| 93 can_unwind_with_frame_pointers = false | 107 can_unwind_with_frame_pointers = false |
| 94 } else if (is_win) { | 108 } else if (is_win) { |
| 95 # Windows 32-bit does provide frame pointers, but the compiler does not | 109 # Windows 32-bit does provide frame pointers, but the compiler does not |
| 96 # provide intrinsics to access them, so we don't use them. | 110 # provide intrinsics to access them, so we don't use them. |
| 97 can_unwind_with_frame_pointers = false | 111 can_unwind_with_frame_pointers = false |
| 98 } else { | |
| 99 can_unwind_with_frame_pointers = enabled_frame_pointers | |
| 100 } | 112 } |
| 101 | 113 |
| 114 assert(!can_unwind_with_frame_pointers || enable_frame_pointers) |
| 115 |
| 102 declare_args() { | 116 declare_args() { |
| 103 # Whether or not the official builds should be built with full WPO. Enabled by | 117 # Whether or not the official builds should be built with full WPO. Enabled by |
| 104 # default for the PGO and the x64 builds. | 118 # default for the PGO and the x64 builds. |
| 105 if (chrome_pgo_phase > 0) { | 119 if (chrome_pgo_phase > 0) { |
| 106 full_wpo_on_official = true | 120 full_wpo_on_official = true |
| 107 } else { | 121 } else { |
| 108 full_wpo_on_official = false | 122 full_wpo_on_official = false |
| 109 } | 123 } |
| 110 } | 124 } |
| 111 | 125 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 175 } |
| 162 | 176 |
| 163 # Assert that the configuration isn't going to hit https://crbug.com/648948. | 177 # Assert that the configuration isn't going to hit https://crbug.com/648948. |
| 164 assert(ignore_elf32_limitations || !is_android || | 178 assert(ignore_elf32_limitations || !is_android || |
| 165 (android_64bit_target_cpu && !build_apk_secondary_abi) || | 179 (android_64bit_target_cpu && !build_apk_secondary_abi) || |
| 166 is_component_build || symbol_level < 2, | 180 is_component_build || symbol_level < 2, |
| 167 "Android 32-bit non-component builds cannot have symbol_level=2 " + | 181 "Android 32-bit non-component builds cannot have symbol_level=2 " + |
| 168 "due to 4GiB file size limit, see https://crbug.com/648948. " + | 182 "due to 4GiB file size limit, see https://crbug.com/648948. " + |
| 169 "If you really want to try this out, " + | 183 "If you really want to try this out, " + |
| 170 "set ignore_elf32_limitations=true.") | 184 "set ignore_elf32_limitations=true.") |
| OLD | NEW |