Scripts: recognize LLVM AT&T listings of command record writers #3022

Open
ettehn wants to merge 1 commit from upstream-pr/3022 into main
ettehn commented 2026-11-27 13:05:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T13:05:02Z.


record_writers.py reported zero sites for an LLVM disassembly of a synthetic x64 command writer. LLVM prints movq and cmpq, adds spaces after commas, and can annotate immediates. In a linked image its address can also begin in column one.

What is in it

  • Normalize these AT&T spelling differences before the existing writer matcher. Keep movl distinct for immediate header stores.
  • Add a regression fixture alongside the existing GNU-style branch-target cases.

Tested

  • Native Windows x64, Python 3.11, LLVM 22.1.3. Assembled a synthetic x64 COFF object and linked a PE. The fixed script recognized one site in each llvm-objdump -d --no-show-raw-insn listing, with header 0x1234, length 32 bytes, bound +0x30, and fallback slot 8. The new regression test failed on 06f90c19 and passed with the change.
  • python -B -m unittest discover -s scripts -p "test_*.py" passed all 26 tests.

Regression run

  • The diff changes a Python analysis script and its test. XCL runtime files are unchanged.

Not tested

  • Full Rust/GPU suite, retail smoke, and Intel-syntax disassembly.

AI use

  • OpenAI Codex (GPT-6) assisted with diagnosis, patch, tests, and PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5527118572 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3022). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-27T13:05:02Z. --- `record_writers.py` reported zero sites for an LLVM disassembly of a synthetic x64 command writer. LLVM prints `movq` and `cmpq`, adds spaces after commas, and can annotate immediates. In a linked image its address can also begin in column one. **What is in it** - Normalize these AT&T spelling differences before the existing writer matcher. Keep `movl` distinct for immediate header stores. - Add a regression fixture alongside the existing GNU-style branch-target cases. **Tested** - Native Windows x64, Python 3.11, LLVM 22.1.3. Assembled a synthetic x64 COFF object and linked a PE. The fixed script recognized one site in each `llvm-objdump -d --no-show-raw-insn` listing, with header `0x1234`, length 32 bytes, bound `+0x30`, and fallback slot 8. The new regression test failed on `06f90c19` and passed with the change. - `python -B -m unittest discover -s scripts -p "test_*.py"` passed all 26 tests. **Regression run** - The diff changes a Python analysis script and its test. XCL runtime files are unchanged. **Not tested** - Full Rust/GPU suite, retail smoke, and Intel-syntax disassembly. **AI use** - OpenAI Codex (GPT-6) assisted with diagnosis, patch, tests, and PR description.
Foniass commented 2026-12-01 09:20:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:20:58Z.


Triage (#1607) – head 4b94672

No open or merged PR makes the same change. #2049, #1730, #1492 and #1694 also edit scripts/re/record_writers.py, but for argument handling, cursor checks, register aliases and header stores, not LLVM listings. Whichever lands later needs a small rebase.
No problems found in the diff. The module docstring still describes only GNU objdump output.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306571150 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3022#issuecomment-7306571150). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:20:58Z. --- **Triage (#1607)** – head 4b94672 No open or merged PR makes the same change. #2049, #1730, #1492 and #1694 also edit `scripts/re/record_writers.py`, but for argument handling, cursor checks, register aliases and header stores, not LLVM listings. Whichever lands later needs a small rebase. No problems found in the diff. The module docstring still describes only GNU objdump output. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Foniass commented 2026-12-01 11:01:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T11:01:16Z.


Review (head 4b94672, diff read, not a merge-check; draft, scripts/re/record_writers.py and its test):

  • Stripping # comments can create false matches on GNU listings (reasoned, not run). record_writers.py ~15 drops everything after #. GNU objdump marks RIP-relative operands with # addr <sym>, so call *0x...(%rip) now matches the fallback-slot pattern, which it didn't before. An import call before the vtable call could then report a wrong slot. A fixture with a GNU RIP-relative call would pin it.
  • ~12: \s* now also matches a line starting with a word made only of hex letters (add:). Low risk.
  • The docstring still says GNU objdump only.
  • No CI workflow runs the Python unittests, so only the author's 26 / 26 local run covers it.

Fine: the q suffix and comma clean-up are right, movl is kept, and the LLVM fixture is realistic. #2049 rewrites the same parse loop and will conflict.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7309054698 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3022#issuecomment-7309054698). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T11:01:16Z. --- Review (head 4b94672, diff read, not a merge-check; draft, `scripts/re/record_writers.py` and its test): - **Stripping `#` comments can create false matches on GNU listings** (reasoned, not run). `record_writers.py` ~15 drops everything after `#`. GNU objdump marks RIP-relative operands with `# addr <sym>`, so `call *0x...(%rip)` now matches the fallback-slot pattern, which it didn't before. An import call before the vtable call could then report a wrong slot. A fixture with a GNU RIP-relative call would pin it. - ~12: `\s*` now also matches a line starting with a word made only of hex letters (`add:`). Low risk. - The docstring still says GNU objdump only. - No CI workflow runs the Python unittests, so only the author's 26 / 26 local run covers it. Fine: the `q` suffix and comma clean-up are right, `movl` is kept, and the LLVM fixture is realistic. #2049 rewrites the same parse loop and will conflict. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3022:upstream-pr/3022'
git switch 'upstream-pr/3022'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3022'
git switch 'upstream-pr/3022'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3022'
git switch 'upstream-pr/3022'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3022'
git switch 'main'
git merge --squash 'upstream-pr/3022'
git switch 'main'
git merge --ff-only 'upstream-pr/3022'
git switch 'main'
git merge 'upstream-pr/3022'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3022
No description provided.