Commit graph

214 commits

Author SHA1 Message Date
Anton Kochkov
c530cc9cae capstone: update to the latest next 2024-04-27 16:44:21 +08:00
Giovanni
be83c0276b
update libdemangle (#4429) 2024-04-18 19:59:06 +08:00
Khairul Azhar Kasmiran
d5f6f8f82f
Use xz-5.2.9.tar.gz instead due to Debian builds (#4424) 2024-04-10 01:02:28 +08:00
Giovanni
5cd4cff7eb
Update libdemangle to latest main and add LD command as alias of iDl (#4411) 2024-04-01 14:39:35 +08:00
Khairul Azhar Kasmiran
d9d066a377
Use fallback repo for xz 5.2.9 (#4403)
* Downgrade to xz 5.2.9
* Patch xz-5.2.9's src/common/tuklib_integer.h
2024-03-30 21:47:49 +08:00
Anton Kochkov
667da7ece8 subprojects/spp: remove dead code 2024-03-28 07:41:59 +08:00
Anton Kochkov
bfe5e3b806 subprojects/spp: update README and code 2024-03-28 07:41:59 +08:00
Anton Kochkov
e2d42d2004 subprojects/spp: remove acr and pod preprocessors 2024-03-28 07:41:59 +08:00
Anton Kochkov
89f37e3881 subprojects/spp: use meson configuration 2024-03-28 07:41:59 +08:00
Anton Kochkov
01f125fdc9 subprojects/spp: remove unused files 2024-03-28 07:41:59 +08:00
Khairul Azhar Kasmiran
29f9c8a9da
Update tree-sitter to 0.21.0 (#4338) 2024-03-06 20:42:39 +08:00
Khairul Azhar Kasmiran
d3c05ca730
Use npx instead in rzshell build insns (#4331) 2024-03-05 22:04:47 +08:00
Rot127
de1b126b5d
Disable PCRE2 JIT for Darwin (#4329) 2024-03-05 17:07:07 +08:00
Rot127
905416f928
Disable usage of wx pages on darvin. (#4311) 2024-03-03 11:39:12 +08:00
Khairul Azhar Kasmiran
299454138b
$: Add rzshell façade (#4314) 2024-03-02 17:11:02 +08:00
Giovanni
78d4043afb
Fix arm64 analysis to fix regression on ARM64 switch tables. (#4284)
* Bump capstone next
* Fix arm64 analysis to fix regression on ARM64 switch tables.
* Fix tests
2024-02-24 00:00:12 +08:00
Rot127
abb8c3db75 Bumb Capstone next version. 2024-02-18 21:29:03 +08:00
Rot127
a84c7897fc
pcre2: fix NetBSD build by using different allocator. (#4259) 2024-02-18 18:22:06 +08:00
Rot127
1311b75c75 Bump PCRE2 to 10.43 release. 2024-02-18 07:26:08 +00:00
Anton Kochkov
ceefb5e114
Convert pf commands to rzshell (#3467) 2024-02-16 10:30:59 +08:00
Anton Kochkov
25fd417a28
Add user pointer to RzListComparator (#4204) 2024-02-11 13:28:33 +08:00
Rot127
5afc51f0e2
Replace current regex engine with PCRE2 (#4185)
* Replace OpenBSD regex library with PCRE2.

PCRE2 has way better performance than the OpenBSD
library (something around 20 times faster).

The following flags are enabled for every pattern:

- PCRE2_UTF
- PCRE2_MATCH_INVALID_UTF
- PCRE2_NO_UTF_CHECK

All the others are optional.

Changes made:

- Adds PCRE2 as subproject.
- Changes the API away from POSIX to PCRE2.
- Edits many regex patterns because:
 - ' ' is skipped in patterns, if the EXTENDED flag is set for matching. '\s' must be set now.
 - '.' doesn't match newlines by default.
- Changes the API so matches and their groups are bundled into PVectors.
- Moves the regex component to rz_util.

* Fix cross build - add copy of PCRE2 dependecy

Meson currently doesn't support subprojects to be native and non-native at the same time.
See: https://github.com/mesonbuild/meson/issues/10947
Unfortunately, sdb depends on rz_util which in turn depends on PCRE2.
Excluding PCRE2 from the native build makes linking of rz_util not possible anymore.
Adding it, will make Meson complain that the dependencies cannot be mixed.

Hence, we compile a copy of PCRE2 for the native build if required.
2024-02-05 12:51:16 +08:00
Anton Kochkov
e7d3c258fb
Remove some more of sdb_fmt() calls (#4140) 2024-01-30 22:36:39 +08:00
Gleb Popov
07f92a82df
rizin-shell-parser: Fix build with newest tree-sitter (#4165) 2024-01-29 21:14:40 +08:00
Khairul Azhar Kasmiran
54842b8eb8
Drop -fno-strict-aliasing flag from capstone next build (#4149) 2024-01-24 23:24:46 +08:00
Anton Kochkov
046918075e
Use git depth 1 for Meson subprojects (#4138)
* Use git depth 1 for Meson subprojects
* Disable git depth on Debian CI
2024-01-22 21:14:32 +08:00
Anton Kochkov
9c2f4f68d1 Update capstone to the latest next 2024-01-21 07:15:41 +08:00
Rot127
9d3bab46e4 Bump CS version to most recent next branch. 2024-01-14 22:23:59 +08:00
Khairul Azhar Kasmiran
63d3369538
Use -fno-strict-aliasing with Capstone next build (#4060) 2024-01-01 22:49:01 +08:00
Khairul Azhar Kasmiran
d9ca656907
Downgrade Capstone next build to -O1 on gcc release build (#4054) 2023-12-30 16:03:27 +08:00
Rot127
9b227eb3c1
Make AArch64/ARM analysis and asm plugins Capstone v6 compatible. (#4011)
This commit refactors the AArch64 and partially the ARM
plugin to make it Capstone v6 compatible.
Due to the big API changes in Capstone v6 several changes
had to be made.

Because we need to be compatible to Capstone v4 and v5
many include guards are added as well.

Overview of changes done:

**ARM**

- Instruction alias were introduced. This leads to different
decoding and analysis paths taken for certain instructions.
Some alias have their IL code generated like the real
instruction now (no special handling needed anymore).
This change is responsible for many changes you'll encounter.

- The operand details of each instruction are now always the
one of the real instruction. Also for alias.
For example, if "MOV <Wd>, #<imm>" is an alias for `ORR <Wd>, WZR, #<imm>`,
the details by CS hold all three operands of "ORR".
Before, they held only the two of "MOV".

- Several bugs in variable and argument generation
were fixed. Especially the default variable width
for ARM Thumb was changed to 32bit instead of the 16bit.

**AArch64/ARM64**

The changes listed above for ARM, also apply to AArch64.

Additionally:

- Capstone v6 changed the name ARM64 now everywhere to AArch64.
To be compatible with Capstone v4/v5 AArch64 names must be wrapped
into macros which resolve the name, depending on the CS version used.

- Capstone v6 is now more consistent with
register real and alias names.
From now on we use the register alias by default.

**List squashed commit messages:**

[AArch64 CS v6 BEGIN] Change subproject config to use cs-auto-sync-aarch64 branch

Replace ARM64 with version sensitive macros.

Exclude alias if CS version >= 6

Update access to writeback member

Exclude instr alias from inclusion

Update memory operand printing to json.

Enable real instr. detail only for AArch64

Set correct arch name in meson.build for CS

Fix U/SBFM instructions and their alias.

Mark parameters with RZ_OUt/BORROW

Optimize register extension to skip some, if the width already matches.

Adapt width and lsb of U/SBFM alias instructions (ImmR and ImmS are from U/SBFM).

Fix tests correct semantic buy bad syntax

Pass alias MOV instructions to mov()

Handle CSET and CSETM alias

Fix lsl, lsr and asr by handling them as alias.

Fix mov alias.

Handle TST alias

Fix CNEG, CINV alias

Fix bfi and bfxil alias.

Fix sign extensions.

Fix compare instructions.

Fix NEG, NGC, NGCS, NEGS, MVN

Fix CINC

Fix multiply instructions.

Fix ROR

Run clang-format

Handle CMP for ESIL

Handle new position of memory disponents of post index operands.

Fix post-index operations.

Add missing writeback checks for Post and preindex

Handle UBFM and SBFM alias

Handl BFM alias

Handle CMP, CSET and CINC alias

Update meson file of for cs-aarch64 branch

Fix asm tests. Use reg alias now.

Fix condition confusion and incorrect operand usage.

Fix plf test.

Run clang-format

Use register alias in tests

Add support for fp and lr reg alias assembly.

Use reg alias in test

Rename cond tranlate functions r2 -> rz

Fix condition check which assume 0 == invalid.

Fix issues intruduced by rebase

Set CS commit to current next branch.

Rename ARM64 -> AArch64

Add missing source file to meson.build

Remove DisassemblerExtension.c file for CS v5

Update to newest capstone next branch

Bump up CS version

REVERT ME: Get Capstone v4/v5 via git clone until new tars are released.

Wrap setting of CS_DETAIL_REAL into CS version check

Add maybe-unitialized to Capstone C args.

Fix CS pre v6 build by adding guards.

Use reg alias now printed by default by CS.

Bump CS version to most recent next.

Fix build errors due to stircter alias handling in ARM.

Fix RzIL tests introduced by alias introduction to ARM.

Fix ESIL bugs introduced with ARM alias introduction.

- stackptr hasn't been set for POP and PUSH

Add support again for Thumb1 pop/push

Handle PUSHW and POPW alias

Update test case

Add more POP and PUSH alias and enrich detail for other versions of them.

Fix incorrect mem access width guesses for ARM thumb.

Set POP return info if it writes to PC

Fix tests about default var size and POP mem write direction.

Bump CS version to newest next.

Fix incorrect tests.

- TriCore: Functions were in ro section.
- Default arg width in ARM thumb is 32bit.

Revert check for a set stackptr.

stackptr is used in different ways:
1. Safes the offset from the stack frame base.
2. Is interpreted as somthing else for x86 and I cannot find out what, in a reasonably time.

Hence we cannot use it here consistently.

Remove check for non existing ARM_GRP_RET in CSv5

Fix incorrect stack offsets of variables.

'push <reg-list>' instructions for which the second register was the FP,
reset the stackptr variable to 0. This led to wrong bp offsets in the variable names.
In this case it was +0xc.

Bump CS version.

Add copy of meta-programming macros for capstone-sys build.

Update capstone-next.wrap

Use bracket-less met-programming macro to fix Windows build warnings.

Update wrap files for Capstone with branch names

Add new meta-programming macro

Add workaround for MSVC pre-processor bug.
2023-12-20 01:00:31 +08:00
Giovanni
8fba9b4189
Force usage of RzList methods instead of direct access of the fields (#4036) 2023-12-18 21:05:57 +08:00
Riccardo Schirone
08904d27cb build: fix compilation with meson 1.3.0 2023-12-01 23:32:17 +08:00
Anton Kochkov
bda5b2d0f3
Fix commmit hash for capstone-next (#3993) 2023-11-21 12:12:56 +08:00
Rot127
b16471fa53
Remove Capstone 3 (fix CS 4 & 5) (#3934)
* Remove macros checking for CS_API_VERSION 3

* Remove CS 3 from meson_options and subprojects.

* Remove Capstone v3 from CI

* Remove CS_API_VERSION >= 4 checks since always true from now on.

* Add CSv5 workflow to CI.

* Handle ARM pre v6 build errors.

* Fix PPC build errors for CS < v6

* Fix correct macro name

* Remove wrong include.

* Fix fallthrough warning

* Fix getter macros for WB and post-fix flags.

* Fix faulty macro name

* Check for all float extensions for vabs.

* Add return to assert cases.

* Update cs to 46154e8605aaefdcca5fecf4ea88b92db5a40ad3

* Remove cs3 wrap file.

---------

Co-authored-by: wargio <wargio@libero.it>
2023-10-25 18:30:15 +08:00
Rot127
1018286648
[PPC/ARM] Update to Capstone v6/auto-sync (#3648)
ARM
- Updated ARM identifiers and API changes.
- Fixed shift amounts to be always decimal.
- Fixed incorrect usages of memory disponents.
- Fixed restoring of condition codes.
- Updated IDs for new ones.
- Fixed 8-byte stores.
- Added flag checking for MOV with shifts.
Capstone Integration
- Removed capstone-auto-sync subproject and replaced with next.
- Checked for NEON features.
- Used https://github.com/capstone-engine/capstone/pull/2122 for better system operand support.
- Distinguished between 32 and 64-bit cc checks.
- Checked for CS API version >5.
- Checked for CS_NEXT_VERSION instead of CS_API_MAJOR.
- Fixed VSTn and VLDn instructions to use corrected memory operands.
- Excluded multiple instruction aliases that are no longer valid IDs.
- Used CS_NEXT_VERSION as include guard.
- Added CS v6 include guards.
- Added CS v6 support to branch conditions for Rzil.
- Added more CSv6 guards.
PPC
- Fixed: Compare instructions do not use the branch predicate.
- Fixed conditional and CTR checks.
- Fixed MTSPR and MFSPR instructions.
- Excluded more branch aliases no longer present in v6 from switch cases.
- Fixed incorrectly assigned variables.
- Fixed condition checks for branches.
- Used ITE for condition checks, to prevent unnecessary reads of CTR or CR.
- Fixed rzil tests with new semantics using register 0.
- Updated include guards for Capstone versions to use CS_NEXT_VERSION.
- Initialized spr_name to prevent uninitialized use.
- Used mem.offset register for CSv6.
- Always used real operand details.
- Used mem operand for DCBZ.
- Fixed tests that are semantically identical.
- Handled LI LIS alias.
- Fixed rzil tests (with simplified semantics).
- Fixed branch alias with new cond test method.
- Handled clrl. alias.
- Handled SL/SR alias.
- Fixed conditional branches in ESIL.
- Fixed possible multiplication result overflow.
- Added RZ_NONNULL.
- Added 0 register.
- Handled LIS alias.
- Fixed: Print crX reg name in CS v6.
- Handled all general branch instructions into a single case statement.
- Fixed no semantic issues in tests.
- Added newly discovered calls.
- Moved direction check to inline function.
- Added link of root cause for broken test.
- Added QPX support.
- Set Capstone next branch to latest commit.
- Fixed uninitialized warning.
- Set CS next branch to newest commit.
2023-10-18 10:36:25 +08:00
Anton Kochkov
083bd4f2e7
Remove C++ compiler dependency for ZSTD (#3888) 2023-09-25 17:42:28 +08:00
Riccardo Schirone
738be8e7e4
build: allow to use system libzstd and fix includes/lib installation (#3858) 2023-09-15 14:38:37 +08:00
Riccardo Schirone
9d68e9614f
Fix old math commands (#3828)
* core/cmd: Adjust math commands

* shell: make `?x` commands a parsing failure

We have moved the `?x` commands to `%x`, thus now no command should
start with `?`. This patch makes the parser fail to parse `?x`
strings.

* core/tui: use APIs in panels

* There's no `%q` anymore, use `%=`
2023-09-14 08:53:25 +08:00
Khairul Azhar Kasmiran
0c3b7339eb
Fix #3802: Enforce space after env (#3849) 2023-09-12 20:56:22 +08:00
Anton Kochkov
318a99bbad
Update rz-libdemangle (#3827) 2023-09-05 15:13:11 +08:00
Florian Märkl
c097bd7799 Fix zstd on OpenBSD/sparc64
Functions like MEM_read32 could still perform unaligned accesses on
OpenBSD/sparc64 with gcc, possibly related to gcc bug 51628. The
solution is to switch to a safe memcpy-based solution and let the
compiler do any optimizations.
2023-08-31 08:15:02 +08:00
billow
5999d3e824
DWARF support for load zlib and zstd compressed section (#3795) 2023-08-29 07:23:48 +08:00
ur4t
f0c932f2cf
subprojects/zlib: Improve meson.build, emulating configure script (#3759)
* subprojects/zlib: Improve meson.build, emulating configure script
* Update zlib to 1.3
2023-08-24 12:32:38 +08:00
Anton Kochkov
2cbe8fe0f0
Update capstone-v5 to 5.0.1 (#3777) 2023-08-23 16:00:11 +08:00
Florian Märkl
d8aeabb501
Fix blake3 build with incompatible assemblers (#3764)
Apple Clang 4.2 on Mac OS X 10.7 Lion does support avx2, but it has
issues with some of the asm syntax used, in particular jc and some mov
syntax.
So we add an additional check for a short assembly snippet.
2023-08-17 09:51:57 +08:00
Anton Kochkov
a4ec3563ca
Update rz-libdemangle (#3753) 2023-08-14 13:01:36 +08:00
Florian Märkl
22e56a3628
Fix blake3 build when a simd extension is missing (#3751)
Regression from avx512 fix: Any call to add_project_arguments() must
happen before declaring any build target.
2023-08-14 09:02:05 +08:00
Florian Märkl
14d607e7fd
Fix AVX512 detection and build in blake3 (#3739)
The test for avx512 could result in false-positives because the
_mm256_setr_epi64x intrinsic requires only AVX, not AVX512. Specifically what
is needed here is AVX512VL.
In addition, not passing the -mavx* args to the asm compilation failed the
build on macOS High Sierra and below (Apple LLVM version 10.0.0,
clang-1000.11.45.5)
2023-08-12 10:02:30 +02:00
Giovanni
4ffdf2766d
Bump libdemangle (#3743) 2023-08-10 21:51:52 +08:00