#9683·ghidra

Headless -noanalysis: decompiler resolves call names via ELF relocations, but ReferenceManager has no references for them

Author: gonsoloCreated Sep 27, 2026Updated Sep 27, 2026

Ghidra version: 12.0.4 (also observed to be relevant on similarly-recent headless builds) OS: Linux (x86_64)

Description

When a relocatable ELF object file (e.g. an unstripped Linux kernel module .ko, x86-64) is imported into headless Ghidra with -noanalysis, DecompInterface.decompileFunction() on a named function succeeds and correctly resolves the names of functions it calls elsewhere in the same file — presumably via the ELF relocation entries / symbol table the loader already parsed at import time.

However, ReferenceManager.getReferencesTo() for those same call targets returns no results at all, even for calls that the decompiler output just showed by name a moment earlier, and even when queried from a fresh -process invocation against the saved project (i.e. not a stale-cache issue).

This is a confusing combination for headless scripting: it's easy to conclude a program is "sufficiently analyzed" because decompilation looks complete and correctly annotated, while a script relying on getReferencesTo()/getReferencesFrom() (e.g. a simple "find callers of X" script) silently returns nothing, with no warning that references were never actually computed/stored.

Steps to reproduce

  1. analyzeHeadless <proj_dir> <proj_name> -import some_module.ko -noanalysis -scriptPath . -postScript decompile_one.java funcA
    • decompile_one.java uses DecompInterface to decompile funcA, which (per the disassembly) calls funcB directly (call funcB, resolved via an ELF relocation/local symbol, not a PLT/GOT indirection). The decompiler output correctly shows funcB(...) by name.
  2. In the same script (or a follow-up -process run against the saved project, no re-import), call:
    java
    for (Reference r : currentProgram.getReferenceManager().getReferencesTo(funcBSymbol.getAddress())) {
        println("caller: " + r.getFromAddress());
    }
  3. Observed: zero references printed, despite funcA's decompiled body clearly showing the call to funcB.
  4. Re-running the same -import without -noanalysis (full auto-analysis) and repeating step 2 correctly lists funcA as a caller of funcB.

Expected behavior (or at least, expected documentation)

Either:

  • -noanalysis imports should not leave the decompiler able to resolve call names while ReferenceManager remains completely empty for those same calls (i.e. either both should reflect the "unanalyzed" state, or references for statically-resolvable direct calls from relocations should be recorded at import time), or
  • if this is intentional (references are only ever populated by an explicit analysis pass, regardless of what the loader/decompiler can resolve on their own), it would help headless-scripting users a lot to have this called out explicitly in the -noanalysis flag's help text / the Headless Analyzer documentation, since the failure mode is a silent empty result set rather than an error.

Happy to attach a minimal synthetic .ko/.o reproducer if useful — the one I hit this on is a proprietary third-party kernel module I can't share, but the behavior reproduced identically on a from-scratch -import of the same file, so it isn't specific to that binary.

Source: NationalSecurityAgency/ghidra