Commit 3ad86420 authored by sebsg's avatar sebsg Committed by Commit Bot

Revert "Implement DWARF Fission support in Chrome Android."

This reverts commit de763ddc.

Reason for revert: Causing consistent build failures on https://ci.chromium.org/p/chromium/builders/ci/chromeos-amd64-generic-cfi-thin-lto-rel See crbug.com/1040636 for more info.

Original change's description:
> Implement DWARF Fission support in Chrome Android.
> 
> - Modify some compiler build definitions to allow symbol_level=2 with
> Chrome Android 32bit, and to make the build respect use_debug_fission in
> those cases.
> - Modify "link" and "solink" tools in Android toolchain so that DWP
> files can be generated for builds with use_debug_fission.
> - Modify partitioned_shared_library template/script so that DWP files
> can be generated for partitioned libs when use_debug_fission is set.
> 
> Change-Id: I85b755302976d9675ef00c5a79f5184ecc8dbd4b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975081
> Commit-Queue: Nelson Billing <nbilling@google.com>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#729858}

TBR=thakis@chromium.org,agrieve@chromium.org,scottmg@chromium.org,nbilling@google.com

Change-Id: I3f3e446ba7ce07034301663af4d2cf0b5cd95982
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993901Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Commit-Queue: sebsg <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729884}
parent 81fe5b90
......@@ -2321,6 +2321,18 @@ config("symbols") {
# version 7 also produces debug data that is incompatible with Breakpad
# dump_syms, so this is still required (https://crbug.com/622406).
cflags += [ "-fno-standalone-debug" ]
}
if (!use_debug_fission && current_cpu == "arm") {
# dump_syms has issues with dwarf4 on arm, https://crbug.com/744956
# TODO(thakis): Remove this again once dump_syms is fixed.
#
# debug fission needs DWARF DIEs to be emitted at version 4.
# Chrome OS emits Debug Frame in DWARF2's .debug_frame v1 to make breakpad
# happy [1].
# Unless Android needs debug fission, DWARF3 is the simplest solution.
#
# [1] crrev.com/a81d5ade0b043208e06ad71a38bcf9c348a1a52f
cflags += [ "-gdwarf-3" ]
} else if (is_mac) {
# clang defaults to DWARF2 on macOS unless mac_deployment_target is
# at least 10.11.
......@@ -2338,22 +2350,17 @@ config("symbols") {
cflags += [ "-g2" ]
}
ldflags = []
if (use_debug_fission && !is_nacl) {
if (use_debug_fission && !is_nacl && !is_android) {
# NOTE: Some Chrome OS builds globally set |use_debug_fission| to true,
# but they also build some targets whose toolchains aren't
# but they also build some targets against Android toolchains which aren't
# compatible with it.
#
# TODO(https://crbug.com/837032): See if we can clean this up by e.g. not
# setting use_debug_fission globally.
cflags += [ "-gsplit-dwarf" ]
# NOTE: This flag is for use by the link wrapper scripts. They are also
# expected to remove it before sending the rest of ldflags to the actual
# linker.
ldflags += [ "--generate-dwp" ]
}
asmflags = cflags
ldflags = []
# TODO(thakis): Figure out if there's a way to make this go for 32-bit,
# currently we get "warning:
......
......@@ -225,8 +225,7 @@ if (strip_absolute_paths_from_debug_symbols_default) {
# If it wasn't manually set, set to an appropriate default.
assert(symbol_level >= -1 && symbol_level <= 2, "Invalid symbol_level")
if (symbol_level == -1) {
if (is_android && !is_component_build &&
!(use_debug_fission != "default" && use_debug_fission)) {
if (is_android && !is_component_build) {
# Reduce symbol level when it will cause invalid elf files to be created
# (due to file size). https://crbug.com/648948.
symbol_level = 1
......@@ -281,23 +280,12 @@ if (forbid_non_component_debug_builds) {
# An exception is made when target_os == "chromeos" as we only use the Android
# toolchain there to build relatively small binaries.
assert(ignore_elf32_limitations || !is_android || target_os == "chromeos" ||
is_component_build || symbol_level < 2 ||
(use_debug_fission != "default" && use_debug_fission),
is_component_build || symbol_level < 2,
"Android 32-bit non-component builds cannot have symbol_level=2 " +
"due to 4GiB file size limit, see https://crbug.com/648948. " +
"If you really want to try this out, " +
"set ignore_elf32_limitations=true.")
# Assert that we aren't simultaneously expecting ThinLTO and DWARF Fission to
# work. The way that ThinLTO is implemented in Android build will silently
# disable DWARF Fission, causing build steps that expect Fission outputs to
# break. This work should clear a path to having both enabled for Android:
# https://crbug.com/877722
assert(!is_android || !use_thin_lto || use_debug_fission == "default" ||
!use_debug_fission,
"Android builds do not yet support ThinLTO and DWARF Fission " +
"simultaneously.")
# This variable is true if the current toolchain is either the default
# toolchain, or, on Android, the secondary ABI toolchain. In other words, it's
# a toolchain that generates targets for the product, as opposed to the host
......
......@@ -30,7 +30,6 @@ def main():
required=True,
help='Stripped output file',
metavar='FILE')
parser.add_argument('--dwp', help='Path to dwp binary', metavar='FILE')
parser.add_argument('input', help='Input file')
args = parser.parse_args()
......@@ -47,13 +46,6 @@ def main():
]
subprocess.check_call(objcopy_args)
if args.dwp:
dwp_args = [
args.dwp, '-e', args.unstripped_output, '-o',
args.stripped_output + '.dwp'
]
subprocess.check_call(dwp_args)
if __name__ == '__main__':
sys.exit(main())
......@@ -3,9 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
# This template creates a set of shared libraries, by linking a single
# "partitioned" shared library, then splitting it into multiple pieces.
......@@ -104,13 +102,6 @@ template("partitioned_shared_library") {
"${invoker.partition}",
]
}
if (use_debug_fission != "default" && use_debug_fission &&
symbol_level == 2) {
dwp = rebase_path("${android_tool_prefix}dwp", root_build_dir)
args += [ "--dwp=${dwp}" ]
outputs += [ invoker.stripped_output + ".dwp" ]
}
args += [ rebase_path(sources[0], root_build_dir) ]
}
}
......
......@@ -29,8 +29,7 @@ template("android_clang_toolchain") {
# Output linker map files for binary size analysis.
enable_linker_map = true
_android_tool_prefix =
"$android_toolchain_root/bin/${invoker.binary_prefix}-"
_android_tool_prefix = "$android_toolchain_root/bin/${invoker.binary_prefix}-"
# The tools should be run relative to the build dir.
_tool_prefix = rebase_path("$_android_tool_prefix", root_build_dir)
......@@ -42,7 +41,6 @@ template("android_clang_toolchain") {
ld = cxx
readelf = _tool_prefix + "readelf"
nm = _tool_prefix + "nm"
dwp = _tool_prefix + "dwp"
strip = rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
root_build_dir)
use_unstripped_as_runtime_outputs = android_unstripped_runtime_outputs
......
......@@ -45,7 +45,6 @@ def main():
help=('Use --Wl,-Map to generate a map file. Will be '
'gzipped if extension ends with .gz'),
metavar='FILE')
parser.add_argument('--dwp', help=('The dwp binary to run'), metavar='FILE')
parser.add_argument('--output',
required=True,
help='Final output executable file',
......@@ -54,10 +53,6 @@ def main():
help='Linking command')
args = parser.parse_args()
generate_dwp = '--generate-dwp' in args.command
if generate_dwp:
args.command.remove('--generate-dwp')
# Work-around for gold being slow-by-default. http://crbug.com/632230
fast_env = dict(os.environ)
fast_env['LC_ALL'] = 'C'
......@@ -66,29 +61,12 @@ def main():
if result != 0:
return result
# If dwp is set, then package debug info for this exe.
dwp_proc = None
if generate_dwp:
if not args.dwp:
parser.error('--generate-dwp requireds --dwp')
exe_file = args.output
if args.unstripped_file:
exe_file = args.unstripped_file
dwp_proc = subprocess.Popen(
wrapper_utils.CommandToRun(
[args.dwp, '-e', exe_file, '-o', args.output + '.dwp']))
# Finally, strip the linked executable (if desired).
if args.strip:
result = subprocess.call(CommandToRun([
args.strip, '-o', args.output, args.unstripped_file
]))
if dwp_proc:
dwp_result = dwp_proc.wait()
if dwp_result != 0:
return dwp_result
return result
......
......@@ -70,7 +70,6 @@ def main():
parser.add_argument('--strip',
help='The strip binary to run',
metavar='PATH')
parser.add_argument('--dwp', help='The dwp binary to run', metavar='PATH')
parser.add_argument('--sofile',
required=True,
help='Shared object file produced by linking command',
......@@ -103,10 +102,6 @@ def main():
if link_only:
args.command.remove('--link-only')
generate_dwp = '--generate-dwp' in args.command
if generate_dwp:
args.command.remove('--generate-dwp')
# First, run the actual link.
command = wrapper_utils.CommandToRun(args.command)
result = wrapper_utils.RunLinkWithOptionalMapFile(command, env=fast_env,
......@@ -135,15 +130,6 @@ def main():
pass
return 0
# If dwp is set, then package debug info for this SO.
dwp_proc = None
if generate_dwp:
if not args.dwp:
parser.error('--generate-dwp requireds --dwp')
dwp_proc = subprocess.Popen(
wrapper_utils.CommandToRun(
[args.dwp, '-e', args.sofile, '-o', args.output + '.dwp']))
# Next, generate the contents of the TOC file.
result, toc = CollectTOC(args)
if result != 0:
......@@ -158,11 +144,6 @@ def main():
result = subprocess.call(wrapper_utils.CommandToRun(
[args.strip, '-o', args.output, args.sofile]))
if dwp_proc:
dwp_result = dwp_proc.wait()
if dwp_result != 0:
return dwp_result
return result
......
......@@ -225,11 +225,6 @@ template("gcc_toolchain") {
} else {
nm = "nm"
}
if (defined(invoker.dwp)) {
dwp = invoker.dwp
} else {
dwp = "dwp"
}
if (defined(invoker.shlib_extension)) {
default_shlib_extension = invoker.shlib_extension
......@@ -399,7 +394,7 @@ template("gcc_toolchain") {
# The host might not have a POSIX shell and utilities (e.g. Windows).
solink_wrapper =
rebase_path("//build/toolchain/gcc_solink_wrapper.py", root_build_dir)
command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\"$nm\" $strip_switch--dwp=\"${dwp}\" --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\"$map_switch --output=\"$sofile\" -- $link_command"
command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\"$nm\" $strip_switch--sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\"$map_switch --output=\"$sofile\" -- $link_command"
if (target_cpu == "mipsel" && is_component_build && is_android) {
rspfile_content = "-Wl,--start-group -Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}} -Wl,--end-group"
......@@ -531,9 +526,13 @@ template("gcc_toolchain") {
strip_switch = " --strip=\"${invoker.strip}\" --unstripped-file=\"$unstripped_outfile\""
}
link_wrapper =
rebase_path("//build/toolchain/gcc_link_wrapper.py", root_build_dir)
command = "$python_path \"$link_wrapper\" --output=\"$outfile\"$strip_switch$map_switch --dwp=\"${dwp}\" -- $link_command"
if (strip_switch != "" || map_switch != "") {
link_wrapper =
rebase_path("//build/toolchain/gcc_link_wrapper.py", root_build_dir)
command = "$python_path \"$link_wrapper\" --output=\"$outfile\"$strip_switch$map_switch -- $link_command"
} else {
command = link_command
}
description = "LINK $outfile"
rspfile_content = "{{inputs}}"
......@@ -597,7 +596,6 @@ template("clang_toolchain") {
readelf = "${toolprefix}readelf"
ar = "${prefix}/llvm-ar"
nm = "${toolprefix}nm"
dwp = "${toolprefix}dwp"
forward_variables_from(invoker,
[
......
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