Skip to content

Relic 1.7.0

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 13:00
96bc147

Relic 1.7.0

The decompiler's output now compiles again and computes what the program computes more often
than Ghidra's, angr's or RetDec's, measured by running it. Function detection is exact or close
to it on every benchmark build. Most of what changed was found by the new benchmarks.

Download

System File
Windows (x86-64) relic-1.7.0-windows-x86_64.exe
Linux (x86-64) relic-1.7.0-linux-x86_64.tar.gz: one file, relic
macOS, Apple silicon relic-1.7.0-macos-arm64.zip: Relic.app
macOS, Intel relic-1.7.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

docs/benchmarks.md now scores decompiler output on more than "is it C":

  • Behavioural equivalence: 42 functions (tools/bench/equiv.c) decompiled from stripped
    builds, compiled again and run against the original on 40 inputs each: Relic 81 of 84, Ghidra
    75, angr 67, RetDec 37.
  • Control-flow and data-flow similarity to the source (graph-kernel similarity of gcc's CFG
    and SSA def-use graphs), and types against DWARF: Relic gets the kind and size of 81.5% of
    parameters and results right (angr 71.8%, Ghidra 40.9%) and the number of parameters for
    95.4% of functions.
  • Function detection: F1 1.000 at -O0 and on AArch64, 0.996 at -O2, 0.995 without
    .eh_frame (Ghidra 0.73–0.98, angr 0.89–0.97).

tools/decomp_quality.py and compare_decompilers.py --save run it; tests/test_equiv.py
runs the equivalence test on every change.

Fixed: pseudocode that computed the wrong thing

  • Signed 64-bit / and % (cqo; idiv) printed as a 128-bit division of an unsigned
    dividend, wrong for negative values: now a / b.
  • Large negative constants in signed comparisons printed unsigned (0xffffffff80000000),
    which made the comparison unsigned: now -0x80000000LL. Unsigned operands of signed
    operations are cast to signed.
  • int * arithmetic added a byte offset as elements (an overrun); a struct pointer moved by its
    size printed p += 8 (8 structs): now p++.
  • A struct field overlapping an earlier one was used by name but not declared (the function
    didn't compile).
  • Rotates and add/subtract overflow flags print as C, not __rol() / __sborrow().

New

  • Parameters: one after an unused parameter is no longer lost (lua_typename(L, t) had
    none and read rsi); registers handed to a callee count; a parameter only passed on gets the
    type the callee gives it (char * when it reaches strlen).
  • Variadic functions (x86-64): int sum(int a1, ...), and calls to them pass the extra
    arguments (sum(3, a1, 2, 3)), where luaL_error used to take 14 parameters.
  • Computed goto (GNU C goto *table[op], Lua's interpreter loop): the labels belong to
    their function, which decompiles whole as a switch, on x86-64 and AArch64. They used to be
    84 separate functions.
  • Switch lookup tables gcc makes (CSWTCH) are declared with their contents
    (static const int tbl_30e0[7] = { 2, 1, 1, 1, 1, 3, 2 };) instead of read by address.
  • libgcc's 128-bit helpers (__umodti3, __udivti3, __multi3 ...), when the symbol table
    or library signatures name them, are the operators they implement.

Also fixed

  • A switch's bounds check with moves between the cmp and the branch was missed, so the table
    was read to its 512-entry cap and one function swallowed the eleven after it (zstd).
  • Big functions decompile faster: Lua's ~700-block interpreter loop in 18 s instead of 47 s,
    same output.

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).

2a431f9a476698d69b3a47d4b18100d93e6ce59d6d7174f72c4270f7d62fa766  relic-1.7.0-linux-x86_64.tar.gz
e6c98fbee83dfb3fdd15f1e4d75db4938da88f2e4a05d0a68be339961448eebd  relic-1.7.0-macos-arm64.zip
d4a304f0dbbb7db488908531f60ad8719d817467fbd8d3fd70f421d57fb34779  relic-1.7.0-macos-x86_64.zip
e5d1b25c25f990456bf9add1985ce91dde734dd7b24ea4df464d1987dc73c979  relic-1.7.0-windows-x86_64.exe
f93563299c4b8cec210d40d5a777cf7f517e4765d6d14a1598387e027029f0fe  relic_re-1.7.0-py3-none-any.whl
06c30564b980829c4a3f64ef5460e5c9a087ab1981e45ee23a229c5efc881a9e  relic_re-1.7.0.tar.gz