Skip to content

Commit

Permalink
Fix some build symbol configuration.
Browse files Browse the repository at this point in the history
Remove -gdwarf-4 from GYP build. This is the default for GCC 4.8 which is now required, so this command-line argument is redundant.

Only set use_debug_fission in the GN build in debug mode. This matches GYP. Release mode symbols will be non-fission.

Implement linux_symbols target in GN. Convert dump_app_syms from sh to Python for better GN usability, and it's more readable for normal programmers on the team.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#334510}
  • Loading branch information
brettw authored and Commit bot committed Jun 16, 2015
1 parent 0719f99 commit 950889c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 41 deletions.
1 change: 0 additions & 1 deletion build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3693,7 +3693,6 @@
'cflags': [
'-O>(debug_optimize)',
'-g',
'-gdwarf-4',
],
'conditions' : [
['OS=="android" and target_arch!="mipsel" and target_arch!="mips64el"', {
Expand Down
4 changes: 2 additions & 2 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ declare_args() {
# with some utilities such as icecc and ccache. Requires gold and
# gcc >= 4.8 or clang.
# http://gcc.gnu.org/wiki/DebugFission
use_debug_fission =
!is_win && use_gold && linux_use_bundled_binutils && !use_ccache
use_debug_fission = is_debug && !is_win && use_gold &&
linux_use_bundled_binutils && !use_ccache

if (is_win) {
# Whether the VS xtree header has been patched to disable warning 4702. If
Expand Down
36 changes: 0 additions & 36 deletions build/linux/dump_app_syms

This file was deleted.

29 changes: 29 additions & 0 deletions build/linux/dump_app_syms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Helper script to run dump_syms on Chrome Linux executables and strip
# them if needed.

import os
import subprocess
import sys

if len(sys.argv) != 5:
print "dump_app_syms.py <dump_syms_exe> <strip_binary>"
print " <binary_with_symbols> <symbols_output>"
sys.exit(1)

dumpsyms = sys.argv[1]
strip_binary = sys.argv[2]
infile = sys.argv[3]
outfile = sys.argv[4]

# Dump only when the output file is out-of-date.
if not os.path.isfile(outfile) or \
os.stat(outfile).st_mtime > os.stat(infile).st_mtime:
with open(outfile, 'w') as outfileobj:
subprocess.check_call([dumpsyms, '-r', infile], stdout=outfileobj)

if strip_binary != '0':
subprocess.check_call(['strip', infile])
36 changes: 36 additions & 0 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -808,4 +808,40 @@ if (is_linux) {
"-e s/@@CONFDIR@@/$confdir/",
]
}

action("linux_symbols") {
script = "//build/linux/dump_app_syms"

dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
dump_syms_binary =
get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"

chrome_binary = "$root_out_dir/chrome"
if (current_cpu == "x86") {
# Use "ia32" instead of "x86" for GYP compat.
symbol_file = "$root_out_dir/chrome.breakpad.ia32"
} else {
symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
}

inputs = [
chrome_binary,
dump_syms_binary,
]
outputs = [
symbol_file,
]

args = [
rebase_path(dump_syms_binary, root_build_dir),
"0", # TODO(GYP) This is linux_strip_binary if it is needed.
rebase_path(chrome_binary, root_build_dir),
rebase_path(symbol_file, root_build_dir),
]

deps = [
":chrome",
dump_syms_label,
]
}
}
6 changes: 4 additions & 2 deletions chrome/chrome.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
['OS=="linux"',
{ 'targets': [
{
# GN version: //chrome:linux_symbols
'target_name': 'linux_symbols',
'type': 'none',
'conditions': [
Expand All @@ -357,14 +358,15 @@
{
'action_name': 'dump_symbols',
'inputs': [
'<(DEPTH)/build/linux/dump_app_syms',
'<(DEPTH)/build/linux/dump_app_syms.py',
'<(PRODUCT_DIR)/dump_syms',
'<(PRODUCT_DIR)/chrome',
],
'outputs': [
'<(PRODUCT_DIR)/chrome.breakpad.<(target_arch)',
],
'action': ['<(DEPTH)/build/linux/dump_app_syms',
'action': ['python',
'<(DEPTH)/build/linux/dump_app_syms.py',
'<(PRODUCT_DIR)/dump_syms',
'<(linux_strip_binary)',
'<(PRODUCT_DIR)/chrome',
Expand Down

0 comments on commit 950889c

Please sign in to comment.