Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 08e9a9ef988737dcc6eaedee39e7b0021f20df0b..d20b3333fdf3d259378345043a6a2568d1a33335 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -1381,18 +1381,22 @@ if (is_win) { |
} |
config("default_stack_frames") { |
- if (is_posix && !(is_mac || is_ios)) { |
- if (using_sanitizer || enable_profiling || is_debug || |
- current_cpu == "arm64") { |
- # Explicitly ask for frame pointers, otherwise: |
- # * Stacks may be missing for sanitizer and profiling builds. |
- # * Debug tcmalloc can crash (crbug.com/636489). |
- # * Stacks may be missing for arm64 crash dumps (crbug.com/391706). |
+ if (is_posix) { |
+ if (enabled_frame_pointers) { |
cflags = [ "-fno-omit-frame-pointer" ] |
- } else if (is_android) { |
+ } else { |
cflags = [ "-fomit-frame-pointer" ] |
} |
} |
+ # On Windows, the flag to enable framepointers "/Oy-" must always come after |
+ # the optimization flag [e.g. "/O2"]. The optimization flag is set by one of |
+ # the "optimize" configs, see rest of this file. The ordering that cflags are |
+ # applied is well-defined by the GN spec, and there is no way to ensure that |
+ # cflags set by "default_stack_frames" is applied after those set by an |
+ # "optimize" config. Similarly, there is no way to propagate state from this |
+ # config into the "optimize" config. We always apply the "/Oy-" config in the |
+ # definition for common_optimize_on_cflags definition, even though this may |
+ # not be correct. |
} |
# Default "optimization on" config. |