summaryrefslogtreecommitdiff
path: root/tools/asm-differ/diff.py
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-10-24 13:04:36 -0300
committerGitHub <noreply@github.com>2021-10-24 13:04:36 -0300
commitb2747aa8b4186034d6621e8e3eccc44d14ec27a7 (patch)
treed2f3616c1e75f7a2781043269e41521f6bb76e23 /tools/asm-differ/diff.py
parentdcf44596d2c335c1ad82ea50f7e7d934e6bc1e52 (diff)
Subrepos updates (#360)
* git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "d218cdf0" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "d218cdf0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "f5fe93d7" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "f5fe93d7" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e7a8a48c" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e7a8a48c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "d14ea084" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "d14ea084" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e243634e" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e243634e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "d1294dfa0" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "d1294dfa0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "f5fe93d75" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "f5fe93d75" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "d0cd6b397" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "d0cd6b397" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * add ExternalXMLFolder config * git subrepo pull --force tools/decomp-permuter subrepo: subdir: "tools/decomp-permuter" merged: "a20bac942" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "a20bac942" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "4f7b8393e" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "4f7b8393e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/asm-differ subrepo: subdir: "tools/asm-differ" merged: "f30d43ace" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "f30d43ace" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Remove Segment="128"
Diffstat (limited to 'tools/asm-differ/diff.py')
-rwxr-xr-xtools/asm-differ/diff.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/asm-differ/diff.py b/tools/asm-differ/diff.py
index 3a2f844a2..d7ac3f344 100755
--- a/tools/asm-differ/diff.py
+++ b/tools/asm-differ/diff.py
@@ -488,7 +488,12 @@ def get_objdump_executable(objdump_executable: Optional[str]) -> str:
if objdump_executable is not None:
return objdump_executable
- for objdump_cand in ["mips-linux-gnu-objdump", "mips64-elf-objdump"]:
+ objdump_candidates = [
+ "mips-linux-gnu-objdump",
+ "mips64-elf-objdump",
+ "mips-elf-objdump",
+ ]
+ for objdump_cand in objdump_candidates:
try:
subprocess.check_call(
[objdump_cand, "--version"],
@@ -502,7 +507,7 @@ def get_objdump_executable(objdump_executable: Optional[str]) -> str:
pass
return fail(
- "Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist, or configure objdump_executable."
+ f"Missing binutils; please ensure {' or '.join(objdump_candidates)} exists, or configure objdump_executable."
)
@@ -1480,7 +1485,6 @@ ARM32_BRANCH_INSTRUCTIONS = {
}
AARCH64_BRANCH_INSTRUCTIONS = {
- "bl",
"b",
"b.eq",
"b.ne",
@@ -1534,7 +1538,7 @@ MIPS_SETTINGS = ArchSettings(
re_int=re.compile(r"[0-9]+"),
re_comment=re.compile(r"<.*?>"),
re_reg=re.compile(
- r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|k[01]|fp|ra|zero)\b"
+ r"\$?\b(a[0-7]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|kt?[01]|fp|ra|zero)\b"
),
re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"),
re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"),
@@ -1578,7 +1582,7 @@ AARCH64_SETTINGS = ArchSettings(
re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"),
re_imm=re.compile(r"(?<!sp, )#-?(0x[0-9a-fA-F]+|[0-9]+)\b"),
branch_instructions=AARCH64_BRANCH_INSTRUCTIONS,
- instructions_with_address_immediates=AARCH64_BRANCH_INSTRUCTIONS.union({"adrp"}),
+ instructions_with_address_immediates=AARCH64_BRANCH_INSTRUCTIONS.union({"bl", "adrp"}),
difference_normalizer=DifferenceNormalizerAArch64,
)
@@ -1636,6 +1640,11 @@ def parse_relocated_line(line: str) -> Tuple[str, str, str]:
def process_mips_reloc(row: str, prev: str, arch: ArchSettings) -> str:
+ if "R_MIPS_NONE" in row:
+ # GNU as emits no-op relocations immediately after real ones when
+ # assembling with -mabi=64. Return without trying to parse 'imm' as an
+ # integer.
+ return prev
before, imm, after = parse_relocated_line(prev)
repl = row.split()[-1]
if imm != "0":
@@ -2375,6 +2384,7 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff:
)
)
+ output = output[config.skip_lines :]
return Diff(lines=output, score=score)
@@ -2608,10 +2618,9 @@ class Display:
self.last_diff_output = diff_output
meta, diff_lines = align_diffs(last_diff_output, diff_output, self.config)
- diff_lines = diff_lines[self.config.skip_lines :]
output = self.config.formatter.table(meta, diff_lines)
refresh_key = (
- [[col.key2 for col in x[1:]] for x in diff_lines],
+ [line.key2 for line in diff_output.lines],
diff_output.score,
)
return (output, refresh_key)