summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2021-09-10 20:56:11 +0800
committer Yi Kong <yikong@google.com> 2021-09-10 21:17:45 +0800
commit8b50dea62702f01e48b94df25d51a50ae946c28c (patch)
treed5ca60358073f97cffdbf007983b101ce09efb84
parent48662b25fca2b7c0ed61cb25907417b129e1da4d (diff)
Fix arguments passed to llvm-readobj
Upstream llvm-readobj no longer accepts single dash prefix for long options. Changed to double dash. Also let the script to raise exception if rc is non-zero, to avoid getting confusing error later in the program. Test: build Bug: 197230471 Change-Id: I364f51322904431d430549f79af58f455f47e028
-rwxr-xr-xtools/check_elf_file.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py
index 1ff8e65e7a..045cb1dd71 100755
--- a/tools/check_elf_file.py
+++ b/tools/check_elf_file.py
@@ -195,10 +195,12 @@ class ELFParser(object):
@classmethod
def _read_llvm_readobj(cls, elf_file_path, header, llvm_readobj):
"""Run llvm-readobj and parse the output."""
- proc = subprocess.Popen(
- [llvm_readobj, '-dynamic-table', '-dyn-symbols', elf_file_path],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ cmd = [llvm_readobj, '--dynamic-table', '--dyn-symbols', elf_file_path]
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _ = proc.communicate()
+ rc = proc.returncode
+ if rc != 0:
+ raise subprocess.CalledProcessError(rc, cmd, out)
lines = out.splitlines()
return cls._parse_llvm_readobj(elf_file_path, header, lines)