Skip to content

Relic 1.6.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 03:14
a93a18b

Relic 1.6.0

Relic measured against Ghidra, angr, RetDec, radare2 and LIEF, with the pseudocode bugs that
comparison turned up fixed. Structs whose fields share a register now read like the source.

Download

System File
Windows (x86-64) relic-1.6.0-windows-x86_64.exe
Linux (x86-64) relic-1.6.0-linux-x86_64.tar.gz: one file, relic
macOS, Apple silicon relic-1.6.0-macos-arm64.zip: Relic.app
macOS, Intel relic-1.6.0-macos-x86_64.zip: Relic.app

The macOS app isn't signed, so right-click it and choose Open the first time. The wheel is
attached too, for pip (Python 3.10+). SHA256SUMS lists the hashes of every file.

Benchmarks

Stripped builds of brotli, Lua and zstd (-O0, -O2, -O2 without .eh_frame, AArch64), against
the other open-source tools. Everything, with the method and caveats, is in
docs/benchmarks.md; the scripts are in tools/ (compare_tools.py,
compare_formats.py, compare_decompilers.py, bench_charts.py).

  • Function detection: Relic has the best F1 of the code analysers in every build
    (0.963–0.986; Ghidra 0.73–0.98, angr 0.89–0.97, radare2 0.73–0.90), with or without unwind
    tables, and is 3–5× faster than angr and 4–27× faster than Ghidra.
  • Decompiler output that is valid C: zstd 92% (RetDec 83%, Ghidra 69%, angr 41%), brotli 82%
    (RetDec 82%, Ghidra 69%, angr 49%), lua 98–99% (Ghidra 95–97%, RetDec 92–97%, angr 88–91%).
    Ghidra's decompiler is faster per function; Relic is 3.5–8.5× faster than angr's.

New

Structs whose fields share a register. struct pair { int a, b; } travels in one register;
it now shows as the struct, on x86-64 and AArch64, in parameters and results:

struct pair swap(struct pair a1)
{
    return (struct pair){ a1.b, a1.a + 1 };
}

Floats packed in one register still show as before.

AArch64 struct results without a header. A function writing where x8 pointed on entry
returns a big struct: it takes that pointer as a first parameter result, and its callers pass
one buffer for it (make(buf_30, argc, 7)), where it used to read *x8 = a1;.

x86 shrd / shld read as the shifts they are, (a >> n) | (b << (64 - n)), not an
__shrd() call no compiler knows.

Fixed

Pseudocode that gcc rejected, found by the benchmark (valid C on zstd went from 122 to 275 of 290
functions, on Lua from 249 to 293 of 294):

  • Arithmetic C allows only on integers (p * 8, p & 7, two pointers of different types
    subtracted) casts the pointers to int64_t.
  • A struct pointer read from an integer array or an unnamed global is cast before ->
    (((struct s_18 *)a1[3])->f_18, which Lua's lua_State accesses are full of).
  • An offset added to a char * prints as a number, never as a string literal at that address.
  • A call through a local that isn't typed as a function pointer gets a cast.
  • A recovered struct no longer declares a flexible array member alone ([0]) or in the middle
    (its length runs up to the next field).

Versioning

A MINOR release: new features and fixes, nothing removed or changed incompatibly.

SHA-256

Check a download with sha256sum -c SHA256SUMS --ignore-missing (macOS: shasum -a 256 -c).

7482096f6c6d46b480dc917581e09c109fcbb0505be85aa1f6233ead9c94be9b  relic-1.6.0-linux-x86_64.tar.gz
fb42bdc24013482744e4eb1898d72d17bbfc7203f6817816e62fbf8d6e408f34  relic-1.6.0-macos-arm64.zip
bf7e4ed2102b97f792ac9712d627c1f9a5b07faed63ba597a093539a3dced7f5  relic-1.6.0-macos-x86_64.zip
2abb10874342eea472e8551c3961f290732844c61e88a6e769a9d7ee7a74c0c0  relic-1.6.0-windows-x86_64.exe
c63b78cd43d0ec19e96df2f41307ff342528a7718e99c54419e536daf99b1053  relic_re-1.6.0-py3-none-any.whl
47fc5cd477ca762e72ed39c06fddbf361a5ddfe79e15095518d8e31995655c55  relic_re-1.6.0.tar.gz