Compare commits

...

1 Commits

Author SHA1 Message Date
coah
4dd2dd0546 Improve CandidateBox create with right-scroll address captures 2026-10-03 13:36:10 -05:00
5 changed files with 866 additions and 1 deletions

View File

@@ -397,7 +397,9 @@ namespace textinput {
const char* leftScrollBoundName = paneNames + 48;
const char* leftScrollPaneName = paneNames + 68;
mLeftScroll.Create(this, leftScrollPaneName, leftScrollBoundName);
mRightScroll.Create(this, paneNames + 108, paneNames + 88);
const char* rightScrollBoundName = paneNames + 88;
const char* rightScrollPaneName = paneNames + 108;
mRightScroll.Create(this, rightScrollPaneName, rightScrollBoundName);
mLeftScroll.Init();
mRightScroll.Init();
const char* windowName = scW_predictWindow;

View File

@@ -0,0 +1,188 @@
# Right-scroll address capture, 2026-10-03
Base: `d0c82cfe83c4e02d6ee9957fe34a5c2cde8dd181`, 43U only.
Branch: `agent/bittle/candidatebox-right-names`. Exactly one authorized form.
## Source-grounded hypothesis and scope
The sole production change captures the two actual right-scroll arguments
immediately before their existing Create call:
const char* rightScrollBoundName = paneNames + 88;
const char* rightScrollPaneName = paneNames + 108;
mRightScroll.Create(this, rightScrollPaneName, rightScrollBoundName);
The existing paneNames initialization, left captures, window capture, every
helper, constructor, call order and other production statement remain unchanged.
Both new locals are initialized, unshadowed, and not address-taken. No source
forcing, padding, extra allocation, raw offsets into unrelated objects,
uninitialized values, array-bound violations, assembly, volatile, compiler
flags, data declarations or symbol configuration changes were introduced.
The target computes the bounding and visible-pane addresses at create
+0x464/+0x46C, before getPaneManager, and retains them for arguments at
+0x490/+0x4A0/+0x4B0. The baseline instead computes the corresponding three
addresses at +0x498/+0x4A8/+0x4B8. This trial tests that specific lifetime;
it is not a local-order search.
scPaneNameTable is a fixed const char[132] array, not a mutable pointer variable.
Its source and target ELF objects have identical bytes at .data+0x6B4, size 132.
The original DOL independently contains the same 132 bytes at 0x8165D984.
Offsets 88 and 108 select B_prdc_scrl_Rght and P_prdc_scrl_Rght. Both records
contain 16 characters plus NUL, ending at exclusive offsets 105 and 125, within 132.
The pointer calculations capture storage addresses, not character contents.
UIButton::Create remains unchanged: getPaneManager, searchPaneComponent(pane),
searchPaneComponent(bound), searchAnmPane(pane), then setting the bound listener.
The source change preserves all argument values and observable operations.
Non-recording additions may be scheduled around the preceding listener store
without changing it, the condition register, or any pointer/content read.
Prior rt8.attempts.md:88 tested direct scroll-name arguments after removing the
shared base. data-d15.attempts.md:341 tested a full-array reference.
partial-oct2f.attempts.md:803 tested the window capture. Other inspected records
cover allocation, receiver and Init-loop forms. No specific right-pair capture
was found; historical source snapshots are unavailable, so exhaustive novelty
is not claimed. The earlier left capture was already present in this baseline.
## Frozen baseline and measured result
Cache source: parent-frozen wii-candidatebox-left-review, HEAD
`791865aac94388ec175372982a4e8543389c3d4c`, tree
`8216868fbd230fc69c806247d8b283ac15ef0682`, identical to the selected base tree.
All 1027 inherited source objects were checked against that frozen cache.
A real baseline compile and complete official report reproduced the reference
exactly before the sole candidate compile.
- create fuzzy: 94.59091 -> 95.99148%.
- Unit fuzzy: 99.61933 -> 99.7015%.
- Baseline: 1416 bytes / 354 instructions / frame 0x30 /save/restore r25-r31.
- Candidate: 1424 bytes / 356 instructions / frame 0x30 /save/restore r25-r31.
- Original target: 1408 bytes / 352 instructions / frame 0x20 /save/restore r26-r31.
- Exact functions 109/112, matched code 19988/24000, exact data 4652/4652,
unit link status and every sibling metric remain unchanged.
The extra two instructions are a real code-size cost. The existing 16-byte
frame excess remains. Neither exact matching nor acceptance follows from the
fuzzy gain. Four earlier structural excess instructions remain: two Init-loop
address additions and two separate shared-data-base materializations.
Source SHA256 before/after:
`936ab4742caa71293284a33425f73321f172dc5b563cc215c7f213ddd3bef3e3`
`0e66ae8a498610825923bddf1a9df1904bb5513a7e7a44cd031b01ee0c04aa23`.
Object SHA256 before/after:
`31106c95cfcd2e8274f43ee2b5eb51be9861e577a5d967a96e667766feb71200`
`3baa124ace040d28f7790fd73e31a20a749f7380b9794f88c51a42bdd4cac8c5`.
## Exhaustive instruction, CFG, lifetime and ABI proof
Candidate inserts addi r25,r30,0x58 at +0x474 and addi r26,r30,0x6C at +0x47C.
Baseline instructions below +0x474 keep their offsets; baseline+0x474 moves by 4;
all baseline instructions from +0x478 onward move by 8. The interleaved listener
store is otherwise unchanged.
Exactly five existing instructions change:
- Baseline+0x478 beq0x480 becomes candidate+0x480 beq0x488.
- Baseline+0x498/+0x4A8/+0x4B8 additions become candidate+0x4A0/+0x4B0/+0x4C0
moves from r26/r25/r26, respectively.
- Baseline+0x518 beq0x520 becomes candidate+0x520 beq0x528.
Every other instruction is identical under the location map. Every branch
source/target pair is checked, including the two adjusted continuations, and
the entire direct/indirect call sequence is unchanged. The fixed r30 table base
was established at+0x29C from the unchanged .data base and remains unmodified.
New addresses survive intervening calls under the same callee-saved ABI.
The old left-bound r26 last use is+0x43C; the old left-pane r25 last use is+0x44C.
Both precede the new definitions. The new right-bound/pane last uses are
+0x4B0/+0x4C0, before the separate window-name r25 definition at+0x51C.
No blanket register renaming is used in the proof; all other register uses are
identical, and there are no baseline r25/r26 uses between these definitions.
Frame, save/restore helper targets, LR slot, GPR slots, alignment and epilogue
are unchanged. Both versions use the same six r1/r11 instructions under the
location map, with no other stack load/store, stack argument, exposed local
address or new callback-visible storage. r25-r31 save slots remain incoming-SP
minus 28 through minus 4; LR remains incoming-SP+4. Both actual helper bodies are
checked against the original Runtime object and original DOL addresses
0x815F94B8/0x815F9504. No runtime execution or stack-introspection equivalence
claim is made; this is an instruction/lifetime/ABI audit.
The original DOL SHA1 is checked. Its linked data-base setup proves the target
right names resolve to the actual array. All 320 target instruction words without
relocations compare directly with the DOL; the 32 relocated words are explicitly
excluded from that raw comparison. The two linked base-setup instructions and
five target right-name instructions are checked separately.
## Exhaustive ELF accounting
Every allocated nontext section size and byte is unchanged. Text outside
create is byte-identical under removal of the respective function slices.
Exactly four section payloads change:
- .text: 28576 -> 28584 bytes; 20906 positional common bytes differ because of
insertion/tail shift. The exact splice proof accounts for that shift.
- .rela.text: 4728 bytes unchanged in length; 338 changed bytes, solely source
offsets of 333 records moving by 8.
- .symtab: 5392 bytes unchanged in length; 134 changed bytes. Exactly 129 later
function values move by 8; only create's size changes.
- .strtab: 15521 bytes unchanged in length; 70 changed bytes for 59 private @NNNN
names advancing by 2. Every renamed symbol is STB_LOCAL/STT_OBJECT with
unchanged index, string offset, data section/offset/extent and other fields.
All 337 symbols are checked field-by-field. No symbol index, public name,
binding or visibility changes; no symbol appears or disappears. Both complete
string tables are reconstructed from symbol-name intervals, accounting for
every byte. All 752 relocations retain symbol index, type and addend; only the
333 text source offsets described above move. Their symbol targets retain
identity under the proven symbol relation. All raw nontext relocation payloads,
including .rela.data, are byte-identical. All other section payloads, including
.comment and .shstrtab, are byte-identical. ELF/file offsets after .text and
file size advance by 8, and every header field change is checked explicitly.
An initial proof assumption that every code-target addend was zero failed on
seven existing .rela.data jump-table entries into CandidateScrollAnmPane's
onAnmEvent. That failure is preserved. These are unchanged, bounded intra-function
addends 192/228/332/296/400/468/500 in the unchanged 524-byte sibling function;
the corrected proof checks the same function, addend, size and instruction
bytes at each destination. This is not ignored relocation drift.
## Validation and reproduction
- All_source rebuilt the other 1026 objects, with no further candidate compile.
- Full default build and progress/build/43U/ok pass; main.dol SHA1 remains
`26116613f624061ba99c8d1a299aaa6efa85670d`.
- All 1026 other object hashes and entire official unit records equal baseline.
- All 109 exact functions independently compare at zero instruction differences.
- Fresh final report equals the immutable candidate report. Within the owned
unit only create's fuzzy score and the text/unit fuzzy aggregates change.
- Pool: 57 identical strings. An initial wrong-path read-only invocation was
corrected; its error did not run any compiler or change inputs.
- Literal advisory: 111 functions/27 arguments pass, zero candidates/errors.
It explicitly skips create because target/candidate sizes differ. The complete
instruction map plus source/target/original-DOL address and byte proof above
supply separate argument evidence; the tool skip is not concealed.
- git diff --check passes; production diff is exactly three insertions and one
deletion at the right-scroll call. No shared tools or flags were changed.
Read-only reproduction from this leaf:
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=../local-tools ../.venv/bin/python \
tools/decomp-assist/verify_tiCandidateBox_right_names.py \
../candidatebox-right-names-evidence/baseline.o \
build/43U/src/src/keyboard/tiCandidateBox.o \
--target build/43U/obj/src/keyboard/tiCandidateBox.o \
--runtime build/43U/src/libs/Runtime/src/runtime.o \
--original-runtime build/43U/obj/libs/Runtime/src/runtime.o \
--original-dol orig/43U/00000008.app \
--details ../candidatebox-right-names-evidence/exhaustive-proof.json
Evidence: ../candidatebox-right-names-evidence/ contains immutable sources,
objects, full reports, patch, compile logs, full build, original proof failure,
corrected exhaustive proof, and final-verification.json. Original binaries are
not committed. Exactly one baseline and one candidate were compiled; no further
source form or remote action occurred.
GATE: strict fuzzy gain with unchanged exact/data/link/sibling measures;
extra 8 code bytes and inherited larger frame explicitly disclosed. Candidate
is frozen for independent parent review, not an exact-match or score-only
acceptance claim.

View File

@@ -0,0 +1,112 @@
# Right-name compatibility on 5af01fa8, 2026-10-03
This is a separate current-baseline proof. The original source candidate,
commit c9c1491f, d0 evidence and verify_tiCandidateBox_right_names.py remain
unchanged. No new production form or compiler trial was performed here.
External PR1131 merged as 5af01fa8b9ed69e08d153b6ecb6aae4eb43e9efb. Its production
diff adds two inline geometry helpers and changes CalcPaneLocate_; create and
the pane-name declarations are unchanged. The external log is
`tools/decomp-assist/a23h.attempts.md`. Its historical measurements are not
substituted for current verification.
## Completed inputs
Parent supplied two completed full-build/progress/43U-ok inputs. Sources,
objects, full reports and all 1027 source-object hashes were immediately
snapshotted into `../candidatebox-right-names-5af-evidence/`, with before/after
identity checks and a snapshot-manifest.json. Both linked DOL hashes were
independently read as 26116613f624061ba99c8d1a299aaa6efa85670d.
- Baseline: wii-ipl, HEAD 5af01fa8b9ed69e08d153b6ecb6aae4eb43e9efb,
tree 895cd2c434b0d88403cd3b8a9bc601ddd2d802ae
- Candidate: wii-candidatebox-right-review,
HEAD 376d425a7393b9dfe6a381df9d0e3a751ae06f80,
tree 7f65657881fece903ac51173fa4802691449efe0
- Baseline source SHA256:
318b7768c0b35d2e0f785c655aae39183a7aa61e44abb76bf2e70f7df2899f1c
- Candidate source SHA256:
b3677b0adccaf52b31b3abb4514f4174cf14be775820e7aa84805faa0b5f9b7d
- Baseline object SHA256:
6f9055cfa4b93bb03d9013f13e9569eff6ec36cbab02bf21af56b7b9cd87866d
- Candidate object SHA256:
b3a52f551c2ac0f28f5580a332789e837446b5bd139512989bd2e020f09c85e4
The new verifier pins both current object and source hashes. It proves that
the candidate source is exactly the current source with the previously approved
right-pair three-line replacement. No external geometry edit is removed,
reinterpreted or excluded from sibling verification.
## Current result and complete accounting
create remains 94.59091 -> 95.99148%; unit 99.6285 -> 99.71067%.
Current exact functions 110/112, matched code 21728/24000, data 4652/4652 and link
status are unchanged. Both baseline and candidate independently compare all
110 exact functions with the original, including CalcPaneLocate_ at
435 instructions and zero differences. All 1026 other object hashes and whole
official unit records match. Only create and the text/unit fuzzy aggregates
change within the owned unit.
The exact instruction/lifetime/CFG/ABI proof is rerun on current inputs:
- Two inserted address additions; five changed existing instructions
- Same preserved branch continuations and all direct/indirect calls
- Same nonoverlapping left/right/window value lifetimes and fixed-array names
- Same frame 0x30, helper targets, stack references and save/restore bodies
- Baseline 354 -> candidate 356 instructions; target 352 and frame 0x20
- Source/target/original-DOL name bytes, address calculations and actual helper
bodies checked, with the original raw-word relocation exclusions preserved
All 337 current symbols and 752 current relocations are rechecked. Exactly
59 private object names advance by 2, no symbol indices change, 129 later
function values advance by 8 and 333 text relocation offsets advance by 8.
Every allocated nontext byte and every raw nontext relocation payload remains
identical. Current text outside create, including the externally changed
geometry body, is byte-identical under the eight-byte shift.
Changed payloads, independently derived for the current pair:
- .text: 28576 -> 28584 bytes, 20906 positional common-byte differences
- .rela.text: 4728 bytes, 338 differing bytes
- .symtab: 5392 bytes, 134 differing bytes
- .strtab: 15521 bytes, 75 differing bytes
The current .strtab difference is 75 bytes, not the historical 70. This is
explicitly pinned and reconstructed byte-for-byte from all symbol-name
intervals; no private-label difference is ignored. All other sections,
including .comment, remain identical. Full section-header/file-offset changes
are checked. The seven bounded sibling jump-table addends are checked against
the unchanged current function/addend/instruction destinations.
Pool has 57 identical strings. The current candidate's literal advisory checks
111 functions/27 arguments with zero candidates/errors and explicitly skips
create for differing sizes. Its arguments are covered by the complete
instruction and original-array proof. The advisory used private snapshot
copies, not the parent's mutable build paths.
The parent reported an earlier historical verifier invocation while its build
was still in progress; the baseline-hash guard correctly rejected it. Parent
then completed the historical build and obtained a passing d0 proof before
rebasing. That timing error does not justify weakening either hash guard.
Parent preserves the historical successful evidence under
`validation/candidatebox-right-parent-historical-proof.log` and `.json`.
## Reproduction
From a checkout containing both verification helpers, use immutable completed
input snapshots:
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=../local-tools ../.venv/bin/python \
tools/decomp-assist/verify_tiCandidateBox_right_names_5af.py \
../candidatebox-right-names-5af-evidence/baseline.o \
../candidatebox-right-names-5af-evidence/candidate.o \
--target build/43U/obj/src/keyboard/tiCandidateBox.o \
--runtime build/43U/src/libs/Runtime/src/runtime.o \
--original-runtime build/43U/obj/libs/Runtime/src/runtime.o \
--original-dol orig/43U/00000008.app \
--evidence ../candidatebox-right-names-5af-evidence \
--details ../candidatebox-right-names-5af-evidence/exhaustive-proof.json
GATE: current-baseline compatibility proof passes with strict create fuzzy gain,
all 110 exact functions preserved, unchanged data/link/siblings and the same
disclosed code-size/frame costs. Independent parent review remains required.
No additional compilation, production edit, parent-path mutation or remote
action was performed for this compatibility audit.

View File

@@ -0,0 +1,252 @@
#!/usr/bin/env python3
"""Read-only proof for the single right-scroll address-capture candidate.
Use the project venv with PYTHONPATH=../local-tools. No input is modified.
"""
import argparse
import hashlib
import json
import re
import struct
from pathlib import Path
from capstone import Cs, CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN
from odiff import dis, sym
from verify_tiCandidateBox_window_name import read_object, changes
FUNCTION = "create__Q39textinput12candidatebox12LayoutByNW4RFP12MEMAllocator"
BASE_SHA = "31106c95cfcd2e8274f43ee2b5eb51be9861e577a5d967a96e667766feb71200"
CANDIDATE_SHA = "3baa124ace040d28f7790fd73e31a20a749f7380b9794f88c51a42bdd4cac8c5"
DOL_SHA1 = "26116613f624061ba99c8d1a299aaa6efa85670d"
def location(offset):
return offset + 4 * (offset >= 0x474) + 4 * (offset >= 0x478)
def dol_read(dol, address, size):
matches = []
for off_base, address_base, size_base, count in [(0, 0x48, 0x90, 7), (0x1C, 0x64, 0xAC, 11)]:
for i in range(count):
offset, start, extent = [struct.unpack_from(">I", dol, base + 4 * i)[0]
for base in (off_base, address_base, size_base)]
if start <= address and address + size <= start + extent:
matches.append(dol[offset + address - start:offset + address - start + size])
assert len(matches) == 1 and len(matches[0]) == size
return matches[0]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("baseline", type=Path)
parser.add_argument("candidate", type=Path)
parser.add_argument("--target", required=True, type=Path)
parser.add_argument("--runtime", required=True, type=Path)
parser.add_argument("--original-runtime", required=True, type=Path)
parser.add_argument("--original-dol", required=True, type=Path)
parser.add_argument("--details", type=Path)
args = parser.parse_args()
assert hashlib.sha256(args.baseline.read_bytes()).hexdigest() == BASE_SHA
assert hashlib.sha256(args.candidate.read_bytes()).hexdigest() == CANDIDATE_SHA
ah, asecs, asyms, arels = read_object(args.baseline)
bh, bsecs, bsyms, brels = read_object(args.candidate)
_, tsecs, tsyms, trels = read_object(args.target)
assert asecs.keys() == bsecs.keys() and len(asyms) == len(bsyms) == 337
owner = next(s for s in asyms if s["name"] == FUNCTION)
start = owner["st_value"]
# All symbol fields and indices are accounted. Only private object names,
# this function's size, and later function positions may change.
renamed, shifted, symbol_proof = [], [], []
for old, new in zip(asyms, bsyms):
expected = dict(old)
if re.fullmatch(r"@\d+", old["name"]):
assert old["st_info"] == {"bind": "STB_LOCAL", "type": "STT_OBJECT"}
assert old["section"] != ".text"
expected["name"] = "@" + str(int(old["name"][1:]) + 2)
renamed.append([old["index"], old["name"], new["name"]])
if old["name"] == FUNCTION:
assert old["st_size"] == 1416
expected["st_size"] = 1424
elif old["section"] == ".text" and old["st_value"] >= start + 1416:
assert old["st_info"]["type"] == "STT_FUNC"
expected["st_value"] += 8
shifted.append(old["index"])
assert new == expected, (old, new, expected)
symbol_proof.append({"before": old, "after": new})
assert len(renamed) == 59 and len(shifted) == 129
# Reconstruct every string-table byte, including symbol name offsets.
for sections, symbols in [(asecs, asyms), (bsecs, bsyms)]:
data = sections[".strtab"]["data"]
reconstructed, covered = bytearray(len(data)), {0}
for s in symbols:
encoded, at = s["name"].encode() + b"\0", s["st_name"]
assert data[at:at + len(encoded)] == encoded
reconstructed[at:at + len(encoded)] = encoded
covered.update(range(at, at + len(encoded)))
assert bytes(reconstructed) == data and len(covered) == len(data)
relocation_proof, moved_relocations = [], []
assert arels.keys() == brels.keys()
for section in arels:
assert len(arels[section]) == len(brels[section])
for old, new in zip(arels[section], brels[section]):
expected = dict(old)
if section == ".rela.text":
relative = old["offset"] - start
expected["offset"] = start + location(relative)
assert new == expected, (section, old, new, expected)
# The checked same-index symbol relationship preserves the target,
# including unnamed section references and compiler-private labels.
before, after = asyms[old["symbol_index"]], bsyms[new["symbol_index"]]
assert before["section"] == after["section"]
if before["section"] == ".text":
assert before["st_info"]["type"] == "STT_FUNC"
if before["name"] == FUNCTION:
assert old["addend"] == 0
else:
assert before["st_size"] == after["st_size"]
assert 0 <= old["addend"] < before["st_size"]
at = before["st_value"] + old["addend"]
bt = after["st_value"] + new["addend"]
assert asecs[".text"]["data"][at:at + 4] == bsecs[".text"]["data"][bt:bt + 4]
if old["offset"] != new["offset"]:
moved_relocations.append([old["offset"], new["offset"]])
relocation_proof.append({"section": section, "before": old, "after": new,
"target_before": before, "target_after": after})
assert len(relocation_proof) == 752
assert all(y - x == 8 for x, y in moved_relocations)
section_changes, header_changes = {}, {}
for name in asecs:
a, b = asecs[name], bsecs[name]
if a["header"]["sh_flags"] & 2 and name != ".text":
assert a["data"] == b["data"] and a["header"]["sh_size"] == b["header"]["sh_size"]
delta = changes(a["header"], b["header"])
if delta:
header_changes[name] = delta
if name == ".text":
assert delta == {"sh_size": [28576, 28584]}
else:
assert delta == {"sh_offset": [a["header"]["sh_offset"], a["header"]["sh_offset"] + 8]}
if a["data"] != b["data"]:
diffs = [[i, x, y] for i, (x, y) in enumerate(zip(a["data"], b["data"])) if x != y]
section_changes[name] = {"old_size": len(a["data"]), "new_size": len(b["data"]),
"changed_common_bytes": len(diffs), "byte_differences": diffs,
"old_tail": list(a["data"][len(b["data"]):]),
"new_tail": list(b["data"][len(a["data"]):])}
assert {k: v["changed_common_bytes"] for k, v in section_changes.items()} == {
".text": 20906, ".rela.text": 338, ".symtab": 134, ".strtab": 70}
assert changes(ah, bh) == {"e_shoff": [66064, 66072]}
assert args.candidate.stat().st_size == args.baseline.stat().st_size + 8
at, bt = asecs[".text"]["data"], bsecs[".text"]["data"]
assert at[:start] + at[start + 1416:] == bt[:start] + bt[start + 1424:]
a = dis(str(args.baseline), *sym(str(args.baseline), FUNCTION))
b = dis(str(args.candidate), *sym(str(args.candidate), FUNCTION))
target = dis(str(args.target), *sym(str(args.target), FUNCTION))
assert (len(a), len(b), len(target)) == (354, 356, 352)
inserted = {0x474: ("addi", "r25, r30, 0x58"), 0x47C: ("addi", "r26, r30, 0x6c")}
replacements = {0x478: ("beq", "0x488"), 0x498: ("mr", "r4, r26"),
0x4A8: ("mr", "r4, r25"), 0x4B8: ("mr", "r4, r26"),
0x518: ("beq", "0x528")}
expected = [None] * 356
for offset, instruction in inserted.items():
expected[offset // 4] = instruction
for i, instruction in enumerate(a):
expected[location(4 * i) // 4] = replacements.get(4 * i, instruction)
assert expected == b
branch_proof = []
for i, (mnemonic, operands) in enumerate(a):
if mnemonic.startswith("b") and mnemonic not in ("bl", "blr", "bctrl", "bctr"):
assert re.fullmatch(r"0x[0-9a-f]+", operands), (i, mnemonic, operands)
assert b[location(4 * i) // 4] == (mnemonic, hex(location(int(operands, 16))))
branch_proof.append([4 * i, location(4 * i), int(operands, 16), location(int(operands, 16))])
calls = lambda seq: [instruction for instruction in seq if instruction[0] in ("bl", "bctrl")]
assert calls(a) == calls(b)
# There is no register substitution elsewhere. New definitions occur after
# all left-name uses and end before the separate window-name definition.
old_refs = [(4 * i, instruction) for i, instruction in enumerate(a)
if re.search(r"\br25\b|\br26\b", instruction[1])]
new_refs = [(4 * i, instruction) for i, instruction in enumerate(b)
if re.search(r"\br25\b|\br26\b", instruction[1])]
assert not [x for x in old_refs if 0x450 <= x[0] < 0x514]
assert [(x, y) for x, y in new_refs if 0x450 <= x < 0x51C] == [
(0x474, inserted[0x474]), (0x47C, inserted[0x47C]),
(0x4A0, ("mr", "r4, r26")), (0x4B0, ("mr", "r4, r25")), (0x4C0, ("mr", "r4, r26"))]
assert a[0x14 // 4] == ("lis", "r29, .data+0 [reloc 6]")
assert a[0x28 // 4] == ("addi", "r29, r29, .data+0 [reloc 4]")
assert a[0x29C // 4] == ("addi", "r30, r29, 0x6b4")
assert not any(mnemonic in ("mr", "addi", "lis", "lwz", "add", "li") and operands.startswith("r30,")
for mnemonic, operands in a[0x2A0 // 4:])
assert a[0] == b[0] == ("stwu", "r1, -0x30(r1)")
assert target[0] == ("stwu", "r1, -0x20(r1)")
stack = lambda seq: [(4 * i, instruction) for i, instruction in enumerate(seq)
if re.search(r"\br1\b|\br11\b", instruction[1])]
assert stack(b) == [(location(offset), instruction) for offset, instruction in stack(a)]
assert [offset for offset, _ in stack(a)] == [0, 8, 12, 0x570, 0x578, 0x580]
helpers = {}
operands = ["r25, -0x1c(r11)", "r26, -0x18(r11)", "r27, -0x14(r11)",
"r28, -0x10(r11)", "r29, -0xc(r11)", "r30, -8(r11)", "r31, -4(r11)"]
for name, mnemonic in [("_savegpr_25", "stw"), ("_restgpr_25", "lwz")]:
helper = [(mnemonic, op) for op in operands] + [("blr", "")]
for path in [args.runtime, args.original_runtime]:
offset, _ = sym(str(path), name)
assert dis(str(path), offset, 32) == helper
helpers[name] = helper
arrays = []
for sections, symbols in [(asecs, asyms), (bsecs, bsyms), (tsecs, tsyms)]:
array = next(s for s in symbols if s["name"] == "scPaneNameTable")
assert array["section"] == ".data" and array["st_value"] == 0x6B4 and array["st_size"] == 132
data = sections[".data"]["data"][0x6B4:0x738]
assert data[88:105] == b"B_prdc_scrl_Rght\0" and data[108:125] == b"P_prdc_scrl_Rght\0"
arrays.append(data)
dol = args.original_dol.read_bytes()
assert hashlib.sha1(dol).hexdigest() == DOL_SHA1
arrays.append(dol_read(dol, 0x8165D984, 132))
assert all(data == arrays[0] for data in arrays)
target_owner = next(s for s in tsyms if s["name"] == FUNCTION)
target_start = target_owner["st_value"]
object_text = tsecs[".text"]["data"][target_start:target_start + 1408]
dol_text = dol_read(dol, 0x814288D0, 1408)
relocation_words = {(r["offset"] - target_start) & ~3 for r in trels[".rela.text"]
if target_start <= r["offset"] < target_start + 1408}
for offset in range(0, 1408, 4):
if offset not in relocation_words:
assert object_text[offset:offset + 4] == dol_text[offset:offset + 4]
md = Cs(CS_ARCH_PPC, CS_MODE_32 | CS_MODE_BIG_ENDIAN)
for name, address in [("_savegpr_25", 0x815F94B8), ("_restgpr_25", 0x815F9504)]:
actual = [(i.mnemonic, i.op_str) for i in md.disasm(dol_read(dol, address, 32), 0)]
assert actual == helpers[name]
original = {i.address: (i.mnemonic, i.op_str) for i in md.disasm(dol_text, 0)}
assert original[0x14] == ("lis", "r30, -0x7e9a")
assert original[0x28] == ("addi", "r30, r30, -0x2d30")
assert ((0x8166 << 16) - 0x2D30) == 0x8165D984 - 0x6B4
right_target = {0x464: ("addi", "r28, r30, 0x70c"), 0x46C: ("addi", "r27, r30, 0x720"),
0x490: ("mr", "r4, r27"), 0x4A0: ("mr", "r4, r28"), 0x4B0: ("mr", "r4, r27")}
for offset, instruction in right_target.items():
assert target[offset // 4] == original[offset] == instruction
result = {"verified": True, "counts": {"baseline": [1416, 354], "candidate": [1424, 356], "target": [1408, 352]},
"frames": {"baseline": 48, "candidate": 48, "target": 32},
"insertions_at_candidate_offsets": inserted, "replacements_at_baseline_offsets": replacements,
"branches": branch_proof, "unchanged_call_sequence": calls(a), "old_register_references": old_refs,
"new_register_references": new_refs, "stack_references": stack(b), "helper_bodies": helpers,
"original_dol_sha1": DOL_SHA1, "original_dol_unrelocated_instruction_words_checked": 352 - len(relocation_words),
"right_target": right_target, "pane_name_bytes": arrays[0].hex(), "pane_name_address": 0x8165D984,
"symbol_proof": symbol_proof, "private_renames": renamed, "shifted_symbols": shifted,
"relocation_proof": relocation_proof, "shifted_relocations": moved_relocations,
"section_changes": section_changes, "section_header_changes": header_changes, "elf_header_changes": changes(ah, bh),
"all_allocated_nontext_bytes_identical": True, "all_nontext_relocations_identical": True,
"all_sibling_text_identical_under_splice": True, "all_other_section_payloads_identical": True}
if args.details:
args.details.write_text(json.dumps(result, indent=2) + "\n")
print(json.dumps({"verified": True, "counts": result["counts"], "frames": result["frames"],
"private_names": len(renamed), "symbol_indices_changed": 0, "shifted_symbols": len(shifted),
"relocations_checked": len(relocation_proof), "relocations_moved": len(moved_relocations),
"changed_section_bytes": {k: v["changed_common_bytes"] for k, v in section_changes.items()},
"original_dol_unrelocated_instruction_words_checked": result["original_dol_unrelocated_instruction_words_checked"]}, indent=2))
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,311 @@
#!/usr/bin/env python3
"""Read-only compatibility proof for right-scroll capture on base 5af01fa8.
Use the project venv with PYTHONPATH=../local-tools. No input is modified.
"""
import argparse
import copy
import hashlib
import json
import re
import struct
from pathlib import Path
from capstone import Cs, CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN
from odiff import dis, sym
from verify_tiCandidateBox_window_name import read_object, changes
FUNCTION = "create__Q39textinput12candidatebox12LayoutByNW4RFP12MEMAllocator"
BASE_SHA = "6f9055cfa4b93bb03d9013f13e9569eff6ec36cbab02bf21af56b7b9cd87866d"
CANDIDATE_SHA = "b3a52f551c2ac0f28f5580a332789e837446b5bd139512989bd2e020f09c85e4"
DOL_SHA1 = "26116613f624061ba99c8d1a299aaa6efa85670d"
def location(offset):
return offset + 4 * (offset >= 0x474) + 4 * (offset >= 0x478)
def dol_read(dol, address, size):
matches = []
for off_base, address_base, size_base, count in [(0, 0x48, 0x90, 7), (0x1C, 0x64, 0xAC, 11)]:
for i in range(count):
offset, start, extent = [struct.unpack_from(">I", dol, base + 4 * i)[0]
for base in (off_base, address_base, size_base)]
if start <= address and address + size <= start + extent:
matches.append(dol[offset + address - start:offset + address - start + size])
assert len(matches) == 1 and len(matches[0]) == size
return matches[0]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("baseline", type=Path)
parser.add_argument("candidate", type=Path)
parser.add_argument("--target", required=True, type=Path)
parser.add_argument("--runtime", required=True, type=Path)
parser.add_argument("--original-runtime", required=True, type=Path)
parser.add_argument("--original-dol", required=True, type=Path)
parser.add_argument("--details", type=Path)
parser.add_argument("--evidence", required=True, type=Path, help="Completed current-base/candidate source, report, and all-object hash snapshots")
args = parser.parse_args()
assert hashlib.sha256(args.baseline.read_bytes()).hexdigest() == BASE_SHA
assert hashlib.sha256(args.candidate.read_bytes()).hexdigest() == CANDIDATE_SHA
ah, asecs, asyms, arels = read_object(args.baseline)
bh, bsecs, bsyms, brels = read_object(args.candidate)
_, tsecs, tsyms, trels = read_object(args.target)
assert asecs.keys() == bsecs.keys() and len(asyms) == len(bsyms) == 337
owner = next(s for s in asyms if s["name"] == FUNCTION)
start = owner["st_value"]
# All symbol fields and indices are accounted. Only private object names,
# this function's size, and later function positions may change.
renamed, shifted, symbol_proof = [], [], []
for old, new in zip(asyms, bsyms):
expected = dict(old)
if re.fullmatch(r"@\d+", old["name"]):
assert old["st_info"] == {"bind": "STB_LOCAL", "type": "STT_OBJECT"}
assert old["section"] != ".text"
expected["name"] = "@" + str(int(old["name"][1:]) + 2)
renamed.append([old["index"], old["name"], new["name"]])
if old["name"] == FUNCTION:
assert old["st_size"] == 1416
expected["st_size"] = 1424
elif old["section"] == ".text" and old["st_value"] >= start + 1416:
assert old["st_info"]["type"] == "STT_FUNC"
expected["st_value"] += 8
shifted.append(old["index"])
assert new == expected, (old, new, expected)
symbol_proof.append({"before": old, "after": new})
assert len(renamed) == 59 and len(shifted) == 129
# Reconstruct every string-table byte, including symbol name offsets.
for sections, symbols in [(asecs, asyms), (bsecs, bsyms)]:
data = sections[".strtab"]["data"]
reconstructed, covered = bytearray(len(data)), {0}
for s in symbols:
encoded, at = s["name"].encode() + b"\0", s["st_name"]
assert data[at:at + len(encoded)] == encoded
reconstructed[at:at + len(encoded)] = encoded
covered.update(range(at, at + len(encoded)))
assert bytes(reconstructed) == data and len(covered) == len(data)
relocation_proof, moved_relocations = [], []
assert arels.keys() == brels.keys()
for section in arels:
assert len(arels[section]) == len(brels[section])
for old, new in zip(arels[section], brels[section]):
expected = dict(old)
if section == ".rela.text":
relative = old["offset"] - start
expected["offset"] = start + location(relative)
assert new == expected, (section, old, new, expected)
# The checked same-index symbol relationship preserves the target,
# including unnamed section references and compiler-private labels.
before, after = asyms[old["symbol_index"]], bsyms[new["symbol_index"]]
assert before["section"] == after["section"]
if before["section"] == ".text":
assert before["st_info"]["type"] == "STT_FUNC"
if before["name"] == FUNCTION:
assert old["addend"] == 0
else:
assert before["st_size"] == after["st_size"]
assert 0 <= old["addend"] < before["st_size"]
at = before["st_value"] + old["addend"]
bt = after["st_value"] + new["addend"]
assert asecs[".text"]["data"][at:at + 4] == bsecs[".text"]["data"][bt:bt + 4]
if old["offset"] != new["offset"]:
moved_relocations.append([old["offset"], new["offset"]])
relocation_proof.append({"section": section, "before": old, "after": new,
"target_before": before, "target_after": after})
assert len(relocation_proof) == 752
assert all(y - x == 8 for x, y in moved_relocations)
section_changes, header_changes = {}, {}
for name in asecs:
a, b = asecs[name], bsecs[name]
if a["header"]["sh_flags"] & 2 and name != ".text":
assert a["data"] == b["data"] and a["header"]["sh_size"] == b["header"]["sh_size"]
delta = changes(a["header"], b["header"])
if delta:
header_changes[name] = delta
if name == ".text":
assert delta == {"sh_size": [28576, 28584]}
else:
assert delta == {"sh_offset": [a["header"]["sh_offset"], a["header"]["sh_offset"] + 8]}
if a["data"] != b["data"]:
diffs = [[i, x, y] for i, (x, y) in enumerate(zip(a["data"], b["data"])) if x != y]
section_changes[name] = {"old_size": len(a["data"]), "new_size": len(b["data"]),
"changed_common_bytes": len(diffs), "byte_differences": diffs,
"old_tail": list(a["data"][len(b["data"]):]),
"new_tail": list(b["data"][len(a["data"]):])}
assert {k: v["changed_common_bytes"] for k, v in section_changes.items()} == {
".text": 20906, ".rela.text": 338, ".symtab": 134, ".strtab": 75}
assert changes(ah, bh) == {"e_shoff": [66064, 66072]}
assert args.candidate.stat().st_size == args.baseline.stat().st_size + 8
at, bt = asecs[".text"]["data"], bsecs[".text"]["data"]
assert at[:start] + at[start + 1416:] == bt[:start] + bt[start + 1424:]
a = dis(str(args.baseline), *sym(str(args.baseline), FUNCTION))
b = dis(str(args.candidate), *sym(str(args.candidate), FUNCTION))
target = dis(str(args.target), *sym(str(args.target), FUNCTION))
assert (len(a), len(b), len(target)) == (354, 356, 352)
inserted = {0x474: ("addi", "r25, r30, 0x58"), 0x47C: ("addi", "r26, r30, 0x6c")}
replacements = {0x478: ("beq", "0x488"), 0x498: ("mr", "r4, r26"),
0x4A8: ("mr", "r4, r25"), 0x4B8: ("mr", "r4, r26"),
0x518: ("beq", "0x528")}
expected = [None] * 356
for offset, instruction in inserted.items():
expected[offset // 4] = instruction
for i, instruction in enumerate(a):
expected[location(4 * i) // 4] = replacements.get(4 * i, instruction)
assert expected == b
branch_proof = []
for i, (mnemonic, operands) in enumerate(a):
if mnemonic.startswith("b") and mnemonic not in ("bl", "blr", "bctrl", "bctr"):
assert re.fullmatch(r"0x[0-9a-f]+", operands), (i, mnemonic, operands)
assert b[location(4 * i) // 4] == (mnemonic, hex(location(int(operands, 16))))
branch_proof.append([4 * i, location(4 * i), int(operands, 16), location(int(operands, 16))])
calls = lambda seq: [instruction for instruction in seq if instruction[0] in ("bl", "bctrl")]
assert calls(a) == calls(b)
# There is no register substitution elsewhere. New definitions occur after
# all left-name uses and end before the separate window-name definition.
old_refs = [(4 * i, instruction) for i, instruction in enumerate(a)
if re.search(r"\br25\b|\br26\b", instruction[1])]
new_refs = [(4 * i, instruction) for i, instruction in enumerate(b)
if re.search(r"\br25\b|\br26\b", instruction[1])]
assert not [x for x in old_refs if 0x450 <= x[0] < 0x514]
assert [(x, y) for x, y in new_refs if 0x450 <= x < 0x51C] == [
(0x474, inserted[0x474]), (0x47C, inserted[0x47C]),
(0x4A0, ("mr", "r4, r26")), (0x4B0, ("mr", "r4, r25")), (0x4C0, ("mr", "r4, r26"))]
assert a[0x14 // 4] == ("lis", "r29, .data+0 [reloc 6]")
assert a[0x28 // 4] == ("addi", "r29, r29, .data+0 [reloc 4]")
assert a[0x29C // 4] == ("addi", "r30, r29, 0x6b4")
assert not any(mnemonic in ("mr", "addi", "lis", "lwz", "add", "li") and operands.startswith("r30,")
for mnemonic, operands in a[0x2A0 // 4:])
assert a[0] == b[0] == ("stwu", "r1, -0x30(r1)")
assert target[0] == ("stwu", "r1, -0x20(r1)")
stack = lambda seq: [(4 * i, instruction) for i, instruction in enumerate(seq)
if re.search(r"\br1\b|\br11\b", instruction[1])]
assert stack(b) == [(location(offset), instruction) for offset, instruction in stack(a)]
assert [offset for offset, _ in stack(a)] == [0, 8, 12, 0x570, 0x578, 0x580]
helpers = {}
operands = ["r25, -0x1c(r11)", "r26, -0x18(r11)", "r27, -0x14(r11)",
"r28, -0x10(r11)", "r29, -0xc(r11)", "r30, -8(r11)", "r31, -4(r11)"]
for name, mnemonic in [("_savegpr_25", "stw"), ("_restgpr_25", "lwz")]:
helper = [(mnemonic, op) for op in operands] + [("blr", "")]
for path in [args.runtime, args.original_runtime]:
offset, _ = sym(str(path), name)
assert dis(str(path), offset, 32) == helper
helpers[name] = helper
arrays = []
for sections, symbols in [(asecs, asyms), (bsecs, bsyms), (tsecs, tsyms)]:
array = next(s for s in symbols if s["name"] == "scPaneNameTable")
assert array["section"] == ".data" and array["st_value"] == 0x6B4 and array["st_size"] == 132
data = sections[".data"]["data"][0x6B4:0x738]
assert data[88:105] == b"B_prdc_scrl_Rght\0" and data[108:125] == b"P_prdc_scrl_Rght\0"
arrays.append(data)
dol = args.original_dol.read_bytes()
assert hashlib.sha1(dol).hexdigest() == DOL_SHA1
arrays.append(dol_read(dol, 0x8165D984, 132))
assert all(data == arrays[0] for data in arrays)
target_owner = next(s for s in tsyms if s["name"] == FUNCTION)
target_start = target_owner["st_value"]
object_text = tsecs[".text"]["data"][target_start:target_start + 1408]
dol_text = dol_read(dol, 0x814288D0, 1408)
relocation_words = {(r["offset"] - target_start) & ~3 for r in trels[".rela.text"]
if target_start <= r["offset"] < target_start + 1408}
for offset in range(0, 1408, 4):
if offset not in relocation_words:
assert object_text[offset:offset + 4] == dol_text[offset:offset + 4]
md = Cs(CS_ARCH_PPC, CS_MODE_32 | CS_MODE_BIG_ENDIAN)
for name, address in [("_savegpr_25", 0x815F94B8), ("_restgpr_25", 0x815F9504)]:
actual = [(i.mnemonic, i.op_str) for i in md.disasm(dol_read(dol, address, 32), 0)]
assert actual == helpers[name]
original = {i.address: (i.mnemonic, i.op_str) for i in md.disasm(dol_text, 0)}
assert original[0x14] == ("lis", "r30, -0x7e9a")
assert original[0x28] == ("addi", "r30, r30, -0x2d30")
assert ((0x8166 << 16) - 0x2D30) == 0x8165D984 - 0x6B4
right_target = {0x464: ("addi", "r28, r30, 0x70c"), 0x46C: ("addi", "r27, r30, 0x720"),
0x490: ("mr", "r4, r27"), 0x4A0: ("mr", "r4, r28"), 0x4B0: ("mr", "r4, r27")}
for offset, instruction in right_target.items():
assert target[offset // 4] == original[offset] == instruction
# Revalidate the exact current source hunk and current 110-function baseline.
# Historical d0 hashes and proof remain separate; no old snapshot is used as
# a substitute for the current external geometry implementation.
source_base = (args.evidence / "baseline.cpp").read_bytes()
source_candidate = (args.evidence / "candidate.cpp").read_bytes()
assert hashlib.sha256(source_base).hexdigest() == "318b7768c0b35d2e0f785c655aae39183a7aa61e44abb76bf2e70f7df2899f1c"
assert hashlib.sha256(source_candidate).hexdigest() == "b3677b0adccaf52b31b3abb4514f4174cf14be775820e7aa84805faa0b5f9b7d"
old = b" mRightScroll.Create(this, paneNames + 108, paneNames + 88);"
new = (b" const char* rightScrollBoundName = paneNames + 88;\n"
b" const char* rightScrollPaneName = paneNames + 108;\n"
b" mRightScroll.Create(this, rightScrollPaneName, rightScrollBoundName);")
assert source_base.count(old) == 1 and source_base.replace(old, new) == source_candidate
reports = [json.loads((args.evidence / (tag + "-report.json")).read_text())
for tag in ("baseline", "candidate")]
units = [{u["name"]: u for u in report["units"]} for report in reports]
assert units[0].keys() == units[1].keys() and len(units[0]) == 1027
unit = "main/src/keyboard/tiCandidateBox"
assert all(units[0][n] == units[1][n] for n in units[0] if n != unit)
before, after = units[0][unit], units[1][unit]
for u in (before, after):
assert u["measures"]["matched_functions"] == 110
assert u["measures"]["matched_code"] == "21728"
assert u["measures"]["matched_data"] == "4652"
assert [u["measures"]["fuzzy_match_percent"] for u in (before, after)] == [99.6285, 99.71067]
normalized = copy.deepcopy(after)
normalized["measures"]["fuzzy_match_percent"] = before["measures"]["fuzzy_match_percent"]
for old_function, new_function in zip(before["functions"], normalized["functions"]):
if old_function["name"] == FUNCTION:
assert (old_function["fuzzy_match_percent"], new_function["fuzzy_match_percent"]) == (94.59091, 95.99148)
new_function["fuzzy_match_percent"] = old_function["fuzzy_match_percent"]
for old_section, new_section in zip(before["sections"], normalized["sections"]):
if old_section["name"] == ".text":
new_section["fuzzy_match_percent"] = old_section["fuzzy_match_percent"]
assert normalized == before
exact = []
for f in after["functions"]:
if f["fuzzy_match_percent"] == 100:
for path in (args.baseline, args.candidate):
actual = dis(str(path), *sym(str(path), f["name"]))
original_function = dis(str(args.target), *sym(str(args.target), f["name"]))
assert actual == original_function, f["name"]
exact.append(f["name"])
geometry = "CalcPaneLocate___Q39textinput12candidatebox10UITextAreaFv"
assert geometry in exact and len(exact) == 110
objects = [json.loads((args.evidence / (tag + "-all-objects.json")).read_text())
for tag in ("baseline", "candidate")]
assert objects[0].keys() == objects[1].keys() and len(objects[0]) == 1027
owned_object = "build/43U/src/src/keyboard/tiCandidateBox.o"
assert [n for n in objects[0] if objects[0][n] != objects[1][n]] == [owned_object]
assert objects[0][owned_object] == BASE_SHA and objects[1][owned_object] == CANDIDATE_SHA
current_state = {"base": "5af01fa8b9ed69e08d153b6ecb6aae4eb43e9efb",
"candidate": "376d425a7393b9dfe6a381df9d0e3a751ae06f80",
"unchanged_exact_functions": exact, "other_unit_records_unchanged": 1026,
"other_object_hashes_unchanged": 1026, "source_hunk_exact": True,
"geometry_preserved_exact": True, "nonfuzzy_unit_fields_unchanged": True}
result = {"verified": True, "counts": {"baseline": [1416, 354], "candidate": [1424, 356], "target": [1408, 352]},
"current_state": current_state,
"frames": {"baseline": 48, "candidate": 48, "target": 32},
"insertions_at_candidate_offsets": inserted, "replacements_at_baseline_offsets": replacements,
"branches": branch_proof, "unchanged_call_sequence": calls(a), "old_register_references": old_refs,
"new_register_references": new_refs, "stack_references": stack(b), "helper_bodies": helpers,
"original_dol_sha1": DOL_SHA1, "original_dol_unrelocated_instruction_words_checked": 352 - len(relocation_words),
"right_target": right_target, "pane_name_bytes": arrays[0].hex(), "pane_name_address": 0x8165D984,
"symbol_proof": symbol_proof, "private_renames": renamed, "shifted_symbols": shifted,
"relocation_proof": relocation_proof, "shifted_relocations": moved_relocations,
"section_changes": section_changes, "section_header_changes": header_changes, "elf_header_changes": changes(ah, bh),
"all_allocated_nontext_bytes_identical": True, "all_nontext_relocations_identical": True,
"all_sibling_text_identical_under_splice": True, "all_other_section_payloads_identical": True}
if args.details:
args.details.write_text(json.dumps(result, indent=2) + "\n")
print(json.dumps({"verified": True, "current_exact_functions": len(exact), "current_geometry_preserved_exact": True,
"other_objects_and_unit_records_unchanged": 1026, "counts": result["counts"], "frames": result["frames"],
"private_names": len(renamed), "symbol_indices_changed": 0, "shifted_symbols": len(shifted),
"relocations_checked": len(relocation_proof), "relocations_moved": len(moved_relocations),
"changed_section_bytes": {k: v["changed_common_bytes"] for k, v in section_changes.items()},
"original_dol_unrelocated_instruction_words_checked": result["original_dol_unrelocated_instruction_words_checked"]}, indent=2))
if __name__ == "__main__":
main()