Commit 420d3c1f authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

build: Remove sanitizer_keep_symbols and sanitizer_no_symbols flags.

As far as I can tell, both of these flags just mean "respect
symbol_level when sanitizers are enabled". This change makes it so
that we always do that, removing the need for both flags. Because
the default symbol level is 1 in sanitizer builds, we still get -g1
(which is equivalent to -gline-tables-only) by default. Users can
now adjust the symbol level simply by setting symbol_level.

Change-Id: Ied9f589c268e7e5c625b4cce46d76e51452e473b
Reviewed-on: https://chromium-review.googlesource.com/1156125Reviewed-by: default avatarOliver Chang <ochang@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579330}
parent 97d22fa5
...@@ -209,7 +209,9 @@ if (symbol_level == -1) { ...@@ -209,7 +209,9 @@ if (symbol_level == -1) {
# them off, but keep them on for Official builds and Chromecast builds. # them off, but keep them on for Official builds and Chromecast builds.
symbol_level = 2 symbol_level = 2
} else if (using_sanitizer) { } else if (using_sanitizer) {
# Sanitizers require symbols for filename suppressions to work. # Sanitizers need line table info for stack traces. They don't need type
# info or variable info, so we can leave that out to speed up the build.
# Sanitizers also require symbols for filename suppressions to work.
symbol_level = 1 symbol_level = 1
} else { } else {
symbol_level = 0 symbol_level = 0
......
...@@ -249,25 +249,16 @@ config("default_sanitizer_ldflags") { ...@@ -249,25 +249,16 @@ config("default_sanitizer_ldflags") {
config("common_sanitizer_flags") { config("common_sanitizer_flags") {
cflags = [] cflags = []
# Sanitizers need line table info for stack traces. They don't need type info
# or variable info, so we can leave that out to speed up the build (unless
# it's explicitly asked for by setting |sanitizer_keep_symbols| to true).
if (using_sanitizer) { if (using_sanitizer) {
assert(is_clang, "sanitizers only supported with clang") assert(is_clang, "sanitizers only supported with clang")
assert(!is_official_build, "sanitizers not supported in official builds") assert(!is_official_build, "sanitizers not supported in official builds")
if (!sanitizer_no_symbols) { cflags += [
if (!sanitizer_keep_symbols) { # Column info in debug data confuses Visual Studio's debugger, so don't
cflags += [ "-gline-tables-only" ] # use this by default. However, clusterfuzz needs it for good
} # attribution of reports to CLs, so turn it on there.
"-gcolumn-info",
cflags += [ ]
# Column info in debug data confuses Visual Studio's debugger, so don't
# use this by default. However, clusterfuzz needs it for good
# attribution of reports to CLs, so turn it on there.
"-gcolumn-info",
]
}
# Frame pointers are controlled in //build/config/compiler:default_stack_frames # Frame pointers are controlled in //build/config/compiler:default_stack_frames
} }
......
...@@ -102,16 +102,6 @@ declare_args() { ...@@ -102,16 +102,6 @@ declare_args() {
# Default value when unset and use_sanitizer_coverage=true: # Default value when unset and use_sanitizer_coverage=true:
# trace-pc-guard,indirect-calls # trace-pc-guard,indirect-calls
sanitizer_coverage_flags = "" sanitizer_coverage_flags = ""
# Keep symbol level when building with sanitizers. When sanitizers are
# enabled, the default is to compile with the minimum debug info level
# necessary, overriding any other symbol level arguments that may be set.
# Setting this to true prevents this.
sanitizer_keep_symbols = false
# Builds fuzzer/sanitizers without symbols. Use with symbol_level=0.
# Useful for reducing binary size when building with use_clang_coverage=true.
sanitizer_no_symbols = false
} }
# Disable sanitizers for non-default toolchains. # Disable sanitizers for non-default toolchains.
......
...@@ -33,9 +33,8 @@ Supported sanitizer configurations are: ...@@ -33,9 +33,8 @@ Supported sanitizer configurations are:
| `is_ubsan_security=true` | enables [Undefined Behavior Sanitizer] to catch<sup>\[[*](reference.md#UBSan)\]</sup> undefined behavior like integer overflow. | | `is_ubsan_security=true` | enables [Undefined Behavior Sanitizer] to catch<sup>\[[*](reference.md#UBSan)\]</sup> undefined behavior like integer overflow. |
| | it is possible to run libfuzzer without any sanitizers; *probably not what you want*.| | | it is possible to run libfuzzer without any sanitizers; *probably not what you want*.|
Fuzz targets are built with minimal symbols by default, regardless of the value Fuzz targets are built with minimal symbols by default. The symbol level
of `is_debug` and `symbol_level`. However if you want to run fuzz target under a can be adjusted in the usual way by setting `symbol_level`.
debugger you can re-enable them by setting `sanitizer_keep_symbols=true`.
To get the exact GN configuration that are used on our builders, see To get the exact GN configuration that are used on our builders, see
[Build Config]. [Build Config].
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment