Commit graph

210 commits

Author SHA1 Message Date
David CARLIER
d964f85564
rz_file_copy use copy_file_range (linux only) (#2570) 2022-04-29 11:03:12 +02:00
Nicolas Jeker
cb9e96679e
Fix build with use_sys_tree_sitter (#2562) 2022-04-28 01:38:03 +08:00
GustavoLCR
53de45300c
Normalize paths on Windows (#2485, Fix #2124) 2022-04-03 07:44:01 +00:00
Riccardo Schirone
3fd578ef7a build: use run_command(..., check: false) as return code is used
run_command(..., check: true) was introduced because of a breaking
change in newer meson versions
(https://github.com/mesonbuild/meson/issues/9300), however Rizin uses
the return code to see if the subproject is in the right state or not.

Revert back to check: false, so that meson will not fail and we can
detect the failure in our meson.build files.

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2022-03-29 16:53:15 +02:00
Riccardo Schirone
57a5ab5d0b Keep targeting meson 0.55 2022-03-25 17:43:56 +01:00
Riccardo Schirone
230652aa98
Add -Wimplicit-fallthrough to meson file (#2438) 2022-03-24 08:27:18 +08:00
Giovanni
bfec86a12e
Add option to install sigdb systemwise and custom user location for additional signatures (#2328) 2022-02-28 14:32:38 +01:00
Riccardo Schirone
7c5e4f1fad
Update required meson version to 0.59.0 (#2351)
We are already using `import(..., required: ..)` where `required`
argument was introduced in 0.59.0, so let's update the required version
of meson necessary to build rizin.
2022-02-22 22:05:44 +00:00
yossizap
b744c8749a
Fix rz_path_prefix not working when BINDIR is at the root directory or several folders deep (#2332)
* Add an option to provide a custom prefix for portable binaries
* Use bindir's depth to find the portable root path in rz_path_prefix
* Skip the prefix folder check if we are not in bindir
2022-02-22 11:08:56 +08:00
Anton Kochkov
60a1698b62
Make CMake config generation optional (#2340) 2022-02-20 12:54:43 +01:00
Riccardo Schirone
ff56018b74
Add support for SOURCE_DATE_EPOCH for reproducible builds (#2322) 2022-02-15 09:21:41 +00:00
Riccardo Schirone
6f40dfe493
Move remaining things from shlr/ to meson subprojects (#2126)
* Move binrz meson directives to binrz/ dir

* Move rizin-shell-parser to a subproject

* Move bochs to a meson subproject

* Move rzqnx to meson subproject

* Move winkd to a meson subproject

* Move rzar to a meson subproject

* Move rzw32dbg_wrap to a meson subproject

* Move ptrace-wrap to a meson subproject

* Move rzgdb to a meson subproject

* Rename w32dbg_wrap to rzw32dbg_wrap

* Update CODEOWNERS

* Remove old references to shlr

* Move shlr/heap stuff in core and remove shlr/arm

* Move spp to a meson subproject

* Remove last references to shlr

* Remove use_webui option

* Move include files directives to librz/include/meson.build

* Move librz meson directives into librz/meson.build

* Handle d/ directories inside the specific module meson.build

* Move plugins listing to specific module meson.build

* Move rzheap to its own subproject

* Fix js linter and licenses

* Use meson.override_dependency for all rz_ modules
2021-12-22 09:20:39 +08:00
Khairul Azhar Kasmiran
95106d3d9c
Make meson.build work again with meson 0.55.3 (#2113) 2021-12-17 22:01:21 +08:00
Riccardo Schirone
47e1cb8335
Provide CMake config files for CMake projects (#2057)
* Remove wrong librz.pc.in file
* Add plugindir variable to .pc files to allow easy plugin configuration
* Add CMake config files to find Rizin in CMake projects
* Add CI jobs to check cmake files
* Provide workaround for mesonbuild/meson#9702
* Use .lib suffix and no prefix on MSVC to make CMake files work
* Disable cmake files on static libraries build
2021-12-17 09:16:25 +00:00
Riccardo Schirone
24af48b6e4
Add dist script to remove .git folders from subprojects (#1998) 2021-12-16 11:37:13 +00:00
Giovanni
bda1e9cfca
Disable GPL code and Add RISC-V support via Capstone 5 (#2087)
* -Duse_gpl=false is supported by rizin and added riscv_cs for capstone v5
* Added GPL build workflow in CI
2021-12-11 13:30:01 +01:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Riccardo Schirone
59948502a7
build: Fix dependencies names which are called libmagic and libxxhash (#2025) 2021-11-25 07:39:57 +08:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Giovanni
f41ea3c284
[FLIRT] Refactoring and create rz_sign library (#1960) 2021-11-11 20:29:59 +01:00
Florian Märkl
d8450b8e75
Add local=absolute option to meson for absolute rpaths (#1911) 2021-11-09 07:04:34 +08:00
Anton Kochkov
6f4a24c58e
Use strnlen() wherever available (#1894) 2021-10-27 10:17:24 +02:00
Florian Märkl
08cbaa701e Set HAVE_ENVIRON to false for macOS (it's not available in shared libs) 2021-10-26 10:50:22 +02:00
Riccardo Schirone
aa71ff8114 Use empty dependencies to avoid comparing different types 2021-10-25 17:32:26 +08:00
David CARLIER
7aa9fb5e51
shm:// support on Android (#1870) 2021-10-22 13:35:23 +08:00
Riccardo Schirone
dd04668233
Update dev version to v0.4.0-git (#1813) 2021-10-11 11:06:33 +02:00
Heersin
e0d3d6bc66
New RZIL integration (#1663)
The new intermediate language is based on the BAP (Binary Analysis Platform) Core Theory.
It operates on SMT-like bitvectors and their arrays to represent values and memory.
Apart from that, it has also representation for the data and code side effects.
2021-10-09 18:14:44 +08:00
Basstorm
19a6a929f9
Rewrite PDB parser ##bin (#1517)
* Rewrite PDB parser to become endianess-independent
* Use type pretty-printing API
* Use `RzCmdStateOutput` instead of `RzOutputMode` to solve invalid JSON issue
* Move PDB-related print functions to `cpdb.c`
* Use flag API instead of calling commands from the code
* Separate printing from parsing and applying the type information
* Delete useless `main.c`
2021-10-09 16:57:29 +08:00
Giovanni
e224ee7b28
Add demangling as plugins and libdemangle as external dependency (#1656)
* Added demangling as plugins and libdemangle as external dependency
* Added iDl to return the list of demanglers
* moved demangling tests into rz-libdemangle and keep only bin tests
2021-10-01 10:45:38 +00:00
David CARLIER
1bdb6d13a2
haiku and dragonflybsd build fixes. (#1767) 2021-09-28 21:54:49 +02:00
Anton Kochkov
d5f1aea595
Detect shm_open() function with Meson (#1759) 2021-09-28 09:05:16 +08:00
DC
efee20738d debug: generate core dump for FreeBSD.
from the 14.x (next) release, since the snapshot update, interface is available
 and allows enough flexibility thus here we re trying to dump data as much
 as possible.
2021-09-09 14:14:26 +02:00
Dhruv Maroo
231e079214
Add RZ_BUILD_DEBUG compile time definition for debug logging (#1616)
* `RZ_LOG_DEBUG` and `RZ_LOG_SILLY` are now only compiled when `RZ_BUILD_DEBUG` is set
* Add `RZ_BUILD_DEBUG` in `rz_userconf.h.in`
* Use rvalue to avoid unused variable error when building in release mode
2021-09-08 08:47:03 +02:00
wargio
7146b3af75 Revert "Added support to swift demangling (#1595)"
This reverts commit b6259bd31f.
2021-09-06 17:09:51 +02:00
Giovanni
b6259bd31f
Added support to swift demangling (#1595) 2021-09-06 15:14:14 +02:00
Anton Kochkov
2b6b373f0f
Detect copyfile() with Meson (#1524) 2021-08-25 13:36:35 +02:00
Aswin C
31d4143a93
Use str{l,n}cpy() in rz_str_ncpy() instead of a loop (#1395) 2021-08-25 18:21:45 +08:00
Anton Kochkov
7e276b3f09 Check pty.h functions presense in Meson 2021-08-23 18:45:22 +08:00
David CARLIER
07faec08ef
socket try to disable per process first on freebsd. (#1491)
using new api/flag available when aslr was made available on this platform.
2021-08-20 16:42:06 +02:00
David CARLIER
0f978dd836
HaikuOS nice() socket function detection. (#1408) 2021-08-09 13:08:23 +08:00
Riccardo Schirone
a3ca523524
Improve rz_sys_prefix when compiling rizin as portable (#1379) 2021-07-29 15:46:49 +02:00
Anton Kochkov
3c59df7e98
Refactor RzTypes to use structs instead of SDB + New Tree-Sitter based C Parser (#1047)
- Removed oldshell version of `t` (types) commands
- Removed `tk` command because types storage switched to the hashtable
- Added `tfc` command to show the calling convention of the function or set it
- Added `tsl` (RZ_OUTPUT_MODE_LONG) to show structure members' sizes and offsets
- Added `tul` (RZ_OUTPUT_MODE_LONG) to show union members' sizes
- Switched the types storage to the hashtable instead of SDB
- Added load and export from/to SDB for standard type libraries and serialization for Projects
- Changed all `char *type` occurences to the proper `RzType`
- Added `RzCallable` type for the function/class method types
- Changed all function types API to use the `RzCallable` API
- Switched the function types (`RzCallable`) storage to the hashtable instead of SDB
- Added a connection between `RzAnalysisFunction` and `RzCallable` - `rz_analysis_function_derive_type()` API function to derive new `RzCallable` type from the `RzAnalysisFunction` even if it doesn't exist in the RzTypeDB.
- Moved type links to the RzAnalysis where they belong
- Removed TCC and MPC-based parsers
- Added Tree-Sitter-based parser for C grammar (see `librz/type/parser/*`)
- Reworked type databases in `librz/analysis/d/` to be consistent with C standard, libc, platform-specific definitions
- Switched the type links from `char *` to `RzType`
- Switched the type links from SDB to the hashtable
- Added concept of the "type paths", e.g. `a.b[20].c` where `b` is a member of `a` (`a` is either structure or a union) and `c` is a member of `b`, and `b` is an array where we take 20-th element.
- Added concept of the typeclasses (a bit similar to Haskell) for numerical types: `None` (the most generic one), `Num` (includes `Integral` and `Floating`), `Integral` (includes `Signed Integral` and `Unsigned Integral`), `Floating`.
- Added concept of type equality (`rz_types_equal(a, b)` API function)
- Added Doxygen documentation to every API function in the `librz/type/*`.
- Updated the project format from **V2** to **V3**, added migration.
2021-07-20 01:46:45 +08:00
David CARLIER
f2c593d223
Detect TARGET_OS_IPHONE as 0 on arm64 macOS (#1289) 2021-07-11 21:11:47 +02:00
David CARLIER
10acbb74e5
haiku build fix proposal (#1265) 2021-07-05 05:27:57 +08:00
Aswin C
381f22d7cc
Introduce RzArchPlatform and support for platform profiles (#1254)
* Remove the unnecessary `sdb` pointer of `RzArchTarget`

The SDB pointer in `RzArchTarget` is not needed as `sdb_load_arch_profile_by_path` 
creates a new SDB pointer and takes care of our requirements.

* Introduce `RzArchPlatformTarget` and `RzArchPlatformItem` and the new APIs

Also define a new flagspace: `RZ_FLAGS_FS_PLATFORM_PORTS`

* Introduce a new configuration variable `asm.platform` to choose the
platform profile

* Define and call the APIs for platform profiles

* Add the SDB file for BCM 2835 and a unit test

* Check for NULL at various places and run `clang-format`

* Use `RZ_NONULL` for the parameters of `rz_arch_platform_init`

* Add `RZ_NONNULL` to all of the arguments which gets `rz_return[_val]_if()`-ed

* Let `platform` be NULLABLE and fix the ASAN tests
2021-07-02 12:55:31 +08:00
Florian Märkl
da79604ffa
Check for .git in meson without Python and also for non-dir (#1210) 2021-06-11 23:06:44 +02:00
Aswin C
c7ae12e654
Introduce RzArchProfile and add support for CPU profiles (#1193)
* Introduce `RzArchProfile` and add the CPU profiles
* Create `rz_arch.h` and `arch_profile.c`
* Add the CPU Profile's SDB files
* Add the `meson.build` for compiling SDB files
* Add the hashtables and the flagspaces
* Add a test and compare the `type` in `rz_sysreg_get`
* Update the list of AVR CPUs in `asm_avr`
* Run clang-format and include rz_arch.h in rz_analysis.h
* Fix the install directory of the compiled SDB files
* Introduce `RzArchTarget` which houses `RzArchProfile`
* Support for loading a new profile when `asm.cpu` is changed
* Change the variables names to lowercase and add tests
* Add a test for loading a new CPU profile when CPU is changed
* Add Doxygen documentation, run `clang-format` and correct the requested changes
* Remove unnecessary zero-initializations and other improvements
* Reversed a condition while creating the path in `rz_arch_profiles_init`
* Fixed four tests: three regarding printing the flagspaces and one from printing flags after analysis in AVR
* Free the required pointers and check for `NULL`
* Free the pointers that was allocated previously, before returning `NULL`
* Free the pointer in `rz_sysregs_db_new`
* Support for adding a fallback profile for unsupported CPUs
2021-06-11 20:29:12 +08:00
Aswin C
92b5783fa1
Deprecate RzSyscallPort and move the existing sysregs to SDB (#1160) 2021-06-02 02:01:51 +08:00
Giovanni
6fec281af7
Rewrite rz-diff and internal diffing library (#1126) 2021-05-14 19:47:30 +08:00
Riccardo Schirone
d2c893ec66
Merge pull request #1050 from rizinorg/symbols-collision
Fix symbols collision due to visibility not being used on subprojects
2021-04-19 16:51:39 +02:00