
- .dwp files produced by clank build will now be output to lib.unstripped folder instead of the root out folder. This is to ensure they are in the expected place for Breakpad symbol generation and symbol archiving. Bug: 1112935 Change-Id: Id5cfb8a0188e3a6fa30fb56ed98bdb4e7da2af03 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406595 Commit-Queue: Nelson Billing <nbilling@google.com> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#809448}
60 lines
1.6 KiB
Python
Executable File
60 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright 2019 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.
|
|
"""Extracts an LLD partition from an ELF file."""
|
|
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument(
|
|
'--partition',
|
|
help='Name of partition if not the main partition',
|
|
metavar='PART')
|
|
parser.add_argument(
|
|
'--objcopy',
|
|
required=True,
|
|
help='Path to llvm-objcopy binary',
|
|
metavar='FILE')
|
|
parser.add_argument(
|
|
'--unstripped-output',
|
|
required=True,
|
|
help='Unstripped output file',
|
|
metavar='FILE')
|
|
parser.add_argument(
|
|
'--stripped-output',
|
|
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()
|
|
|
|
objcopy_args = [args.objcopy]
|
|
if args.partition:
|
|
objcopy_args += ['--extract-partition', args.partition]
|
|
else:
|
|
objcopy_args += ['--extract-main-partition']
|
|
objcopy_args += [args.input, args.unstripped_output]
|
|
subprocess.check_call(objcopy_args)
|
|
|
|
objcopy_args = [
|
|
args.objcopy, '--strip-all', args.unstripped_output, args.stripped_output
|
|
]
|
|
subprocess.check_call(objcopy_args)
|
|
|
|
if args.dwp:
|
|
dwp_args = [
|
|
args.dwp, '-e', args.unstripped_output, '-o',
|
|
args.unstripped_output + '.dwp'
|
|
]
|
|
subprocess.check_call(dwp_args)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|