Commit 61c3f0c0 authored by Wez's avatar Wez Committed by Commit Bot

Land a fork of Fuchsia's elfinfo.py, and update runner_common to use it.

elfinfo.py is a direct fork of mcgrathr@'s implementation:
https://fuchsia.googlesource.com/packages/+/master/gn/elfinfo.py

For simplicity the runner script now uses elfinfo to strip binaries
regardless of the target architecture.

Bug: 773444
Change-Id: Ic9dcc0298b69da05dcea1e178c3539bdfa1dccbe
Reviewed-on: https://chromium-review.googlesource.com/750238
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Reviewed-by: default avatarRoland McGrath <mcgrathr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517251}
parent 71f07f2c
......@@ -50,6 +50,7 @@ template("generate_runner_script") {
]
data += [
invoker.generated_script,
"//build/fuchsia/elfinfo.py",
"//build/fuchsia/exe_runner.py",
"//build/fuchsia/test_runner.py",
"//build/fuchsia/runner_common.py",
......
This diff is collapsed.
......@@ -20,6 +20,8 @@ import tarfile
import time
import uuid
import elfinfo
DIR_SOURCE_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
......@@ -138,9 +140,11 @@ def _StripBinary(dry_run, bin_path):
"""Creates a stripped copy of the executable at |bin_path| and returns the
path to the stripped copy."""
strip_path = bin_path + '.bootfs_stripped'
_RunAndCheck(dry_run, ['/usr/bin/strip', bin_path, '-o', strip_path])
if not dry_run and not os.path.exists(strip_path):
raise Exception('strip did not create output file')
if dry_run:
print "Strip", bin_path, " to ", strip_path
else:
info = elfinfo.get_elf_info(bin_path)
info.strip(strip_path)
return strip_path
......@@ -155,8 +159,6 @@ def _StripBinaries(dry_run, file_mapping, target_cpu):
file_tag = f.read(4)
if file_tag == '\x7fELF':
symbols_mapping[target] = source
# TODO(wez): Strip ARM64 binaries as well. See crbug.com/773444.
if target_cpu == 'x64':
file_mapping[target] = _StripBinary(dry_run, source)
return symbols_mapping
......
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