Files
Entrpiandmorluto d8aadcc69b feat(ghidra): admit RISC-V ilp32f ELF with a derived calling convention (#8401)
* feat(ghidra): record the RISC-V float-ABI calling-convention decision

Decision D3 (#7477), provisional: admit ELF32 soft-float (ilp32) RISC-V
images through a lane that keeps the pinned RISCV:LE:32:default language and
corrects the calling convention in the bridge.

This commit is the contract only; admission is unchanged.

- The domain owns the e_flags float-ABI vocabulary and parses
  .riscv.attributes and Tag_RISCV_arch into a declared, absent or
  unavailable ISA declaration.
- The Ghidra profile owns the lane table (class and float ABI), lane ids
  built from fields, the ilp32-prototype-v1 policy and its __rea_ilp32
  prototype, and the extensions Ghidra 12.1.4 decodes with p-code.
- The session handshake accepts the bridge's calling-convention report.
- docs/ghidra-riscv.md keeps the decision record and per-ABI policies for
  ilp32 and ilp32f; a test keeps it in step with the tables.
- tests/conformance/c/riscv-float-abi.c is the source the policies were
  measured on.

* feat(ghidra): admit RISC-V ilp32 ELF with a derived calling convention

ESP32-C2, C3, C5, C6, C61, H2 and H21 builds are ELF32 soft-float (ilp32)
images, which the RISC-V lane refused at its double-float check. Ghidra
12.1.4's generic RV32 compiler specification models ilp32d, so its stock
prototype would read float and double arguments from fa0-fa7.

- Target resolution reads the one SHT_RISCV_ATTRIBUTES section through the
  same bounded ELF declaration reader as range validation, and records
  Tag_RISCV_arch as declared, absent or unavailable.
- Admission selects a lane from the class and float-ABI table. The soft-float
  lane also requires an RV32I Tag_RISCV_arch that declares only extensions
  Ghidra decodes with p-code; the refusal names any others (Zcb, Zcmp, Zcmt,
  Zb*, xesp*).
- Soft-float profiles commit float_abi, arch, riscv_calling_convention
  ilp32-prototype-v1 and the lane elf32-exec-le-soft-float-generic-v1.
  Double-float profiles are unchanged.
- ReaGhidraRiscvCallingConvention.java runs after analysis. It derives
  __rea_ilp32 from the default prototype without floating-point entries and
  rules, with fs0-fs11 killed by calls, self-checks its storage and assigns
  it to every non-thunk function, external function and function
  definition. Its report is written last.
- The provider client requires that report exactly when the profile commits
  the policy, before any operation, and keeps it as session limitations and
  caller-project history.

ELF32 single-float (ilp32f), quad-float and ELF64 soft- or single-float
images stay refused, now with a reason built from the lane table.

* test(ghidra): verify RISC-V ilp32 against real Ghidra

verify:ghidra:riscv now also builds tests/conformance/c/riscv-float-abi.c
with ESP32-C3's -march=rv32imc_zicsr_zifencei -mabi=ilp32, typed with DWARF
and linked again with --strip-all. Every allocated section of the stripped
image must keep its address and bytes.

- riscv-checks.mjs holds the ilp32 storage of each fixture function together
  with the words the compiler's call site writes there. An LLVM objdump
  reading of the caller must find every word at its stated location: an
  unaligned named double, the a7/stack split, two floats in an integer pair,
  a large structure by reference, aligned variadic pairs and an indirect
  call.
- Through CLI and stdio MCP, the soft-float builds must report the soft-float
  lane and ilp32-prototype-v1, __rea_ilp32 with exactly that storage (one
  integer word per location when stripped), caller pseudocode that passes the
  source constants and names no floating-point register, the prototype
  outcome in retained Evidence, and decoded fence.i and csrr.
- The RV32 double-float image relabelled as soft-float, refused before, is
  admitted through the new lane. RV64 soft-float, single-float and unsupported
  bits are refused with their reasons.
- riscv-checks.test.ts runs the checks offline against recorded LLVM and
  Ghidra output, including Ghidra's stock ilp32d prototypes as a negative
  control.

* fix(ghidra): pass RISC-V ilp32 values over 8 bytes by reference

The psABI passes any value wider than 2 x XLEN by reference, scalars
included. __rea_ilp32 converted only structures and unions over 8 bytes to
pointers, so a long double (16 bytes) was joined into a1-a4. Measured on
Ghidra 12.1.4, rea_riscv_abi_quad(long double value, int sel) read value
from a4:4,a3:4,a2:4,a1:4 and sel from a5, where clang passes a pointer in
a1 and sel in a2.

- ReaGhidraRiscvCallingConvention.java now has one derivation driven by a
  per-policy row (floating-point entry size, preserved floating-point
  registers). Every policy inserts a rule before the input list's final
  join that converts any value of 9 bytes or more to a pointer; a return
  that size already becomes a caller buffer. The self-check requires a
  16-byte value to pass by reference.
- The fixture gains rea_riscv_abi_quad. The call-site oracle now checks the
  words the by-reference pointers point at, for the large structure and the
  long double, and the recorded data comes from an LLVM 19 build.
- docs/ghidra-riscv.md: the decision record and the ilp32 policy row.

ilp32-prototype-v1 keeps its id: no release carries it yet.

* feat(ghidra): record the RISC-V ilp32f calling-convention decision

Decision D3 (#7477), provisional, gains its ilp32f row: ELF32 images that
declare the single-float ABI are admitted through the lane
elf32-exec-le-single-float-generic-v1 with policy ilp32f-prototype-v1 and
the __rea_ilp32f prototype, keeping the pinned RISCV:LE:32:default language.

- The lane table gains the row, and admission requires the F extension in
  Tag_RISCV_arch beside the decoded-extension check.
- docs/ghidra-riscv.md records how the one-float-one-integer rule is
  realised: the shared derivation's row limits float entries to 4 bytes,
  keeps fs0-fs11 preserved and adds Ghidra 12.1.4's join_dual_class with
  fillalternate for structures of up to 8 bytes. The prototype is the only
  thing that assigns storage: a check of every typed function and
  function-pointer type against the psABI refuses the image when one uses a
  shape the prototype misplaces (a float with two shorts, a pointer or a
  union, _Float16, packed or over-aligned float structures). float _Complex,
  which Ghidra imports as a qword, stays unmodelled. Custom storage for typed
  functions and an unverified-signature admission are recorded alternatives.
- The session report for ilp32f can carry the bridge's refusal instead of
  the outcome; the handshake turns it into the user-facing reason.
- tests/conformance/c/riscv-float-abi.c gains single-float-only shapes and a
  refused variant; the ilp32 build's code is unchanged.

Until the bridge implements the policy (next commit), its post-analysis
script rejects the new policy id and REA refuses ilp32f sessions.

* feat(ghidra): apply the RISC-V ilp32f calling convention in the bridge

ReaGhidraRiscvCallingConvention.java gains ilp32f-prototype-v1 as a row of
its one derivation: float entries limited to 4 bytes, fs0-fs11 preserved,
and structures that Ghidra's dual-class join splits between register files.
The ilp32 row and its checks are unchanged.

- For that row the derivation inserts, before the input and output lists'
  final join, a rule giving structures of up to 8 bytes join_dual_class
  with fillalternate. The shared rule still passes values of 9 bytes or
  more by reference.
- The self-check also pins the storage of a float, double, two-float and
  float-and-int signature, and requires fs0-fs11 preserved.
- After assigning the prototype to every function and function definition,
  the script compares the storage class it gives each signature type, as a
  first argument or return, with the psABI's from the flattened fields. It
  checks every typed function and every definition a pointer type refers
  to. When any signature uses a shape the prototype misplaces, the report
  carries a refusal naming up to eight signatures instead of the outcome,
  and REA refuses the session with that reason.

The launcher test covers both policy ids.

* test(ghidra): verify RISC-V ilp32f against real Ghidra

verify:ghidra:riscv now also builds tests/conformance/c/riscv-float-abi.c
with ESP32-H4's -march=rv32imafc_zicsr_zifencei -mabi=ilp32f, typed with
DWARF and linked again with --strip-all, and a typed build with
REA_RISCV_ABI_UNMODELLED that the bridge must refuse.

- riscv-checks.mjs holds per-ABI tables: the ilp32 and ilp32f storage of
  each fixture function with the words its caller's call site writes there
  (and, for by-reference values, the words the pointer points at), the
  callers, and the indirect calls. Stripped builds record where Ghidra's
  inference differs from one word per typed location.
- The objdump call-site oracle now follows fa registers (flw, fsw, fmv.w.x)
  and tracks stack memory per byte, so word loads see byte and halfword
  stores, across both callers.
- Through CLI and stdio MCP the single-float builds must report the lane,
  ilp32f-prototype-v1 and __rea_ilp32f with the table's storage, including
  float-and-integer structures both ways round, float registers running
  out, long double by reference and an indirect float-and-integer call.
- riscv-isa-probe.S adds fmv.w.x and fmv.x.w when the build has F.
- The unmodelled build opens, then its first analysis call over MCP and the
  CLI fails with the bridge's reason naming its three signatures: a
  function passing a three-field structure, a _Float16 function and a
  function-pointer type passing the three-field structure.
- Header mutations: RV32 double-float relabelled single-float is admitted;
  the soft-float image relabelled single-float lacks F and is refused; RV64
  lp64f and high bits are refused.

* test(ghidra): check RISC-V lane limitations by their facts

The limitation tests froze a full explanatory sentence, the note count and
array positions, so a harmless rewording failed them: the pattern Greptile
flagged on #7486. Assert the facts the notes must carry instead: the pinned
language, the static-linkage boundary, one note naming the declared ABI,
the ABI the pinned language models and the prototype REA applies, and the
declared ISA.

* test(ghidra): check the ilp32f limitations by their facts

Like the ilp32 tests, the ilp32f test froze its explanatory sentence, the
note count and array positions. Assert one note naming the declared ilp32f
ABI, the modelled ilp32d and the applied `__rea_ilp32f` prototype, and the
declared ISA.

* test(ghidra): check return storage in stripped RISC-V ilp32 builds

The stripped branch of assertRiscvIlp32Storage compared parameter storage
only, so an inferred return that lost the high word of a register pair,
such as rea_riscv_abi_wide at a0:4 instead of a1:4,a0:4, still passed.

Stripped returns must now use the typed build's storage, or none when the
result goes through caller memory. Recovered type names are still not
compared: a test accepts other type names and refuses the dropped high word.

* docs(ghidra): record decision D3 as decided in #7477

* fix(ghidra): flatten RISC-V arrays and bit-fields as the psABI does

The ilp32f signature check flattened a by-value type differently from
GCC and Clang in two shapes. A nonzero array of empty C++ classes added
no fields, so struct { E e[1]; char c; float f; } looked like a char and
a float, and the policy admitted a float-and-integer split for a value
both compilers pass in two integer registers. A bit-field was bounded by
its declared type, so a float beside unsigned long long b : 1 used the
integer convention, and the image was refused although __rea_ilp32f
places it as the compilers do. An array element with no fields now makes
the array use the integer convention, and a bit-field counts by its
width.

Arrays are also classified once per element type, so an array of empty
structures no longer costs one visit per element, and a refusal keeps
its counts and at most eight shortened examples instead of every
description.

The unmodelled build gains a C++ source with the empty-class array,
which the refusal must name, and a bit-field function it must not.

* fix(ghidra): refuse flexible array members in ilp32f signatures

A float beside a flexible array member flattened to a single float, so
the policy admitted fa0 for a value Clang passes in a0. Ghidra imports
the member as a trailing array without elements, which the walk skipped
as a zero-length member. A trailing array without elements now makes the
value use the integer convention. Ghidra imports a trailing [0] the same
way, and Clang passes that in fa0, so such a structure fails closed too.
The unmodelled build gains a flexible-array function the refusal must
name.

* docs(ghidra): state that hidden-reference C++ classes are not modelled

Compilers pass a C++ class with a non-trivial copy constructor or
destructor through a hidden pointer, but Ghidra 12.1.4 keeps only its
fields, and GCC 14.2 writes no DW_AT_calling_convention, so the ilp32f
check cannot detect such a signature. Sessions now state this as a
limitation, and the guide lists it as not modelled.

* fix(ghidra): refuse ilp32f shapes and D hardware the prototype misplaces

A flexible array that starts inside a structure's padding passed the
offset check, so its float took fa0 where GCC and Clang use a0. The
position among the members now decides. A bare array in a signature can
only be a GNU vector, which uses the integer convention, so the policy
stops flattening it.

With D the ABI preserves only the low 32 bits of fs0-fs11 and Ghidra's
model preserves all 64, so the lane refuses d and zcd.

Ghidra's import erases float _Complex, a vector inside a structure and
_Atomic, so ilp32f sessions now state those limits.

* fix(ghidra): refuse ilp32f values Ghidra left untyped

Ghidra's DWARF import gives an encoding it does not map an untyped
byte, word, dword or qword, so float _Complex, which takes two float
registers, showed as an integer in a0 and a1. The policy cannot know
such a value's class, so it now refuses any value of up to 8 bytes that
holds one, alone or inside a structure. The session limitation no
longer lists complex values.

* docs(ghidra): match the RISC-V verification notes to the lane

* fix(ghidra): refuse padded untyped RISC-V values

An over-aligned structure of one float _Complex is 16 bytes, so the
8-byte guard let it fall through to a reference, although GCC and Clang
pass it in fa0 and fa1. Decide on the bytes the fields hold, which is
what the float convention limits, not on the padded length.

* fix(ghidra): walk each RISC-V field type once

The held-bytes and untyped checks revisited a nested type for every
member, so a chain of structures that each hold two of the last one
cost about 2^29 calls before any size check. One cached walk now
answers both, once per type.

* fix(ghidra): refuse ilp32f values whose bytes may hide a bit-field

DWARF omits unnamed bit-fields of nonzero width, which the psABI counts:
Clang 19 passes struct { float f; unsigned : 1; } in fa0 and a0, and a
following int in a1, while Ghidra sees one float in 8 bytes. A value
with a float whose structure has bytes that no member and no natural
alignment padding explain now has an unknown class, so the policy
refuses the image. Over-aligned structures of up to 8 bytes are refused
too. verify:ghidra:riscv's unmodelled build passes such a structure.

* perf(ghidra): cache the ilp32f layout checks per type, document padding

unexplainedBytes and naturalAlignment recomputed nested types on every
chain, so a deeper nesting cost quadratically more. Both now keep one
result per stripped DataType, as held() does.

The guide now states that an unnamed bit-field in natural padding, as in
struct { char c; unsigned : 1; float f; }, leaves no DWARF trace: Clang 19
passes it in a0 and a1 but the lane admits it with the float in fa0.
Refusing every padded float value would also refuse common layouts.

* fix(ghidra): refuse ilp32f union parameters that may be transparent

A transparent union passes as its first member, but DWARF does not record
the attribute: Clang 19 passes union { struct { float f; } s; unsigned u; }
with transparent_union in fa0, while Ghidra and the psABI class see an
ordinary union in a0, so the lane admitted wrong storage. A union parameter
whose first member would take a float register now refuses the policy,
unless Clang would ignore the attribute: a floating-point first member, or
another member of a different size or alignment. Returns are unaffected.
verify:ghidra:riscv's unmodelled build passes one such union and three
ordinary ones.

* fix(ghidra): refuse ilp32f float parameters of old-style C definitions

Callers of an old-style (K&R) definition such as float f(x) float x;
promote the argument to double: Clang 19 passes it in integer registers
and narrows it with __truncdfsf2. DWARF still declares a float and only
omits DW_AT_prototyped, which Ghidra 12.1.4's DWARF import drops, so the
lane placed it in fa0. When a typed signature has a float parameter, the
script now reads DWARF again for C subprograms without DW_AT_prototyped
and refuses the policy for their float parameters. C++ and other
languages never mark the attribute and are not checked.
verify:ghidra:riscv's unmodelled build passes one such definition.

* fix(ghidra): admit a direct C++ empty-class member in an ilp32f structure

Ghidra imports a C++ empty class as a one-byte structure without
components, so the unexplained-bytes check counted its byte as an omitted
field. A structure such as `struct S { E e; char c; float f; }` was then
UNKNOWN and refused the whole ilp32f image, although GCC 14.2 (ESP-IDF)
and Clang 21.1.8 ignore the member when flattening and pass S in a0 and
fa0, the storage the derived float-and-integer rule gives it.

The check now treats a one-byte structure without components as that
storage. A nonzero array of empty classes still uses the integer
convention and stays refused. The unmodelled fixture gains
rea_riscv_abi_member, which the real-Ghidra verifier requires to be
admitted, and the guide names the shape.

* fix(ghidra): refuse RISC-V functions compiled from a language without the C psABI

Both RISC-V calling-convention policies apply a C psABI prototype to every
function, so code from a language with another calling convention, such as
Rust's default ABI, was silently given the wrong storage. Before either
policy installs its prototype, the bridge now reads the image's DWARF once
and refuses the image when a compile unit outside C, C++ and assembly, or
one without DW_AT_language, defines a function with code, naming each
language. The same pass collects the old-style C definitions the ilp32f
check needs, which were read lazily before. This also changes main's ilp32
policy, which had no refusal path. Code that no DWARF compile unit
describes cannot be checked, and every session that applies a policy now
states that limitation.

* test(verify): refuse RISC-V fixtures whose C compile units are labelled Rust

The real RISC-V lane rewrites the DW_AT_language of each C compile unit in
the typed soft- and single-float builds to Rust, with a bounds-checked
reader of the units' abbreviations, and checks that each policy refuses the
image and names the language. The unlabelled builds are the controls.

* fix(ghidra): refuse ilp32f values whose register fields do not start their parts

The psABI puts each flattened field of a structure passed in float
registers at bit 0 of its own register, while __rea_ilp32f's dual-class
join gives each register a 4-byte part of the value as laid out in memory.
Both agree only when every such field starts its part. A C++ empty member
keeps its byte although the psABI ignores it as a field, so the char of
struct { E e; char c; float f; } passes in bits 0-7 of a0 while the
prototype reads bits 8-15; the policy compared only storage classes, which
match, and admitted it. Flattening now records each field's bit position,
and a value whose float-register fields do not each start their own part
is refused, which also covers packed layouts and bit-fields above bit 0.
The unmodelled fixture's caller now shows where the compiler puts that char.

* docs(ghidra): keep RISC-V guide focused on ABI rules and compatibility

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-24 17:02:19 +00:00

46 KiB
Raw Permalink Blame History

RISC-V ELF analysis through Ghidra

This lane extends native ELF analysis for EM_RISCV targets. It does not execute RISC-V code, emulate a boot sequence, or rehost firmware. It addresses #2063 and follows the same lane shape as generic MIPS support.

Admission boundary

ELF EM_RISCV (243) is retained as the provider-neutral riscv family. The target also retains the raw ELF declarations that decide a lane: class, byte order, e_type, e_flags, and the ISA string that .riscv.attributes declares. Recognition does not mean every provider or RISC-V variant is supported. Existing PE, managed and Mach-O architecture sets are unchanged. Headerless inputs use the separate raw-binary admission boundary; raw RISC-V images are not supported.

The Ghidra lane admits little-endian ET_EXEC images and position-independent executables (ET_DYN with PT_INTERP) with no EF_RISCV_RVE, EF_RISCV_TSO, or any bit outside EF_RISCV_RVC | EF_RISCV_FLOAT_ABI, in one of the supported lanes:

  • ELF64 or ELF32 images that declare EF_RISCV_FLOAT_ABI_DOUBLE use Ghidra's stock double-float model unchanged. Their .riscv.attributes is not read for admission.
  • ELF32 ET_EXEC images that declare the soft-float ABI (e_flags float-ABI bits 0, ilp32) use REA's ilp32 calling-convention policy. They must also declare an RV32I base and only decoded extensions in Tag_RISCV_arch. Soft-float PIE images remain refused.
  • ELF32 ET_EXEC images that declare EF_RISCV_FLOAT_ABI_SINGLE (ilp32f) use REA's ilp32f calling-convention policy. They must declare an RV32I base, the F extension, only decoded extensions, and not the D extension. Single-float PIE images remain refused.

These are header declarations, not proof that every instruction conforms to that ISA.

Provider selection returns the specific unsupported constraint rather than guessing a compatible profile:

Declaration Outcome
Little-endian ELF64 ET_EXEC or PIE (ET_DYN), double-float ABI admitted, RISCV:LE:64:default + gcc, lane elf64-exec-le-double-float-generic-v1 or elf64-pie-le-double-float-generic-v1
Little-endian ELF32 ET_EXEC or PIE (ET_DYN), double-float ABI admitted, RISCV:LE:32:default + gcc, lane elf32-exec-le-double-float-generic-v1 or elf32-pie-le-double-float-generic-v1
Little-endian ELF32 ET_EXEC, soft-float ABI, decoded extensions only admitted, RISCV:LE:32:default + gcc with the __rea_ilp32 prototype, lane elf32-exec-le-soft-float-generic-v1
Little-endian ELF32 ET_EXEC, single-float ABI, F and decoded extensions admitted, RISCV:LE:32:default + gcc with the __rea_ilp32f prototype, lane elf32-exec-le-single-float-generic-v1
ELF32 soft-float PIE (ET_DYN) refused; soft-float position-independent executables need separate load verification
ELF32 soft- or single-float ABI without Tag_RISCV_arch, or with any other extension refused; the reason names the extensions outside the decoded set
ELF32 single-float ABI without the F extension refused; the ABI needs F
ELF32 single-float ABI with the D extension refused; Ghidra's model preserves more of fs0–fs11 than the ABI does
ELF32 single-float image whose signatures __rea_ilp32f cannot express refused after analysis; the reason names the signatures (ilp32f)
ELF32 single-float PIE (ET_DYN) refused; single-float position-independent executables need separate load verification
ELF64 soft- or single-float ABI (lp64, lp64f), or the quad-float ABI refused; no verified calling-convention policy
Big-endian refused; the 12.2 language definitions contain no big-endian RISC-V language
ET_DYN without PT_INTERP (shared library) refused; shared libraries without PT_INTERP need separate load verification
ET_REL, other e_type refused with the declared value
EF_RISCV_RVE refused; the embedded 16-register profile (x0–x15) needs its own processor specification
EF_RISCV_TSO refused; the total-store-order memory model is unverified here
Reserved or newer e_flags bits refused with the offending bits named
One NOBITS section covering an ET_EXEC code section from its start admitted if no other section overlaps either; REA prepares the memory map before analysis
The same reservation in a position-independent executable (PIE) refused; REA verifies that preparation for ET_EXEC images only
Any other section overlap involving executable code refused; the reason names the two sections that cause the refusal, with their ranges
A section table that cannot be read, or with more than 65,280 allocated sections refused with the read failure or the count; REA rejects most malformed tables when it opens the file

e_type, program headers and, for executables, the section overlaps decide the load model this lane reads. A fixed-address ET_EXEC declaration does not establish static linkage: dynamic dependencies are not inspected, and the session records that boundary as a limitation rather than inferring a load model. Position-independent executables (ET_DYN with PT_INTERP) are admitted using Ghidra's default analysis base (0x10000 for RV32, 0x100000 for RV64); runtime load addresses and dynamic linker relocations are not executed or verified.

Why the language is pinned

Ghidra's header-based selection is not reliable for RV32. In the 12.2 release tree, riscv.opinion pins variant="default" for the 64-bit constraint and leaves the 32-bit constraint unpinned with the comment that the loader "must choose between 'default' and 'AndeStar' variants". Auto-selection was measured against the earlier 12.1.4 release tree and has not been re-measured on 12.2:

Fixture Ghidra auto-selection
RV64 ELF, e_flags 0x5 (RVC, double-float ABI) RISCV:LE:64:default:gcc
RV32 ELF, e_flags 0x5, no Andes declaration RISCV:LE:32:AndeStar_v5:gcc

So, on that 12.1.4 tree, an ordinary RV32 image lands on an Andes processor model unless the language is stated. REA therefore pins RISCV:LE:32:default or RISCV:LE:64:default with the gcc compiler specification per class, records language_selection: provider-pinned, and refuses a caller-selected REA_GHIDRA_LANGUAGE_ID or REA_GHIDRA_COMPILER_SPEC_ID that disagrees with the pin without changing the requested override. An override that matches the pin is accepted and recorded as configured.

The soft-float lane pins the same RISCV:LE:32:default language. In the 12.2 language definitions, every generic RV32 language, including the deprecated soft-float RV32I, RV32IC and RV32IMC variants in old/riscv_deprecated.ldefs, uses the same riscv.ilp32d.sla decoder; only the compiler specification differs. The separate RISCV:LE:32:AndeStar_v5 language uses andestar_v5.sla. REA keeps the generic language and corrects the calling convention instead.

Calling conventions

Ghidra's generic RV32 compiler specification, riscv32-fp.cspec, models the ilp32d ABI. Its default prototype passes float and double values in fa0–fa7 and returns them in fa0, and it passes a structure of one or two floating-point members in floating-point registers. An ilp32 image passes all of these in integer registers. Recorded on Ghidra 12.1.4 (no longer accepted); not yet re-run on 12.2. With an ilp32 build of the fixture in tests/conformance/c/riscv-float-abi.c, the stock model decompiled rea_riscv_abi_pick(1.5f, 2.5f, sel) as rea_riscv_abi_pick(in_fa0,in_fa1,0x3fc00000). An ilp32f image passes float values as ilp32d does, but double values in integer registers, and a structure of one float and one integer in fa0 and a0; the stock model joined that structure into a1:a0.

Source languages

Both policies model the C psABI. C++ follows it under the Itanium C++ ABI, except for the classes in the ilp32f limits that compilers pass through a hidden pointer. Other languages need not follow it: Rust's default ABI, for example, passes some small aggregates by reference or as two scalars where the C psABI joins them into integer registers. Before either policy installs its prototype, the script reads the image's DWARF once. It refuses the image when a compile unit whose DW_AT_language is not C, C++ or assembly defines a function with code, and names each such language with a count and an example. A compile unit without DW_AT_language is refused the same way. This applies to the ilp32 policy too, which until this check admitted such images.

The check reads only DWARF. Functions that no compile unit describes, such as every function of a stripped image, or library code built without debug information, are not checked and are taken to follow the C psABI. A limitation states this on every session that applies a policy.

Policy application and compatibility

After analysis on the pinned RISCV:LE:32:default language with gcc, ReaGhidraRiscvCallingConvention.java derives the program-specific prototype (__rea_ilp32 or __rea_ilp32f) from the program's default prototype, installs it through a Ghidra specification extension, and assigns it with dynamic storage to every non-thunk function, every external function, and every function definition. Thunks follow their targets.

The bridge reports the applied policy together with its function and definition counts, and REA requires that report whenever the analysis profile commits riscv_calling_convention. If a policy check fails—for example, if __rea_ilp32 or any function still places a value in a floating-point register or fails to pass a 16-byte value by reference, or if __rea_ilp32f encounters a signature shape it cannot place—the script refuses the policy and REA serves no analysis of the image.

Double-float profiles keep their exact parameters, so their digests, sessions, and snapshots are unchanged. Soft- and single-float profiles add riscv_elf.float_abi, riscv_elf.arch, and riscv_calling_convention alongside their lane ids; those fields are persisted in sessions, snapshots, and Evidence once released. Any future change to a policy derivation must ship under a new policy id (for example ilp32-prototype-v2) so that only that lane's snapshots are invalidated. The design rationale and alternatives considered for these policies are recorded in #7477.

ilp32

Policy ilp32-prototype-v1, prototype __rea_ilp32. XLEN is 32 bits and no floating-point register passes a value.

Topic psABI rule __rea_ilp32
Integer and pointer values a0–a7, then the stack in 4-byte-aligned slots The default integer and stack entries, unchanged
float One integer register, or a stack slot The fa0–fa7 entries and the float rule are removed, so a float takes the next integer register
double and 8-byte values A register pair with the low word in the lower register. Named arguments need no aligned pair. With one register left, the low word goes in a7 and the high word on the stack The default join rule with stack spill: Ghidra writes a2:4,a1:4 for a pair and Stack[0x0]:4,a7:4 for the split
Aggregates up to 8 bytes One or two integer registers, laid out as in memory, also when every member is floating-point The homogeneous-float-aggregate rule is removed; the join rule applies
Aggregates over 8 bytes By reference: the caller passes the address of a copy The default rule that converts structures and unions of 9 bytes or more to pointers
Return values As the first argument of the same type: a0, or a0 and a1. Larger values go to a caller buffer whose address is an implicit first argument in a0 The fa0/fa1 return entries and floating-point rules are removed; Ghidra's hidden-return fallback supplies the pointer in a0
Variadic arguments The integer convention. A variadic argument with 8-byte alignment and size takes an aligned (even-numbered) register pair, or the stack; after the first stack argument, the rest go on the stack The default variadic rule (join with alignment), unchanged
Preserved registers s0–s11 and sp; gp and tp are not allocated. No floating-point register is preserved The default preserved list without fs0–fs11, which join the killed-by-call list
Scalars over 8 bytes By reference (long double is 16 bytes), and returned through a caller buffer A rule before the final join converts any value of 9 bytes or more to a pointer; a return that size already goes to a caller buffer

Ghidra recovers the arguments of a variadic call from the registers the caller writes, not from their types. A padding register that still holds an earlier value can appear as an argument, and arguments after an unwritten register are omitted.

ilp32f

Policy ilp32f-prototype-v1, prototype __rea_ilp32f. ABI_FLEN and XLEN are 32 bits.

Topic psABI rule __rea_ilp32f
float fa0–fa7 while one is free, then the integer convention The default float rule with the floating-point entries limited to 4 bytes. With no float register free, Ghidra falls back to the integer entries
double and other scalars of 5 to 8 bytes The integer convention, as in ilp32 The floating-point entries take no value over 4 bytes, so the default join rule applies: a2:4,a1:4 for a pair, Stack[0x0]:4,a7:4 for the split
Structure of one or two floats, after flattening One floating-point register per member when enough are free, otherwise the integer convention The default homogeneous-float-aggregate rule, which assigns every member or none
Structure of one float and one integer, in either order One floating-point and one integer register when both are free, otherwise the integer convention New rule: a structure of up to 8 bytes takes join_dual_class with fillalternate. A 4-byte part that holds exactly one float takes the next float register and every other part the next integer register, all or nothing; else the join rule applies
Other structures of up to 8 bytes, such as three or more fields, a pointer, or a union The integer convention Where the new rule would split one, the policy refuses the image (below)
Unions Never flattened; the integer convention The default rules
Values over 8 bytes By reference The default rules for structures and unions, and the rule every policy shares, which passes any other value of 9 bytes or more, such as long double, by reference
Return values As the first argument: fa0, fa0 and fa1, or fa0 and a0; by reference over 8 bytes The return entries are limited to 4 bytes and take the same structure rule; Ghidra's hidden-return fallback supplies the pointer in a0
Variadic arguments The integer convention, as in ilp32 The default variadic rule, unchanged
Preserved registers s0–s11, sp, and fs0–fs11 for values of 32 bits or fewer The default preserved list, including fs0–fs11

With the D extension the psABI preserves only the low 32 bits of fs0–fs11, and Ghidra's model preserves the whole 64-bit registers, so the decompiler could carry a wider value across a call. Admission refuses a Tag_RISCV_arch that declares d or zcd with this ABI.

The psABI flattens nested structures and arrays and counts each named bit-field, _Bool, char and enumeration as an integer field; LLVM treats a pointer as neither a float nor an integer. Measured on Ghidra 12.1.4 against the call sites of LLVM 19, the new rule places struct { float; int; }, struct { char; float; }, a nested float beside an int, and a float beside a bit-field in a float and an integer register. That holds both ways round, when float or integer registers run out, for returns, and at indirect calls. The same rule splits struct { float; short; short; }, struct { float; void *; } and a float beside a union, which LLVM passes in integer registers.

The prototype is the only thing that assigns storage. After assigning it, ReaGhidraRiscvCallingConvention.java checks every parameter and return type of every function signature and function-pointer type: it compares the storage class __rea_ilp32f gives a first argument or a return value of that type with the class the psABI gives it. The script refuses the policy when any signature passes a type the prototype misplaces:

  • a structure the new rule would split that the psABI passes in integer registers, such as the three above, a C++ structure with a nonzero array of empty classes, which GCC and Clang do not ignore when they flatten it, or a structure with a flexible array member, wherever it starts. Ghidra imports a trailing [0] array the same way, so a structure with one is refused too, although Clang passes it in a float register;
  • a GNU vector of floats, which Ghidra imports as an array. It uses the integer convention, and C passes no array by value, so a parameter or return that Ghidra shows as an array is treated as a vector;
  • a type the psABI places in float registers where the prototype cannot: _Float16, a packed structure whose float is not 4-byte aligned, or an over-aligned structure of more than 8 bytes;
  • a value whose fields hold up to 8 bytes, whatever padding alignment adds, and include an untyped byte, word, dword or qword. Ghidra's DWARF import uses these for an encoding it does not map, so the policy cannot know the value's class. float _Complex, which takes two float registers, arrives as a qword. The stock double-float lanes show it as an integer.
  • a value with a float whose structure has bytes that no member and no natural alignment padding account for. DWARF omits an unnamed bit-field of nonzero width, which the psABI still counts: Clang 19 passes struct { float f; unsigned : 1; } in fa0 and a0, and a following int in a1, while Ghidra sees one float in 8 bytes. An over-aligned structure of up to 8 bytes looks the same and is refused too. An unnamed bit-field that fits inside a named bit-field's storage unit, or in padding that natural alignment adds, leaves no trace, so the check cannot see it: Clang 19 passes struct { char c; unsigned : 1; float f; } in a0 and a1, and its DWARF lists only c and f, so the lane admits it with the float in fa0. Refusing every padded value with a float would also refuse common layouts such as struct { char c; float f; }, which takes a0 and fa0. A C++ empty class, which Ghidra imports as a one-byte structure without members, is its own storage, not an omitted field.
  • a value whose float-register fields do not start the 4-byte parts the prototype reads them from. The psABI puts each flattened field at bit 0 of its own register, while the prototype gives each register a 4-byte part of the value as laid out in memory. GCC 14.2 and Clang 21.1.8 ignore a C++ empty class as a member, but it keeps its byte, so struct { E e; char c; float f; } passes c in bits 0-7 of a0 although it lies in byte 1, where the prototype would read it from bits 8-15. A packed layout or a bit-field above bit 0 of its part moves a field the same way.
  • a union parameter that may be a transparent union taking a float register. A transparent union passes as its first member, and DWARF does not record the attribute, so Ghidra sees an ordinary union in integer registers: Clang 19 passes union { struct { float f; } s; unsigned u; } with transparent_union in fa0. Clang ignores the attribute when the first member is a floating-point type or another member differs from it in size or alignment, so union { float f; uint32_t u; } and unions with an integer first member are admitted. GCC 14.2 ignores the attribute whenever the first member would take a float register, so this also refuses some GCC images whose unions are placed right. Returns are not affected.
  • a float parameter of an old-style (K&R) C definition, such as float f(x) float x;. Callers promote the argument to double, which Clang 19 passes in integer registers, while DWARF still declares a float and only omits DW_AT_prototyped. Ghidra 12.1.4's DWARF import drops that attribute, so the script reads DWARF again for it, and only when a typed signature has a float parameter. C++ and other languages do not mark the attribute and are not checked.

A bit-field counts by its width, not its declared type, so a float beside unsigned long long b : 1 takes a float and an integer register. The check treats typed functions and function-pointer types alike; Ghidra's decompiler computes the storage at an indirect call from the prototype. A refusal counts every misplaced signature and names up to eight, and REA then refuses the session.

Not modelled:

  • Ghidra 12.1.4 keeps no vector marker on an array, so a GNU vector inside a structure looks like float[2] and shows in fa0 and fa1. GCC 14.2 and Clang 19 use integer registers. A limitation states this.
  • Ghidra 12.1.4 resolves _Atomic(float) to float, so the policy places it as a float. That matches GCC 14.2, but Clang 19 uses integer registers, alone and in a structure. A limitation states this.
  • A C++ class with a non-trivial copy constructor or destructor is passed through a hidden pointer, but Ghidra 12.1.4 keeps only its fields, so struct N { float f; N(const N&); ~N(); } shows as a float in fa0. Ghidra's DWARF importer does not read DW_AT_calling_convention, and GCC 14.2 does not write it, so the policy cannot detect these signatures and does not refuse them. A limitation states this.
  • Ghidra recovers the arguments of a variadic call from the registers the caller writes, as for ilp32.

ilp32d and lp64d

The double-float lanes use Ghidra's stock riscv32-fp.cspec and riscv64-fp.cspec models unchanged. This page does not verify them. They lack the float-and-integer structure rule above: the stock model joins struct { float; int; } into integer registers.

ISA declarations

The target reader finds the one SHT_RISCV_ATTRIBUTES section and reads Tag_RISCV_arch, such as rv32i2p1_m2p0_c2p0_zicsr2p0_zifencei2p0. It retains the string, the base and the extension names, or an unavailable reason when the section is malformed, declares other vendors or scopes, or uses a non-canonical string. A missing section or tag is recorded as absent.

Calling-convention lanes admit an image only when it declares an RV32I base and only extensions the generic RV32 language implements with p-code in the 12.2 SLEIGH sources: m, a, f, d, c, zicsr, zifencei, and the subset names toolchains record, zmmul, zaamo, zalrsc, zca, zcf and zcd. Any other extension is refused. In particular, in those 12.2 sources:

  • Ghidra decodes no Zcb, Zcmp or Zcmt instruction.
  • Its bit-manipulation, cryptography and packed-SIMD files follow draft encodings and mark nearly every instruction unimplemented.
  • Vendor extensions, such as Espressif's xesploop, xespv and xespdsp, decode only as custom-opcode placeholders.

ESP-IDF builds ESP32-C2 and C3 images as rv32imc_zicsr_zifencei and ESP32-C5, C6, C61, H2 and H21 images as rv32imac_zicsr_zifencei_zaamo_zalrsc, all ilp32. ESP-IDF 5.5 builds ESP32-H4 images as rv32imafc_zicsr_zifencei with the ilp32f ABI. Those base strings are admitted. Builds that add _zba_zbb_zbs, _zcb_zcmp_zcmt or an xesp extension are refused. That includes ESP-IDF 5.5's ESP32-P4 images, rv32imafc_zicsr_zifencei_xesppie with the ilp32f ABI, until the decoding of the vendor PIE extension is verified. These images also reserve their flash text's addresses; load layout states which layouts the lane admits.

Load layout

Section addresses are load addresses in an ET_EXEC image and fixed offsets from the load base in a PIE, so an overlap does not depend on the base. The target reader checks both for an executable section that shares allocated addresses with another section; relocatable sections have no addresses yet. The check keeps at most 65,280 allocated sections (SHN_LORESERVE); a table with more is refused like a table that cannot be read. ESP-IDF builds such overlaps. For ESP32-C5, C6, C61, H2, H21 and H4, flash text and rodata share one virtual window from 0x42000020, and the linker script reserves the text's addresses in the rodata segment with the NOBITS section .flash_rodata_dummy. For C5 and C61, a second NOBITS section, .ext_ram.dummy, also reserves the text and rodata addresses for external RAM. Ghidra 12.2's ELF loader, like 12.1.4's, resolves overlapping sections in favour of the later one: the reservation takes the default address space and .flash.text goes into an overlay space. Ghidra 12.2 also gives each section the permissions of the first PT_LOAD that contains its address, so the reservation can be marked executable; REA tells it from the code by its missing bytes. Ghidra's DWARF importer, its call-frame (FDE) processing and references from other code and data resolve ELF virtual addresses in the default space only. Without preparation, code in that overlay gets no DWARF signature, local variables or DW_AT_noreturn flag, each of its functions gets a one-byte shadow function in the reservation, and pseudocode continues past calls to no-return functions such as esp_restart.

When one NOBITS section starts at an executable PROGBITS section's address and covers it, and no other section overlaps either, the lane commits both sections to the analysis profile as elf_load_preparation (policy nobits-reservation-overlay-v1). Before auto-analysis, ReaGhidraPrepareElfLoad.java gives the code the default address space and the reservation an uninitialized overlay instead:

  • The file bytes and their offsets do not change. A new default-space block maps the code's file range, and the overlay maps no file bytes, so each file offset keeps one address.
  • The loader's symbols and functions move with the code, and so do the references into it: its entry points and the loader's section-header reference. So does everything else in the code's overlay space, such as ESP-IDF's section-relative _etext just past the code's last byte. Ghidra pins absolute ELF symbols such as _text_start; they keep their addresses.
  • Labels in the reservation, such as _flash_rodata_dummy_start, move into its overlay. They mark no entry points, because the reservation holds no code. An entry mark that Ghidra's loader gave such a label stays at its default-space address. Inside the code, Ghidra could start a function at that mark; REA neither removes nor checks it. No surveyed image has such a mark (source-derived).
  • Flash code therefore has its ELF address, for example 0x42002ab6 rather than .flash.text:0x42002ab6.
  • The reservation's overlay space takes the name that Ghidra's memory map gives an overlay block: : and whitespace become _, and a name that another address space already has gains .1, .2 and so on. A reservation named ram, the RISC-V default space's name, therefore gets the space ram.1. Section names are display labels, so no name causes a refusal.

Before it reports moved, the script checks that no symbol or reference remains in the code's old overlay space. It reports canonical when Ghidra already loaded the code in the default space, which happens when the reservation comes first in the section table. The moved report echoes both blocks the script left, and canonical the code block: name, address, size, the code's file offset, and the address space before and after. REA closes the session unless each address, size and file offset is the committed section's, and the spaces agree with the outcome: moved code goes from an overlay into the default space and the reservation out of it, and canonical code stays in the default space. Block names are display only and are not compared. The script refuses any other memory map, and REA refuses the session with the mismatch. A refusal also turns off Ghidra's headless auto-analysis, so Ghidra does not analyze a program that REA discards; later pre-scripts and the bridge still run, so the session reports the reason. If Ghidra fails during the move, the session is also refused. Ghidra probably rolls back the failed script's changes, its refusal included, so the reason may be missing (inferred; not tested). Session Evidence states the preparation and its outcome.

The lane refuses any other overlap that involves executable code. Examples are two code sections at one address, a reservation that does not cover the code, a third section that overlaps the reservation, and a second reservation such as .ext_ram.dummy. The reason names the two sections that cause the refusal, with their ranges. Overlaps between data sections only are outside this check, and so are images without a section table, which Ghidra loads from their program headers.

ESP-IDF v5.5.2's C5 and C61 builds declare .ext_ram.dummy, so this lane refuses them. To analyze such a build, make a transformed copy without that section header:

llvm-objcopy --remove-section=.ext_ram.dummy app.elf app-no-ext-ram-dummy.elf

The copy has the prepared shape. REA admitted and prepared such a copy of a v5.5.2 C5 hello_world build; C61 copies were not tried. Evidence identifies the copy, not the original image.

Evidence

The lane identity is one of the lane ids above, and riscv_elf retains elf_class, byte_order, type, and the raw flags alongside the read-only booleans float_abi_double, rvc_declared, rve_declared, and tso_declared. For PIE images, riscv_elf also records has_interpreter: true, load_model: "pie", and the expected default image base (expected_default_image_base: "0x10000" for RV32, "0x100000" for RV64). Soft- and single-float profiles also retain float_abi (soft or single), the declared arch string, and riscv_calling_convention (ilp32-prototype-v1 or ilp32f-prototype-v1). Those fields report declarations the header and attributes make, and the policy REA applied; none of them is evidence of the original compiler or of instruction conformance. Session Evidence states the prototype and how many functions and definitions use it. An image that needs the load layout preparation also commits elf_load_preparation: the policy, each section's index, name, address and size, and the code's file offset.

Verification and limits

Use the supported Ghidra and JDK range. On macOS the official release zip ships no host decompiler binary, so Decompiler/os/<platform>/decompile and sleigh must come from your own build; see that page and #7018 / #7019.

Run npm run verify:ghidra:riscv with that installation and a RISC-V-capable Clang, LLD, LLVM readelf and LLVM objdump. The verifier acquires no tools and never executes target code. Select installed tools explicitly when they are not on PATH:

GHIDRA_INSTALL_DIR=/path/to/ghidra_12.2_PUBLIC \
JAVA_HOME=/path/to/jdk-25 \
REA_RISCV_CLANG=/path/to/llvm/bin/clang \
REA_RISCV_LLD=/path/to/lld/bin/ld.lld \
REA_RISCV_READELF=/path/to/llvm/bin/llvm-readelf \
REA_RISCV_OBJDUMP=/path/to/llvm/bin/llvm-objdump \
npm run verify:ghidra:riscv

The six non-ESP double- and soft-float fixtures passed on Ghidra 12.2 with JDK 25 on macOS arm64, using Homebrew LLVM and LLD 23.1.2; the ten-fixture double-, soft-float and ESP lane passed on Ghidra 12.2 with JDK 25 on Linux x64; the single-float fixtures have not been run on macOS arm64.

The lane builds fifteen fixtures from committed freestanding C and assembly sources:

  • RV32 and RV64 double-float builds (rv{32,64}imafdc) of riscv.c, each linked as ET_EXEC and as a PIE.
  • An RV32 soft-float build of riscv-float-abi.c with ESP32-C3's -march=rv32imc_zicsr_zifencei -mabi=ilp32, and an RV32 single-float build with ESP32-H4's -march=rv32imafc_zicsr_zifencei -mabi=ilp32f, both typed with DWARF.
  • The same objects of each linked with --strip-all. Every allocated section keeps its address and bytes, so the typed build's symbols locate its functions.
  • The single-float build with REA_RISCV_ABI_UNMODELLED, which adds a function that passes and returns a three-field structure, a _Float16 function, a function-pointer type that passes the three-field structure, functions that pass a structure with a flexible array member, at the end of the structure and inside its padding, the second beside a structure whose unnamed bit-field DWARF omits, a function that passes a GNU vector, a function that passes float _Complex alone, in a structure and in an over-aligned structure, and, from riscv-float-abi-empty.cpp, a function that passes a structure with an array of one empty class, a function that passes an empty class beside a char and a float, and a caller that passes it known values. It also adds functions that pass a structure of one float[2], a float beside a one-bit field of a 64-bit type, and two float _Complex fields, which the policy admits.
  • The typed soft- and single-float builds with each C compile unit's DW_AT_language rewritten to Rust (0x1c). The assembly units keep theirs.
  • An RV32 soft-float build of riscv-esp-layout.c with ESP32-C6's -march=rv32imac_zicsr_zifencei -mabi=ilp32, linked with tests/conformance/esp/esp32c6-shared-window.ld. As ESP-IDF does, it places .flash.text and the NOBITS .flash_rodata_dummy at 0x42000020, with the absolute _text_start and _text_end, the section-relative _etext and the reservation's _flash_rodata_dummy_start.
  • The same objects linked with esp32c6-reservation-first.ld, which puts the reservation before the code in the section table.
  • The same objects linked with esp32c6-reservation-named-ram.ld, which names the reservation ram, as the default address space is named.
  • The same objects linked with esp32c6-edge-names.ld, which names the reservation and a disjoint section like the preparation's temporary blocks.

PIE admission checks that the PT_INTERP declaration has an in-file range large enough for a pathname byte and its terminator. The verifier checks the real provider's load base and relocated probe bytes and checks refusal of ET_DYN without PT_INTERP. REA never invokes the target interpreter.

Independent LLVM readelf observations establish ELF declarations, Tag_RISCV_arch and symbol addresses. Public CLI and stdio MCP workflows verify function enumeration, decompilation, pinned language/compiler identity, the committed lane and policy, decoded probe bytes, global data, and direct calls. They validate advertised MCP output schemas and both JSON representations, save and reopen snapshots, and check unchanged source bytes and owned cleanup.

For the soft- and single-float builds the lane also checks:

  • fence.i and csrr decode, as ESP32-C3's and H4's Zifencei and Zicsr declare, and fmv.w.x and fmv.x.w decode in the single-float build.
  • An LLVM objdump reading of the callers finds each call-site word, in integer and float registers and on the stack, where the ilp32 or ilp32f policy puts it. The ilp32 calls cover an unaligned double in a1/a2, the a7/stack split, two floats in an integer pair, a large structure and a long double passed by reference (the pointed-to copies hold the source values), aligned variadic pairs, and an indirect call. The ilp32f calls add floats in fa0–fa7, two-float and float-and-integer structures both ways round, float registers running out, and an indirect call with a float-and-integer structure.
  • inspect_native_api reports the policy's prototype with exactly that storage for the typed builds. For the stripped builds it reports the storage Ghidra infers from the registers each function uses. Their returns use the typed build's registers, or none when the result goes through caller memory; a single-float function that leaves a structure's float in fa0 unchanged returns only the integer register it writes.
  • The callers' pseudocode passes the source constants through that storage. In the soft-float builds it names no floating-point register; in the typed single-float build it names no register value that a prototype leaves out.
  • Retained Evidence states the prototype outcome; the stripped builds have no function definitions.
  • The unmodelled build is admitted by its headers, then refused over MCP and the CLI with the bridge's reason, which names its refused signatures and not the float[2] or bit-field functions. An LLVM objdump reading of its caller finds the empty-class structure's char at bit 0 of a0, its float in fa0 and the following int in a1.
  • The Rust-labelled builds are admitted by their headers, then refused over MCP by each policy with a reason that names Rust and DW_AT_language 0x1c. The unlabelled typed builds, with C, C++ and assembly units, are the controls.

For the ESP layout build the lane checks:

  • The profile commits the two sections LLVM readelf reports.
  • The load image maps .flash.text initialized and executable in the default space, with the reservation as an uninitialized overlay. Only the moved block maps the code's file bytes, and a file-offset: selector reaches the flash function at that offset.
  • No entry point has an overlay address, and each flash function keeps its entry mark. _text_start and _text_end keep their addresses, _etext is at the code's end in the default space, and _flash_rodata_dummy_start is in the reservation's overlay.
  • Every procedure keeps its ELF address, which selects it. The pseudocode of a flash function that ends by calling a noreturn function stops at that call. A flash function's pseudocode names its DWARF parameters, and an IRAM function's call reaches flash code.
  • The outcome states the four moved functions, the entry points the load image reports in the code's range and the one overlay label. Retained Evidence keeps it, and the reopened snapshot lists the same procedures.
  • A copy whose reservation is smaller than the code is refused over CLI and MCP, with the reservation named. analyzeHeadless with a code file offset one byte off makes the pre-analysis script refuse, and Ghidra then runs no auto-analysis.

The reservation-first build reports canonical: Ghidra loads its code in the default space, and REA changes nothing. In the build whose reservation is named ram, analyzeHeadless reports moved, with the reservation in the overlay space ram.1. A copy of the RV32 double-float build with a truncated section table is refused when REA opens it.

Header-mutated copies check admission. The RV32 double-float image relabelled as soft-float (e_flags 0x1), refused before that lane, is admitted through it over CLI and MCP. Relabelled as single-float (0x3) it declares D and is refused. The soft-float image relabelled as single-float lacks F and is refused; RV64 soft- and single-float and unsupported high bits are refused with their reasons. Failures retain the diagnostic workspace; successful runs remove it and report the observed process lineage.

Module tests cover admission, malformed headers, attribute sections and section overlaps, the handshake, and the conformance checks against recorded LLVM and Ghidra output. Call-graph completeness, string inventories, dynamic linkage, Andes or RVE/TSO images, big-endian targets, ilp32f images from GCC or ESP-IDF, and decoding beyond the probes are not established by this lane.