From 3ece56995159e719c60dc8ce0081a3a56c2bfc2f Mon Sep 17 00:00:00 2001 From: brettw Date: Tue, 16 Jun 2015 13:59:02 -0700 Subject: [PATCH] Fix some build symbol configuration. 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. Reland of https://codereview.chromium.org/1179393004/ TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1182663007 Cr-Original-Commit-Position: refs/heads/master@{#334690} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 07d847b1c5451748f16f4e7973ce8ef9078d47a2 --- common.gypi | 1 - config/compiler/BUILD.gn | 4 ++-- linux/dump_app_syms | 36 ------------------------------------ linux/dump_app_syms.py | 29 +++++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 39 deletions(-) delete mode 100755 linux/dump_app_syms create mode 100644 linux/dump_app_syms.py diff --git a/common.gypi b/common.gypi index 7c0c8fa6e..643361d13 100644 --- a/common.gypi +++ b/common.gypi @@ -3693,7 +3693,6 @@ 'cflags': [ '-O>(debug_optimize)', '-g', - '-gdwarf-4', ], 'conditions' : [ ['OS=="android" and target_arch!="mipsel" and target_arch!="mips64el"', { diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index fbf6db6ee..6e312e48b 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -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 diff --git a/linux/dump_app_syms b/linux/dump_app_syms deleted file mode 100755 index cbeb67627..000000000 --- a/linux/dump_app_syms +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2010 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. - -set -e - -usage() { - echo -n "$0 " >&2 - echo " " >&2 -} - - -if [ $# -ne 4 ]; then - usage - exit 1 -fi - -SCRIPTDIR="$(readlink -f "$(dirname "$0")")" -DUMPSYMS="$1" -STRIP_BINARY="$2" -INFILE="$3" -OUTFILE="$4" - -# Dump the symbols from the given binary. -if [ ! -e "$OUTFILE" -o "$INFILE" -nt "$OUTFILE" ]; then - "$DUMPSYMS" -r "$INFILE" > "$OUTFILE" -fi - -if [ "$STRIP_BINARY" != "0" ]; then - strip "$INFILE" -fi diff --git a/linux/dump_app_syms.py b/linux/dump_app_syms.py new file mode 100644 index 000000000..c18bff776 --- /dev/null +++ b/linux/dump_app_syms.py @@ -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 " + print " " + 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])