Commit graph

30602 commits

Author SHA1 Message Date
Anton Kochkov
83749dfbed subprojects: update zlib to 1.3.2 2026-06-21 05:16:57 +08:00
Anton Kochkov
c5344d3c8a subprojects: update xz to 5.8.3 2026-06-21 05:16:57 +08:00
مصطفي محمود كمال الدين
59d8c998e5 fix positive zero comparing inequal with negative zero, IEEE754 mandates equality 2026-06-21 03:48:49 +08:00
Rot127
9ddf0ab9ab
Fix Leak checking workflow (#6532)
* Fix leak workflow by passing changes as file instead of env variables.
* Upload PR changes as file
2026-06-20 17:56:41 +00:00
Anton Kochkov
b9e20477fb subprojects/rizin-grammar-c: update to tree-sitter-0.26.9 2026-06-21 01:09:02 +08:00
Anton Kochkov
06840d1e6e Regenerate shell parser 2026-06-21 01:09:02 +08:00
Anton Kochkov
401efa2af4 subprojects: update tree-sitter to v0.26.9 2026-06-21 01:09:02 +08:00
NOT XVilka
51414a4eb3
sys: add simple deps update checker script (#6542)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-21 01:08:41 +08:00
NOT XVilka
c351d5f32a
librz/cons: new "underwater" color theme (#6538)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 21:57:01 +08:00
NOT XVilka
06217cd05e
librz/type: fix forward type for enums (#6539)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 17:32:06 +08:00
NOT XVilka
2e8d857e63
Fix no-return function propagation (#6449)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 05:29:18 +08:00
NOT XVilka
37d11d985a
librz/arch/tms320: add support for the TMS320C54x series (#6534)
* arch/tms320: add TMS320C54x disassembly support

Add a C54x instruction decoder that reuses the shared C55x decode engine
(c55_decode/c55_format) via the C55ArchDesc plug-in interface, rather than
duplicating the matcher/formatter. Disassembly only for now (.lift = NULL).

Engine changes (c55_ir.c/.h):
 - add C55ArchDesc.words_le so the decoder can byte-swap the little-endian
   16-bit instruction words used by the C54x COFF object format;
 - add a self-contained C54x memory-operand renderer (direct @dma, MMR,
   indirect *ARx with all post-modify modes, *ARx(lk) const-index, *(lk)
   ABS16 absolute and circular '%' addressing) and bare-hex immediates;
 - add C55Operand.circular for the '%' suffix and C55Operand.space_join
   for the space-separated second half of a C54x parallel instruction;
 - extend the data-memory operand-field analysis (register, base pointer,
   displacement, direction, referenced size) to the LOAD/STORE op types the
   C54x ld/st family uses, in addition to the C55x MOV form.

The C54x decoder (isa/tms320/c54x/c54x.c) covers the complete documented
instruction set - all 117 mnemonics of the SPRU172 opcode map, in every
documented encoding form:
 - load/store/move, integer and logical ALU ops in every addressing form
   (Smem, #lk, dual-accumulator, Xmem/Ymem, TS/ASM/SHIFT-shifted, the
   shift-by-16 and #lk,16 long-immediate forms, and the two-word
   Smem,SHIFT form whose operation selector lives in the second word);
 - the full multiply/MAC family: Smem, #lk, program-memory, squaring,
   multiply-by-A, signed-unsigned and the dual-operand MAC[R]/MAS[R]
   Xmem,Ymem forms;
 - the parallel (dual-operation) class rendered "op1 .. || op2 .." -
   ST||ADD/SUB/LD/MPY/MAC[R]/MAS[R], ST||LD T and LD||MAC[R]/MAS[R];
 - double/long-word (Lmem) add/subtract, the unary accumulator ops
   (exp/norm/abs/neg/rnd/sat/min/max/rol/ror/sftc/cmpl/...);
 - control flow with the separate delayed (bd/calld/bcd/banzd/fcalad/...)
   variants, conditional return/execute (rc[d]/xc) and the multi-condition
   "tc, c"-style combinable condition fields, repeats (incl. rpt #lk),
   conditional stores, I/O port access, status-bit set/clear and the
   non-linear idle encoding.

Operands resolve to their architectural names - the full memory-mapped
register file (AR0-AR7, the accumulator AL/AH/AG/BL/BH/BG halves, T, TRN,
SP, BK, BRC/RSA/REA, IMR/IFR, PMST, XPC), the ST0/ST1 status bits and the
named condition codes; the memory-mapped-register operand is kept single
word (its long-offset modes are not legal). The analyzer classifies every
instruction (op->type, op->id), resolves branch/call targets and the stack
effect of calls/returns/pushes, and exposes operand details: the register,
base pointer, displacement and access direction of data-memory loads and
stores, and the target register of indirect branches/calls.

All encodings were verified byte-exact against the TI asm500 assembler,
and every decoded instruction re-assembles to an identical encoding (a
full-opcode-space disassemble/reassemble round-trip is stable). A 297-case
disasm test suite and an analysis test suite (opcode classification, branch
and call targets, stack effects, memory-operand fields, data-immediate values, the register
profile, named instruction ids and COFF binary-fixture function discovery)
are added, and the real-world emulateme C54x .text decodes cleanly.

* arch/tms320: add TMS320C54x RzIL lifting

Lift the C54x integer core to RzIL so emulation and IL-based analysis work
for C54x as they already do for C55x/C55x+.

- Register profile: C54x previously fell through to the C64x profile
  (a0-a31, =PC pce1), wrong for the A/B accumulator core. Add a proper
  C54x profile: the two 40-bit accumulators A/B (with the L/H 16-bit and
  G 8-bit guard slices overlapping their parent), AR0-AR7, T/TRN, SP, DP,
  BK, ST0/ST1/PMST, BRC/RSA/REA, IMR/IFR, XPC and a 24-bit PC.

- IL VM config: tms320_c54x_il_config() binds the canonical registers; the
  accumulator slices stay unbound, the lifter expresses them as bit-slices
  of A/B so they never desynchronise.

- Lifter (C55ArchDesc::lift hook, dispatched by c55_lift): the no-shift
  forms of LD/LDU/LDR/LDM, ADD/SUB/AND/OR/XOR, STL/STH/STLM/STM, the mvd*
  memory-to-memory moves, the DLD/DST 32-bit double-word load/store (high
  word at the lower address), PSHM/POPM and RET. Shift/round/saturate
  variants are left unlifted (their shift count is carried only as a
  display string); the engine's generic EA/read/write/post-modify helpers
  are reused for the addressing modes.

Tested via two new RzIL VM blocks in test/db/rzil/tms320: a register/
immediate/memory execute test, and an end-to-end emulation of the
emulateme binary's _decrypt (a UART hex-writer) showing the IL VM emits
the hex digits and advances the write position.

---------

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 05:28:41 +08:00
Premade
aeb6fb1cf6
refactor: move rz_core_types_rename to rz_core.h (#6536) 2026-06-20 02:54:56 +08:00
Farhan Saiyed
3ad6e786ad
Add missing spaces in R! help (#6528) 2026-06-19 13:44:11 +00:00
NOT XVilka
9217b0a86a
librz/arch/sh: add SuperH-3 support via asm.cpu (#6531)
Co-authored-by agent: Claude/Claude-Opus-4.8
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-19 04:37:30 +08:00
dependabot[bot]
5fb6f39091
build(deps): bump codecov/codecov-action from 6 to 7 (#6486)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6 to 7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-18 19:41:53 +08:00
NOT XVilka
070c004e0c
rz-find: flush output to avoid undeterminism (#6527)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 14:56:02 +08:00
Rot127
110c812219
librz/arch/x86: fix ADC, AND, OR, SBB RzIL lifting (#6524)
* Cast operands for AND and OR instructions to the correct width
* Add missing operand casts for SBB and ADC.
* Add flawed instructions to asm tests

---------

Co-authored-by: Dhruv Maroo <dhruvmaru007@gmail.com>
2026-06-18 11:07:43 +08:00
MrQuantum1915
b9d2a03be3
librz/core/tui: fix panel mode and visual modes cmd format and redundant quotes (#6520)
* Fix and add new gadget search cmds
* Fix some more commands and menus
* Fix /a error message
2026-06-18 11:06:17 +08:00
NOT XVilka
5927b2f6dd
Fix old LD linking issues (#6521)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 11:05:41 +08:00
Khairul Azhar Kasmiran
43cb43ed18
Add reliable http:// test (#6509)
* Add reliable http:// test
* REUSE.toml: Add `test/www/**` entry
* Use `cwd` instead to work around old http.server in Python 3.6
* Move test to `not-windows-any`
* NetBSD: Add `python3` symbolic link
* Prevent test from running on woodpecker
2026-06-18 07:01:00 +08:00
NOT XVilka
f205e231ef
arch/tms320: drop c55x+ global state, populate op->val, lift rptadd/rptsub (#6525)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 03:52:09 +08:00
NOT XVilka
36433ae7a1
build: fix rz_bin_stabs.h hdr install (#6526)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 03:46:03 +08:00
billow
944816d364
ci: fix linter job (#6523) 2026-06-17 23:14:21 +08:00
NOT XVilka
e43565fade
librz/core/disasm: dedup symbol name when realname is used (#6518)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 11:22:30 +08:00
NOT XVilka
8fde88fd9e
rz-asm: show an error when -m arg is invalid (#6519)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 11:22:17 +08:00
NOT XVilka
880c8005f7
librz/arch/x86: uplift scalar FP SSE/SSE2 insns to RzIL (#6517)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 11:22:04 +08:00
NOT XVilka
62bcb8f6fc
librz/bin: add STABS format parser (#6511)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 04:13:23 +08:00
NOT XVilka
c0945b0231
subprojects/rzar: fix crash (#6516)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 02:09:11 +08:00
billow
0421f03afe
Fix bin hunk/smd plugin ownership leaks (#6515) 2026-06-16 15:45:53 +00:00
NOT XVilka
dfd83d77a4
librz/arch/tms320: fix C55x+ BTST/BTSTSET/COPY opcodes (#6513)
Verified against the TI dis55 disassembler and the C55x+ Algebraic
Instruction Set (SWPU104) encoding tables.

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-16 05:12:24 +08:00
Anton Kochkov
9ff9a48c4a arch/tms320: extend C55x/C55x+ RzIL coverage (returns, addressing, sub-register and bit ops)
Builds on the shared decode-IR engine to lift a broad set of common C55x and
C55x+ (Ryujin) instruction forms that were previously left without RzIL,
deriving the exact semantics from the TI C55x+ references (SWPU104 / SWPU086).

Control flow and addressing:
  - ret / reti / retcc: return address read from the top of stack, SP popped by
    two words, control transferred to it (retcc guarded by its predicate).
  - 24-bit XAR correctness on C55x+ (XAR0-15, XSP, XSSP, XDP, XCDP) in the
    register table, the IL-VM profile and the pointer-arithmetic width, enabling
    the 24-bit amov address immediate; classic C55x keeps its 23-bit file.
  - long constant-index and 16-bit-absolute addressing modes, memory-to-memory
    copy, shifted memory loads (uns()/signed, immediate shift), and the
    memory-mapped-register moves mov reg,mmap(@reg) / mov mmap(@reg),reg.
  - push/pop of accumulator sub-register halves and dbl(xarN) pointer pairs.

Arithmetic, logical, shift and bit operations:
  - sub-register add/sub on a 16-bit accumulator slice, for the immediate and
    register forms: a .L destination updates [15:0], a .H destination updates
    [39:16] sign-extended through the guard (SWPU104 1.5.1).
  - bitwise and/or/xor with a 16-bit source (half or AR/T) into a full
    accumulator, zero-extending the operands to 40 bits (SWPU104 6.6.1); the
    memory-source bitwise forms into full and half destinations; and the
    shift-ALU forms <op> ACx.<sub> << #S6, ACy.<sub> on the 16-bit slice.
  - memory-source add (including a 16-bit half addend and the reverse-subtract
    sub ACx.<sub>, Smem, ACy.<sub>), the 32-bit dbl(Lmem) add/sub forms
    (ACy = ACx +/- dbl(Lmem) and the reversed ACy = dbl(Lmem) - ACx), and the
    memory-destination immediate RMW add/sub #k, Smem.
  - register bit ops bclr / bset / bnot @#k, ACx[.h/.l] / ARx: clear, set or
    toggle bit k of the register, the bit number taken relative to the
    addressed sub-register (a .h operand targets bit k+16, the guard k+32).
  - bitwise not ACx.<sub>/ARx into an accumulator half or a 16-bit register
    (not ACx.l, ARy), the half-register and short (0x7b #1/#-1) sftl/sfts
    including register-count shifts, and btst @#k, ACx.l/.h, TCy.

This also corrects an op_type-fallback mis-lift: on C55x+ several non-move
instructions (round, sat/satr, the mant/nexp helper) and the bit-field
extract/expand bfxtr/bfxpa were typed as a move and so were lifted as a plain
register copy. round and sat/satr now carry their lops and reach the existing
rounding / saturation handlers (matching C55x); mant/nexp, bfxtr/bfxpa, the
operand-less sat and the register-indexed memory bit ops (bclr/bset/bnot Baddr)
are marked decode-only (no modelled data effect) so the fallback can no longer
guess at them.

Also fixes a FIRSADD/FIRSSUB lifting bug: the Cmem operand was not converted
from AR to XAR before emitting its pointer post-modify, so a post-modified Cmem
(e.g. firssub *ar3-, *ar5-, *ar6-, ...) produced an invalid 16-bit-vs-24-bit
subtract that failed IL validation; Cmem is now widened like Xmem/Ymem.

The multiply/MAC family stays unlifted by design, as do the flag-predicate
retcc forms (whose condition register field is not represented by the decoder)
and the software-interrupt intr (which would need the interrupt-vector base);
the correct-or-NULL contract test asserts a representative deferred form.

The disassembler tests for both variants are extended with the expected IL for
every form that lifts -- previously the optional IL field was omitted on many
lines whose lift already existed, leaving the lifting unchecked -- so the asm
suite now validates RzIL for all lifted C55x / C55x+ instructions, not just a
subset.

Measured on a 5 MB C55x+ firmware image (16k-instruction sample) RzIL coverage
rises from 82% to 99.4% of decoded instructions, the remaining tail being the
multiply/MAC family and the deferred forms above.
2026-06-15 23:31:05 +08:00
Anton Kochkov
4b2ea610df arch/tms320: rewrite C55x and C55x+ on a shared decode-IR engine
Replace the per-variant, table/token-driven disassembly and lifting for the
TMS320C55x and C55x+ DSPs with a single shared decode-IR layer, c55_ir, that
both variants drive through a C55ArchDesc descriptor. The shared engine
table-walks an instruction (c55_decode), formats it (c55_format), fills the
analysis op (c55_fill_analysis), and lifts to RzIL (c55_lift) arch-agnostically,
with the opcode tables, register files, operand extractors, and op-type/lift
mappings supplied per variant (c55x and c55x_plus).

Both test corpora decode and lift entirely through the shared engine: forcing
the shared-only decode path and, separately, the shared-only lift path each pass
the full suite -- 1288 tests including the three RzIL VM emulation tests, whose
decrypt loops execute every instruction through the shared IL. The legacy
decoder and lifter are retained only as a fallback for a complex long-tail (the
parallel dual-MAC group, dual-memory addsub/subadd, the absolute-k24 and dbl
multi-operand loads/stores, and the bit-field forms); the shared path is used
when it can decode an instruction and control falls through otherwise, so
behaviour is preserved at every step.

Several forms are extended beyond the old engine: the full C55x+ register file
(ac0-31, ar/xar0-15, CPU-gated in the profile and IL VM) so extended-register
forms lift where the legacy lifter bound only the low eight; pc-relative and
compare-and-branch control transfer; the bcc flag predicate; and the
single-data-memory bitwise and address-arithmetic forms (and/or #k16,Smem and
register-mode amar Smem,xar) decoded cleanly with RzIL rather than inherited from
the legacy tables.
2026-06-15 23:31:05 +08:00
Anton Kochkov
ab201a3843 arch/tms320: TMS320C55x+ analysis & RzIL (PR #6434) + extended lifter coverage
Squash of rizinorg/rizin PR #6434 ("improve TMS320C55x+ analysis and RzIL")
rebased onto dev, with the PR head's doubled c55plus_il.c (every symbol defined
twice, failing to compile) de-duplicated to a single clean copy.

Substantially extends the C55x/C55x+ RzIL lifter over the existing structured-
operand helpers: mov/copy (immediate, register, memory load/store, half-register
read-modify-write), the full addressing-mode set with post-modify side effects,
control and system-register moves, 40-bit accumulator ALU with shifted sources,
16-bit and dual-memory add/sub, the ST0_55 status-flag model (cmp/cmpand/rol/ror,
named-bit bset/bclr), a documented psh/pop stack model, address-unit amov/aadd/
asub and amar, and bcc/callcc control transfer. The multiply/MAC family and satr
are lifted with explicit, documented integer-mode approximations (not verified
DSP semantics); irreducibly multi-output primitives (bit counts, Viterbi, FIR,
distance) are left correct-or-NULL. The register file covers ac0-7 and xar, found
by validating on real Motorola Wrigley C55x+ firmware whose prologues save 40-bit
accumulators as dbl(acN)+acN.g pairs.

Adds RzIL-VM emulation tests (including the C55x and C55x+ _decrypt emulateme
binaries), per-instruction IL assertions, and ~95% instruction-class disassembly
coverage per corpus; pins little-endian in the VM tests for big-endian hosts; and
regenerates the analysis expectations against current dev.
2026-06-15 23:31:05 +08:00
Anton Kochkov
f89e09f6bc bin/coff: honor load addresses for TI linked (F_EXEC) executables
For a fully linked TI COFF executable the section s_vaddr fields hold the real
load addresses (e.g. .text at 0x100, vectors high) rather than a packed
sequential layout. Map sections at s_vaddr for F_EXEC objects (keeping the
sequential 16-aligned fallback only for relocatable objects), treat a defined
symbol's n_value as an already-absolute address instead of re-basing it onto the
section VA, and give non-loadable sections (DWARF/debug, build attributes,
.pinit) no loadable vaddr so their code-valued debug entries no longer split
instructions mid-stream or shadow the real low-addressed loadable sections. The
formats/coff test expectations are updated accordingly.
2026-06-15 23:31:05 +08:00
Giovanni
c6ba6eed9a
Implement lcs-roll distance (myers+fastcdc) (#6512) 2026-06-15 23:23:54 +08:00
NOT XVilka
832ed32cbb
subprojects/gdb: add support for qGDBServerVersion query (#6477)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-15 01:31:19 +08:00
NOT XVilka
4880588377
subprojects/gdb: fix RLE decoding (#6495)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-15 01:31:01 +08:00
NOT XVilka
998ec77122
Improve detection of the const format strings as arguments (#6510)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-15 01:30:44 +08:00
مصطفي محمود كمال الدين
afd6607fe2
Fix error handling and a percision issue in float core (#6469)
* fix error handling and percision issues in float core
* fix rz_float_cast_float on zero input and add tests
2026-06-14 22:48:44 +08:00
NOT XVilka
f91ef729bf
Improve ARM/AArch64 DATA xrefs analysis (#6506)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-14 21:10:30 +08:00
NOT XVilka
323e707114
librz/bin/elf: improve ARM Thumb symbols detection (#6502)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-14 17:25:00 +08:00
Khairul Azhar Kasmiran
3aebd94478
Generalize #6501 fix (#6503)
* Generalize #6501 fix
* Fix is_filtered_flag() leak
2026-06-13 21:36:45 +08:00
Anton Kochkov
a2454fec15 librz/arch/vax: add new LGPL DEC VAX-11 disassembler and analysis plugin
Add a new LGPL-3.0 VAX-11 architecture plugin that replaces the removed
binutils-derived GPL one. It is written from scratch from the documented
VAX operand-specifier encoding and does not reuse any GPL code.
2026-06-13 18:58:55 +08:00
Anton Kochkov
423104df4a arch/vax: remove the GPL binutils-derived VAX plugin
Drop the old GPL-licensed VAX disassembler (vax_gnu), which was derived
from GNU binutils and gated behind the use_gpl build option. It is being
replaced by a new, clean-room LGPL implementation in a following commit.

Removed:
  - librz/arch/isa_gnu/vax/vax-dis.c
  - librz/arch/isa_gnu/vax/vax.h
  - librz/arch/p_gnu/arch_vax.c
  - librz/arch/p_gnu/asm/asm_vax_gnu.c
  - librz/arch/p_gnu/analysis/analysis_vax_gnu.c

and their entries from the use_gpl plugin/source lists in
librz/arch/meson.build.
2026-06-13 18:58:55 +08:00
Khairul Azhar Kasmiran
8abb4ca4d3
Prevent dup flag cmt if scr.color > 0 (#6501) 2026-06-13 14:30:24 +08:00
NOT XVilka
f832acdb5d
librz/bin: handle PLT sections properly (#6499)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-13 02:20:41 +08:00
NOT XVilka
33fe5f1aef
bin/elf: load ARM Thumb function information correctly (#6478)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-12 04:38:02 +08:00
NOT XVilka
cc87ff20e5
Expose constrained types to user and analysis (#6480)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-12 02:36:35 +08:00
NOT XVilka
1224a19dce
librz/arch/mips: improve static GP resolution (#6497)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-11 23:15:53 +08:00