Commit 79270799 authored by Brett Wilson's avatar Brett Wilson

Generate symbols in debug GN builds.

The previous code removed symbols from clang builds based on what GYP used to
do. But GYP changed this logic when clang was set to the default. GN was then
left with clang on by default, but no symbols.

This adds some additional GYP flag parity work.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/501173002

Cr-Commit-Position: refs/heads/master@{#291803}
parent bdade7b5
......@@ -360,13 +360,7 @@ if (is_debug) {
_native_compiler_configs += [ _default_optimization_config ]
# Symbol setup.
if (is_clang && (is_linux || is_android)) {
# Clang creates chubby debug information, which makes linking very slow.
# For now, don't create debug information with clang.
# See http://crbug.com/70000
# TODO(brettw) This just copies GYP. Why not do this on Mac as well?
_default_symbols_config = "//build/config/compiler:no_symbols"
} else if (symbol_level == 2) {
if (symbol_level == 2) {
_default_symbols_config = "//build/config/compiler:symbols"
} else if (symbol_level == 1) {
_default_symbols_config = "//build/config/compiler:minimal_symbols"
......
......@@ -16,6 +16,19 @@ declare_args() {
android_full_debug = false
}
use_gold = is_linux && cpu_arch == "x64"
# linux_use_debug_fission: whether to use split DWARF debug info
# files. This can reduce link time significantly, but is incompatible
# with some utilities such as icecc and ccache. Requires gold and
# gcc >= 4.8 or clang.
# http://gcc.gnu.org/wiki/DebugFission
#
# TODO(GYP) enable this. Currently this gives errors from objcopy, presumably
# because some other symbol or toolchain setting isn't correct.
#use_debug_fission = use_gold
use_debug_fission = false
# default_include_dirs ---------------------------------------------------------
#
# This is a separate config so that third_party code (which would not use the
......@@ -182,8 +195,11 @@ config("compiler") {
# ------------------------------------
if (is_linux) {
cflags += [ "-pthread" ]
if (cpu_arch == "x64") {
ldflags += [
"-pthread",
]
}
if (use_gold) {
# Use gold for linking on 64-bit Linux only (on 32-bit it runs out of
# address space, and it doesn't support cross-compiling).
gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
......@@ -191,6 +207,11 @@ config("compiler") {
ldflags += [
"-B$gold_path",
# Newer gccs and clangs support -fuse-ld, use the flag to force gold
# selection.
# gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
"-fuse-ld=gold",
# There seems to be a conflict of --icf and -pie in gold which can
# generate crashy binaries. As a security measure, -pie takes
# precedence for now.
......@@ -210,11 +231,6 @@ config("compiler") {
]
}
ldflags += [
"-pthread",
]
}
# Clang-specific compiler flags setup.
# ------------------------------------
if (is_clang) {
......@@ -876,6 +892,9 @@ config("symbols") {
ldflags = [ "/DEBUG" ]
} else {
cflags = [ "-g2" ]
if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ]
}
}
}
......@@ -885,6 +904,9 @@ config("minimal_symbols") {
ldflags = [ "/DEBUG" ]
} else {
cflags = [ "-g1" ]
if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ]
}
}
}
......
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