Remove unused/unusable relocation packer files.
Removes:
- src/run_length_encoder.h
artifact of the original packing tool, not used here
- test_data/generate_elf_file_unittest_relocs.sh
- test_data/generate_elf_file_unittest_relocs.py
test data generation for chromium/gyp, not usable here
- README.TXT
because it is now almost entirely outdated
Change-Id: Ic4cd372647d9a365dc52833a6cc1cf66f0c95ec9
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2014 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.
|
||||
|
||||
"""Build relocation packer unit test data.
|
||||
|
||||
Uses a built relocation packer to generate 'golden' reference test data
|
||||
files for elf_file_unittests.cc.
|
||||
"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def PackArmLibraryRelocations(android_pack_relocations,
|
||||
android_objcopy,
|
||||
added_section,
|
||||
input_path,
|
||||
output_path):
|
||||
# Copy and add a 'NULL' .android.rel.dyn section for the packing tool.
|
||||
with tempfile.NamedTemporaryFile() as stream:
|
||||
stream.write('NULL')
|
||||
stream.flush()
|
||||
objcopy_command = [android_objcopy,
|
||||
'--add-section', '%s=%s' % (added_section, stream.name),
|
||||
input_path, output_path]
|
||||
subprocess.check_call(objcopy_command)
|
||||
|
||||
# Pack relocations.
|
||||
pack_command = [android_pack_relocations, output_path]
|
||||
subprocess.check_call(pack_command)
|
||||
|
||||
|
||||
def UnpackArmLibraryRelocations(android_pack_relocations,
|
||||
input_path,
|
||||
output_path):
|
||||
shutil.copy(input_path, output_path)
|
||||
|
||||
# Unpack relocations. We leave the .android.rel.dyn or .android.rela.dyn
|
||||
# in place.
|
||||
unpack_command = [android_pack_relocations, '-u', output_path]
|
||||
subprocess.check_call(unpack_command)
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
parser.add_option('--android-pack-relocations',
|
||||
help='Path to the ARM relocations packer binary')
|
||||
parser.add_option('--android-objcopy',
|
||||
help='Path to the toolchain\'s objcopy binary')
|
||||
parser.add_option('--added-section',
|
||||
choices=['.android.rel.dyn', '.android.rela.dyn'],
|
||||
help='Section to add, one of ".android.rel.dyn" or ".android.rela.dyn"')
|
||||
parser.add_option('--test-file',
|
||||
help='Path to the input test file, an unpacked ARM .so')
|
||||
parser.add_option('--unpacked-output',
|
||||
help='Path to the output file for reference unpacked data')
|
||||
parser.add_option('--packed-output',
|
||||
help='Path to the output file for reference packed data')
|
||||
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
for output in [options.unpacked_output, options.packed_output]:
|
||||
directory = os.path.dirname(output)
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
PackArmLibraryRelocations(options.android_pack_relocations,
|
||||
options.android_objcopy,
|
||||
options.added_section,
|
||||
options.test_file,
|
||||
options.packed_output)
|
||||
|
||||
UnpackArmLibraryRelocations(options.android_pack_relocations,
|
||||
options.packed_output,
|
||||
options.unpacked_output)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2014 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.
|
||||
|
||||
# Generates elf_file_unittest_relocs_arm{32,64}{,_packed}.so test data files
|
||||
# from elf_file_unittest_relocs.cc. Run once to create these test data
|
||||
# files; the files are checked into the source tree.
|
||||
#
|
||||
# To use:
|
||||
# ./generate_elf_file_unittest_relocs.sh
|
||||
# git add elf_file_unittest_relocs_arm{32,64}{,_packed}.so
|
||||
|
||||
function main() {
|
||||
local '-r' test_data_directory="$(pwd)"
|
||||
cd '../../..'
|
||||
|
||||
source tools/cr/cr-bash-helpers.sh
|
||||
local arch
|
||||
for arch in 'arm32' 'arm64'; do
|
||||
cr 'init' '--platform=android' '--type=Debug' '--architecture='"${arch}"
|
||||
cr 'build' 'relocation_packer_unittests_test_data'
|
||||
done
|
||||
|
||||
local '-r' packer='out_android/Debug/obj/tools/relocation_packer'
|
||||
local '-r' gen="${packer}/relocation_packer_unittests_test_data.gen"
|
||||
|
||||
cp "${gen}/elf_file_unittest_relocs_arm"{32,64}{,_packed}'.so' \
|
||||
"${test_data_directory}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
main
|
||||
Reference in New Issue
Block a user