* Clarify docs of raw_alignment
* Set Go and Rust string encoding for binary string search.
* Add detailed doxygen about string search in bin plugins.
* Add the number string code points as detail to string search hits.
* Add helper to check if string encoding needs scanning.
* Add helper to generate a string wildcard pattern.
The pattern is supposed to match any human readable string.
Before the string search refactor there was no explicit definition
what characters mark the end of a string and which ones don't.
This pattern should match strings of the old interpretation.
* Enable the RzBin plugin to search strings with direct matching instead of scanning.
This significantly speeds up the string search when a binary is opened.
The prerequisite is that the plugin specifies the string encoding.
* Enforce UTF-8 for initial string search.
* Add custom string search for PE files.
* Clean up and document rz_utf8_encode
* Don't demote explicit UTF-8 encoding to ASCII.
* Increase min JIT stack size due to not reproducable search results.
* Simplify wildcard regex pattern.
It loads .mdt firmware layout files, searches for the other parts in the same directory and loads them.
It resolves symbols, sections etc automatically, and maps them according to the layout
to the virtual address space.
- The iH command provides details about each firmware part as well.
- Memory maps and segment names are prefixed with the parts file name to make them distinct.
- If a firmware part is an ELF library it loads, and resolves its functions, segments etc.
Due to the design of the ELF binary plugin (code duplication with macros for 32/64bit versions),
this only supports 32bit firmware images for now.
This can relatively easily be fixed, by duplicating this plugin but including the 64bit ELF headers.
This requires more tests though.
It exposes commonly used ELF parsing functions in elf_parser.
They don't rely on RzBinFile but take only the ELF object.
This allows access for other RzBin plugins which rely on ELF files.
* Move ARM32 reloc patching into a function
* Move ARM64 reloc patching into a function
* Move PPC64 reloc patching into a function
* Add missing NONE relocs for various archs
* Move Intel 80386 reloc patching into a function
* Move amd64 reloc patching into a function
* Move rx reloc patching into a function
* Move alpha reloc patching into a function
* Handle reloc RZ_X86_64_COPY for amd64
* Move intel 80386 reloc convert into a function
* Move amd64 reloc convert into a function
* Move arm reloc convert into a function
* Move riscv reloc convert into a function
* Move aarch64 reloc convert into a function
* Move ppc reloc convert into a function
* Move mips reloc convert into a function
* Move rx reloc convert into a function
* Move alpha reloc convert into a function
* Move hexagon reloc convert into a function
* Fix wrong rename on ELF format
* Handle reloc R_MIPS_HI16 & R_MIPS_LO16
* Minimal handling of micromips relocs
* Add nanomips initial support for reloc convert
* Minimal handling of intel 80386 missing relocs
* Minimal handling of amd64 missing relocs
* Minimal handling of arm missing relocs
* Minimal handling of riscv missing relocs
* Minimal handling of aarch64 missing relocs
* Minimal handling of ppc missing relocs
* Minimal handling of ppc64 relocs
* Split reloc patching & conv from bin_elf.inc
* Split aarch64 from arm32 in elf_imports.c
1. Everything is based off of Microsoft's PE format documentation [found here](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format)
2. Up until now, imports were used for relocations in the PE & MDMP format,
which is wrong. PE uses base relocations.
3. PE relocations do not have symbols associated with them, and thus
have no name. In order to still have flags in relocs flagspace, dummy
symbols were allocated with generic names composed of the relocation's
virtual address space.
* Remove old code of setting import entries to PE relocations
* Parse PE base relocations
* Implement converting from the specific RzBinPeRelocEnt type to the
general RzBinReloc type
* Implement corrent type naming of PE relocations
* Add missing `PE_IMAGE_FILE_MACHINE` types
* Add PE base relocation types
* Fix PE format 'has_canary' function
* Remove 'RzBinPEObj.endian' and use 'RzBinPEObj.big_endian' instead
* Removed a.exe and b.exe tests, as they don't contain base relocations
and swapped them with correct tests
* Corrected old PE relocation tests
* Add new PE base relocation tests
- `RZ_PROJECT_VERSION` 14
- Add `RzCallable`.has_unspecified_parameters
- Add `RzAnalysis`.debug_info
- Add `RzAnalysisVarStorageType` composite and `eval` `pending`
- Support for parse DWARF section "debug_loclists", "debug_ranges", "debug_rnglists"
- Partial support for eval DWARF expr_loc
- Support for anonymous Type, function variable, struct member
- Cache all DWARF information in `RzAnalysisDebugInfo` and remove `SDB` based caching.
- Add arm32, arm64, TriCore DWARF register name
- Fix same name basetype
Chained fixups are essentially a new kind of relocs, so it makes sense
to also represent them as RzBinRelocs. Currently the results are
sometimes less meaningful than the reloc info that was parsed before
from indirectsyms in such cases, as chained imports are not parsed yet
and thus the target symbols of bind relocs are not yet known, hence the
temporarily BROKEN tests.
Some identical code from both mach-o 32 and 64 has been moved to
mach0_common.c to avoid duplicate compilation.
rz_mach0_platform_to_string() now recognizes all known platforms and the
information is shown as the subsys in the i command.
The "os" value was previously unreliably and ios sometimes showed as
"ios" and sometimes as "darwin" depending on the binary. Now the os is
"darwin" for all platforms. ios-* syscall files have thus been removed
as only darwin-* ones will be used.
This commit rewrites completely how RzBinPlugin are used to load info
into the RzBinObject structure.
Main changes are:
- Avoid looping multiple times to set the same data:
now the data is cycled only once to rebase addresses, demangle strings
and to make each loaded structure similar to each other.
- rz_bin_demangle is now demangling only strings:
the old implementation was a hack over a hack to add classes & methods
into the RzBinObject while demangling a string.
This allowed methods and classes to be added to RzBinObject when for
example invoking `is` or other printing commands.
This was meant to be an "optimization" to avoid looping and doing
things on-the-fly.
- Now the demangling is done after guessing the language used in the bin.
This is done to avoid looping to various demanglers hoping that a
string is going to be correctly demangled.
After each string is demangled, the string is given to the language
related function which adds classes, methods and fields into the
RzBinObject fields.
- Swift handling is a special case, since the demangler can be disabled
via -Duse_swift_demangler.
The issue with the swift demangler is that is not correctly demangling
strings and outputting swift code, but instead is creating something
that sometimes works, sometimes doesn't.
Also the old code only added fields and never methods for "reasons",
and the new code just uses what the old code was doing as is.
- The new code also takes advantage of the language detection, which now
happens before the demangling of symbols, imports and relocs.
Duplicated code for pkg-config and cmake configuration is avoided by
letting every rizin module register itself in a global dictionary
called "modules" which is then iterated in one place to perform any
shared logic, inspired by how qemu handles multiple targets in its meson
build system.
This is an almost pure refactor, so the resulting .pc/.cmake files
should be identical with the following exceptions:
- rz_reg.pc does not have plugindir anymore as rz_reg has no plugins.
- Some other modules have their dependencies in .pc files altered to be
consistent with cmake.
* 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
* 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
* 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`
* 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