Skip to content

Relic 1.5.0

Choose a tag to compare

@github-actions github-actions released this 17 Nov 07:33
b1c7161

Relic 1.5.0

Structs passed and returned by value now show up in the pseudocode, on x86-64 Linux and on
AArch64. Several older decompiler bugs that this work turned up are fixed too.

Download

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

New

Structs passed and returned by value. Import a header with the prototypes (relic types,
File > Import C header) and a function that takes or returns structs by value reads like the
source:

struct pt add(struct pt a1, struct pt a2)
{
    return (struct pt){ a2.x + a1.x, a1.y * a2.y };
}

struct big make(long a1)
{
    struct big *result = &(struct big){0};  // the result (the caller's, passed as a hidden first argument)
    result->a = a1;
    ...
    return *result;
}

Its callers pass compound literals or local structs and read the result as one variable:
r1 = add((struct pt){ v2, 2 }, (struct pt){ 3, v2 });, buf_48 = make(v2);,
total(buf_48), r1.x.

  • x86-64 Linux (System V): structs of up to 16 bytes in integer and SSE registers (also mixed),
    bigger ones and ones that no longer fit in the registers on the stack, big results through a
    hidden pointer.
  • AArch64: structs of up to 16 bytes in x registers, structs of up to four doubles one per
    v register, bigger ones by reference (they still read as a1.b), big results through x8.

The test programs are decompiled at -O0, -O1 and -O2, the pseudocode is compiled again (and run
under qemu for AArch64), and it prints what the original program prints.

Not covered yet: structs whose fields share a register (struct { int a, b; }, two floats),
other ABIs (Windows, 32-bit ARM, MIPS, RISC-V, PowerPC). Those keep the usual parameters, and a
header no longer puts types on registers it can't place.

Header types guide the pseudocode. A parameter typed by a header decides which side of
p + i is the pointer: a1[i], where -O0 code used to read count[a1]. Signatures keep the
header's const (const char *a1).

Fixed

  • Bytes of one stack slot read as separate variables. A value stored whole and read back in
    parts (a struct copied a word at a time, a register spilled and read a byte at a time) became
    several variables, so what was written to one wasn't seen in the others. Those reads are now
    parts of that one slot. This fixed buffers in grep's main (what wcrtomb writes) and in gzip
    (a strcpy target split into an int and a byte).
  • A double constant stored into a local struct's field printed as an integer read from the
    constant's address (var_b8.x = *(int64_t *)0x2050). It now reads 1.0.
  • A vtable read one slot too far on PowerPC64 ELFv2, into the typeinfo after it, made up a
    method at 0x10 that couldn't be decompiled.

Versioning

Releases now follow Semantic Versioning on purpose: the commands and their
options, the --json output, the scripting and plugin API and project files are the public
interface (see Versioning in the README). The Release workflow refuses a version that isn't
MAJOR.MINOR.PATCH, isn't newer than every release so far, or is marked a pre-release without a
-rc.1-style part (or the other way round). 1.5.0 is a MINOR release: new features, nothing
removed or changed incompatibly.

SHA-256

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

844c640e4ecc81f94455c386d7326cc3c2a501325e544eca4b148d7616f5314e  relic-1.5.0-linux-x86_64.tar.gz
a95c6b8a27b49f7cd5ea893ae091a9aef3c52cb32c64dd6ad1020e3841f56084  relic-1.5.0-macos-arm64.zip
5048f9b907726a27a3169bfa54d6c72bab0ffbd8dc18911c6c73b1396836436a  relic-1.5.0-macos-x86_64.zip
c99a783e7cd5846d1a47ee25e6e9b653bfee073dec57dc22f5df928d9d5fb74e  relic-1.5.0-windows-x86_64.exe
23444e9ef8308608e783945f5a731e24c98c44d9533ddfa899fd7c886531c23a  relic_re-1.5.0-py3-none-any.whl
d86713892ca017ad3dfafc022183009e38a6ad77189b9c652da086c9805d7c4c  relic_re-1.5.0.tar.gz