Use prebuilt llvm tools
- objdump -> llvm-objdump: diff.py depends on prebuilt llvm-binutils - llvm-objdump expects long options to start with '--' Test: Manual Change-Id: I9f3986444ef2f17eb37b4b1c1c66f5c1ccb47299
This commit is contained in:
@@ -41,18 +41,16 @@ def sha1sum_without_signing_key(filepath):
|
|||||||
return hashlib.sha1(",".join(l).encode()).hexdigest()
|
return hashlib.sha1(",".join(l).encode()).hexdigest()
|
||||||
|
|
||||||
def strip_and_sha1sum(filepath):
|
def strip_and_sha1sum(filepath):
|
||||||
strip_all = lambda: silent_call(["llvm-strip", "--strip-all", "-keep-section=.ARM.attributes", filepath, "-o", filepath + ".tmp"])
|
tmp_filepath = filepath + '.tmp.no-build-id'
|
||||||
remove_build_id = lambda: silent_call(["llvm-strip", "-remove-section=.note.gnu.build-id", filepath + ".tmp", "-o", filepath + ".tmp.no-build-id"])
|
strip_all_and_remove_build_id = lambda: silent_call(["llvm-strip", "--strip-all", "--keep-section=.ARM.attributes", "--remove-section=.note.gnu.build-id", filepath, "-o", tmp_filepath])
|
||||||
try:
|
try:
|
||||||
if strip_all() and remove_build_id():
|
if strip_all_and_remove_build_id():
|
||||||
return sha1sum(filepath + ".tmp.no-build-id")
|
return sha1sum(tmp_filepath)
|
||||||
else:
|
else:
|
||||||
return sha1sum(filepath)
|
return sha1sum(filepath)
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(filepath + ".tmp"):
|
if os.path.exists(tmp_filepath):
|
||||||
os.remove(filepath + ".tmp")
|
os.remove(tmp_filepath)
|
||||||
if os.path.exists(filepath + ".tmp.no-build-id"):
|
|
||||||
os.remove(filepath + ".tmp.no-build-id")
|
|
||||||
|
|
||||||
return sha1sum(filepath)
|
return sha1sum(filepath)
|
||||||
|
|
||||||
@@ -72,7 +70,7 @@ def main(all_targets, search_paths, ignore_signing_key=False):
|
|||||||
paths = [str(path) for path in Path(target).glob('**/*') if valid_path(str(path))]
|
paths = [str(path) for path in Path(target).glob('**/*') if valid_path(str(path))]
|
||||||
|
|
||||||
def run(path):
|
def run(path):
|
||||||
is_native_component = silent_call(["objdump", "-a", path])
|
is_native_component = silent_call(["llvm-objdump", "-a", path])
|
||||||
is_apk = path.endswith('.apk')
|
is_apk = path.endswith('.apk')
|
||||||
if is_native_component:
|
if is_native_component:
|
||||||
return strip_and_sha1sum(path), path[len(target):]
|
return strip_and_sha1sum(path), path[len(target):]
|
||||||
|
|||||||
Reference in New Issue
Block a user