Files
Egon Elbre ff9643525a objfile: disassemble Thumb code with a decoder generated from ARM's ISA XML
TinyGo's Cortex-M targets (pico, pico2, feather-m4, teensy40, ...) emit
Thumb-only ELFs, which the ARM-mode decoder turned into garbage — and the
function symbols carry the Thumb bit, so the code was also read one byte
off.

internal/thumbasm decodes T32: Thumb-1, Thumb-2 and the floating-point
extension (Advanced SIMD best-effort). Its table is generated by ./gen from
ARM's AArch32 ISA XML — fixed bits, fields, selection conditions, assembler
templates, decode pseudocode and the symbol value tables — and the decoder
interprets the pseudocode with a small ASL evaluator, so immediates,
shifts, register lists and branch targets follow the manual rather than a
hand-written operand table. IT blocks are tracked. Output is UAL as
llvm-objdump spells it; it matches on every instruction of six TinyGo
builds (M0+, M4F, M7, M33) and in a per-encoding fuzz against objdump.

objfile splits 32-bit ARM text by $a/$t/$d mapping symbols (or the
function symbols' Thumb bit), renders literal pools as .word data, masks
the Thumb bit off function addresses, and hands resolved branch targets to
goobj so calls link to their callee and jumps draw arrows.
2026-08-23 15:21:21 +03:00
..