feat(ghidra): admit recordless legacy MIPS32 ELFs with a pinned 32-bit language (#1898)

* feat(ghidra): admit recordless legacy MIPS32 ELFs with a pinned 32-bit language

Firmware built with pre-ABI-flags GNU toolchains declares EF_MIPS_ARCH_32
with an unspecified ABI field and no PT_MIPS_ABIFLAGS record. The lane
refused them before provider selection, and Ghidra's own header
auto-selection picks a 64-bit R6 language for exactly these files.

Admit ELF32 ET_EXEC headers with EF_MIPS_ARCH_32 or EF_MIPS_ARCH_32R2,
an unspecified ABI field, EF_MIPS_ABI2 clear and no observed ABI flags
record. o32 is recorded as an inferred analysis assumption
(mips_abi_basis), floating-point ABI semantics stay unverified, and the
existing refusals (FP64, NAN2008, ASEs, machine variants, ELF64) are
unchanged. The profile pins -processor MIPS:<LE|BE>:32:default through a
provider-pinned-v1 selection the bridge-reported language_id is checked
against after import; a caller-selected REA_GHIDRA_LANGUAGE_ID still
wins. The lane identity is versioned
elf32-exec-arch32-legacy-pinned-v1.

verify:ghidra:mips gains a recordless legacy round for both byte orders
that strips the ABI record declarations from a real mips32 fixture,
checks REA's interpretation against GNU readelf, asserts the pinned
language after import and the retained assumption limitations through a
snapshot round-trip.

Fixes #1620

* fix(ghidra): require an inspected absence for the recordless MIPS lane

Address review: undefined ABI flags means the record was not inspected,
not that none exists. Only an inspected absence (null) establishes the
recordless legacy admission; a merely unobserved record keeps its
specific refusal. Also document the legacy admission and its pinned
language in the MIPS provider guide.

* fix(ghidra): tighten the recordless MIPS admission boundaries

Address review: a recordless-looking header whose ABI-record inspection
left declaration sources unexamined (carved ELF with a partial section
table and no program-header record) no longer establishes the recordless
admission; it is refused with the inspection limitation retained. An
EF_MIPS_ARCH_32 header that declares an ABI is refused rather than
relabeled through the 32R2 declared-ABI lane.

* fix(ghidra): reject EF_MIPS_ABI_ON32 from the recordless MIPS lane

Address review: bit 0x40 declares the old n32 ABI. A recordless header
carrying it was admitted with the inferred-o32 assumption even though
the header itself declares n32; the recordless shape now requires the
bit clear and refuses it with a specific constraint.

* fix(ghidra): keep recordless relocatable MIPS objects off the legacy lane

The recordless admission now requires ET_EXEC: the lane and its
verification cover executable firmware images, and a recordless ET_REL
object must stay on the declared-ABI path instead of inheriting the
inferred-o32 assumption under an executable lane id. The ABI-record
requirement paragraph is scoped to the declared-ABI lane so it no longer
contradicts the recordless admission documented above it.

* fix(ghidra): name the ET_EXEC scope for recordless objects and probe the legacy lane

A recordless relocatable object is not an incomplete inspection, so its
refusal now names the ET_EXEC scope of the legacy admission instead of
claiming unavailable ABI headers remain unknown. The recordless legacy
verifier round reads the probe pair and applies the full assertMipsProbe
oracle like the standard round, and its report keeps the independent
GNU readelf receipt beside the fixture facts.

* fix(ghidra): retain the concrete ELF32 legacy compiler pin

* fix(ghidra): bind legacy profiles to fully admitted targets

---------

Co-authored-by: BaaRai <baarai@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
BaaRai
2026-10-13 21:42:38 +08:00
committed by GitHub
co-authored by BaaRai morluto
parent c6503edfc4
commit a4b8e9ccee
8 changed files with 707 additions and 39 deletions
+4 -5
View File
@@ -15,7 +15,7 @@ import { err, ok, type Result } from "../domain/result.js";
import type { GhidraInstallationInspection } from "./GhidraInstallation.js";
import {
ghidraMipsProfileParameters,
ghidraMipsSharedLanguageOverride,
ghidraMipsLanguageOverride,
} from "./GhidraMipsProfile.js";
import {
ghidraRiscvLanguageOverride,
@@ -44,8 +44,7 @@ import {
export const ghidraPinnedLanguage = (
target: BinaryTarget,
): GhidraLanguageOverride | undefined =>
ghidraMipsSharedLanguageOverride(target) ??
ghidraRiscvLanguageOverride(target);
ghidraMipsLanguageOverride(target) ?? ghidraRiscvLanguageOverride(target);
/** Resolve version-bound, deterministic semantics before Ghidra imports a target. */
export const resolveGhidraAnalysisProfile = async (
@@ -168,7 +167,7 @@ export const resolveGhidraAnalysisProfile = async (
`The caller-selected processor or compiler specification is outside the verified ${
target.architecture === "riscv"
? "generic little-endian RISC-V"
: "endian-matched MIPS32 shared-image"
: "endian-matched MIPS32"
} profile. The requested override has not been changed.`,
),
);
@@ -273,7 +272,7 @@ export const resolveGhidraAnalysisProfile = async (
}
: {}),
...analyzerParameters,
...ghidraMipsProfileParameters(target),
...ghidraMipsProfileParameters(target, languageOverride),
...ghidraRiscvProfileParameters(target),
...(pspExtension?.ok === true
? {
+178 -1
View File
@@ -10,10 +10,17 @@ import { HopperProvider } from "../hopper/HopperProvider.js";
import { hopperLoaderArgsForTarget } from "../hopper/HopperAnalysisProfile.js";
import { IdaProvider } from "../ida/IdaProvider.js";
import { GhidraProvider } from "./GhidraProvider.js";
import {
ghidraMipsProfileParameters,
ghidraPinnedMipsLanguage,
} from "./GhidraMipsProfile.js";
import type { GhidraInstallationHost } from "./GhidraInstallation.js";
import { GHIDRA_SESSION_CAPABILITIES } from "./GhidraSessionValues.js";
import type { GhidraMipsSoftFloatReport } from "./GhidraMipsProfile.js";
import { ghidraProfileLanguageOverride } from "./GhidraAnalysisProfile.js";
import {
ghidraPinnedLanguage,
ghidraProfileLanguageOverride,
} from "./GhidraAnalysisProfile.js";
// Fake installation inspection tests admission/profile contracts, not Ghidra.
const host: GhidraInstallationHost = {
@@ -161,6 +168,126 @@ describe("bounded Ghidra MIPS admission", () => {
});
});
describe("recordless legacy MIPS32 admission", () => {
it("keeps recordless relocatable objects off the inferred-o32 lane", async () => {
const ghidra = new GhidraProvider(config, silentLogger, {}, host);
const object = target({
flags: 0x50000001,
abiFlags: null,
type: 1,
});
expect(ghidra.inspectTargetSupport(object)).toMatchObject({
status: "unsupported",
});
const resolved = await ghidra.resolveAnalysisProfile(object);
expect(resolved.ok).toBe(false);
});
it.each([
[{ flags: 0x50000001 }, "EF_MIPS_ARCH_32"],
[{ flags: 0x70000001 }, "EF_MIPS_ARCH_32R2"],
] satisfies [Partial<MipsElfMetadata>, string][])(
"admits a recordless legacy header (%s) with a pinned 32-bit language",
async (change) => {
const ghidra = new GhidraProvider(config, silentLogger, {}, host);
const little = target({ ...change, abiFlags: null });
const big = target({ ...change, abiFlags: null, byteOrder: "big" });
expect(ghidra.inspectTargetSupport(little).status).toBe("supported");
expect(ghidra.inspectTargetSupport(big).status).toBe("supported");
const resolved = await ghidra.resolveAnalysisProfile(little);
if (!resolved.ok) throw resolved.error;
expect(resolved.value.profile?.parameters).toMatchObject({
mips_support_lane: "elf32-exec-arch32-legacy-pinned-v1",
mips_abi_basis: "inferred-o32-assumption-v1",
language_id: "MIPS:LE:32:default",
compiler_spec_id: "default",
language_selection: "provider-pinned-v1",
});
const resolvedBig = await ghidra.resolveAnalysisProfile(big);
if (!resolvedBig.ok) throw resolvedBig.error;
expect(resolvedBig.value.profile?.parameters).toMatchObject({
language_id: "MIPS:BE:32:default",
});
},
);
it("requires an inspected absence; a merely unobserved record stays refused", () => {
const ghidra = new GhidraProvider(config, silentLogger, {}, host);
const withRecord = target({ flags: 0x50000001 }) as BinaryTarget & {
mips: MipsElfMetadata;
};
const { abiFlags: _record, ...unobservedMips } = withRecord.mips;
void _record;
expect(
ghidra.inspectTargetSupport({
...withRecord,
mips: unobservedMips,
} as BinaryTarget),
).toMatchObject({
status: "unsupported",
reason: expect.stringContaining("recordless legacy header"),
});
});
it.each([
[{ flags: 0x50000021 }, "n32"],
[{ flags: 0x50000041 }, "EF_MIPS_ABI_ON32"],
[{ flags: 0x50000101 }, "EF_MIPS_32BITMODE"],
[{ flags: 0x70000101 }, "EF_MIPS_32BITMODE"],
[
{ flags: 0x50001001 },
"EF_MIPS_ARCH_32R2 for headers that declare an ABI",
],
[{ flags: 0x50000201 }, "EF_MIPS_FP64"],
[{ flags: 0x50000401 }, "EF_MIPS_NAN2008"],
[{ flags: 0x60000001 }, "32R2"],
[
{
flags: 0x50000001,
limitations: [
"MIPS section header table at file offset 96 extends beyond the captured file: examined 2 of 5 complete headers. ABI declarations in unavailable headers remain unknown.",
],
},
"complete ABI-record inspection",
],
] satisfies [Partial<MipsElfMetadata>, string][])(
"keeps refusing unverified recordless variants %j",
(change, reason) => {
const ghidra = new GhidraProvider(config, silentLogger, {}, host);
expect(
ghidra.inspectTargetSupport(target({ ...change, abiFlags: null })),
).toMatchObject({
status: "unsupported",
reason: expect.stringContaining(reason),
});
},
);
it("a caller-selected language wins over the provider pin", () => {
const parameters = ghidraMipsProfileParameters(
target({ flags: 0x50000001, abiFlags: null }),
{ languageId: "MIPS:LE:32:default", compilerSpecId: "default" },
);
expect(parameters.language_selection).toBeUndefined();
expect(parameters.language_id).toBeUndefined();
expect(parameters).toMatchObject({
mips_support_lane: "elf32-exec-arch32-legacy-pinned-v1",
});
});
it("reads the pinned import language back only from pinned profiles", () => {
const pinned = ghidraMipsProfileParameters(
target({ flags: 0x50000001, abiFlags: null }),
);
expect(ghidraPinnedMipsLanguage(pinned)).toEqual({
languageId: "MIPS:LE:32:default",
compilerSpecId: "default",
});
const standard = ghidraMipsProfileParameters(target());
expect(ghidraPinnedMipsLanguage(standard)).toBeUndefined();
});
});
const report: GhidraMipsSoftFloatReport = {
policy: "o32-soft-float-prototype-v1",
functions: 5,
@@ -218,6 +345,56 @@ const session = async (
};
};
describe("legacy profile bindings", () => {
it("refuses a legacy endian pin committed for a different target", async () => {
const { counts, client } = await session(
target({ flags: 0x50000001, abiFlags: null, byteOrder: "big" }),
undefined,
target({ flags: 0x50000001, abiFlags: null, byteOrder: "little" }),
);
expect((await client.execute("health", {})).ok).toBe(false);
expect(counts.starts).toBe(0);
});
it.each([0x50000201, 0x50000401, 0x54000001, 0x50910001])(
"refuses unsupported same-endian legacy flags %i before startup",
async (flags) => {
const value = target({ flags, abiFlags: null });
expect(ghidraPinnedLanguage(value)).toBeUndefined();
const { counts, client } = await session(
value,
undefined,
target({ flags: 0x50000001, abiFlags: null }),
);
expect((await client.execute("health", {})).ok).toBe(false);
expect(counts.starts).toBe(0);
},
);
const unpinnedTargets: BinaryTarget[] = [
target(),
{
path: "/fixture.elf",
sha256: "a".repeat(64),
kind: "executable",
format: "elf",
architecture: "x86_64",
availableArchitectures: ["x86_64"],
},
];
it.each(unpinnedTargets)(
"refuses a pinned profile for an unpinned target $architecture",
async (value) => {
expect(ghidraPinnedLanguage(value)).toBeUndefined();
const { counts, client } = await session(
value,
undefined,
target({ flags: 0x50000001, abiFlags: null }),
);
expect((await client.execute("health", {})).ok).toBe(false);
expect(counts.starts).toBe(0);
},
);
});
describe("MIPS16 shared-image profile", () => {
const shared = (change: Partial<MipsElfMetadata> = {}) =>
target({
+115 -12
View File
@@ -1,6 +1,6 @@
import type { GhidraLanguageOverride } from "../config/ghidraLanguageOverride.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { GhidraLanguageOverride } from "../config/ghidraLanguageOverride.js";
const MIPS_FP_ABI_SOFT = 3;
const MIPS_ET_REL = 1;
@@ -15,17 +15,56 @@ const isGhidraMips16SharedTarget = (target: BinaryTarget): boolean =>
target.mips.type === MIPS_ET_DYN &&
(target.mips.flags & 0x0f000000) === MIPS16_HEADER_ASE;
/** Generic MIPS32 permits per-function ISA_MODE; a global 16e processor does not. */
export const ghidraMipsSharedLanguageOverride = (
/** Derive the verified MIPS32 import pin from this target's observed byte order. */
export const ghidraMipsLanguageOverride = (
target: BinaryTarget,
): GhidraLanguageOverride | undefined =>
isGhidraMips16SharedTarget(target) && target.architecture === "mips"
(isGhidraMips16SharedTarget(target) || hasLegacyMipsHeaderShape(target)) &&
ghidraMipsUnsupportedReason(target) === null &&
target.architecture === "mips"
? {
languageId: `MIPS:${target.mips.byteOrder === "little" ? "LE" : "BE"}:32:default`,
compilerSpecId: "default",
}
: undefined;
/**
* Recordless legacy ELF32 MIPS admission: the header declares no ABI field and
* carries no ABI flags record, so o32 is an analysis assumption derived from
* ELF32/ET_EXEC structure, never a declared fact. Ghidra's header
* auto-selection picks a 64-bit language for exactly these files, so the lane
* pins the 32-bit language instead.
*/
const hasLegacyMipsHeaderShape = (target: BinaryTarget): boolean => {
if (
target.kind !== "executable" ||
target.architecture !== "mips" ||
target.format !== "elf" ||
target.mips === undefined
)
return false;
const { flags, abiFlags, limitations } = target.mips;
const arch = flags & 0xf0000000;
return (
// The lane and its verification cover executable firmware images only;
// recordless relocatable objects stay outside the inferred-o32 assumption.
target.mips.elfClass === 32 &&
target.mips.type === MIPS_ET_EXEC &&
(arch === 0x50000000 || arch === 0x70000000) &&
(flags & 0x0000f000) === 0 &&
(flags & 0x20) === 0 &&
// EF_MIPS_ABI_ON32 (bit 0x40) declares the old n32 ABI; it is not an
// unspecified-ABI header and must not inherit the o32 assumption.
(flags & 0x40) === 0 &&
(flags & 0x100) === 0 &&
// Undefined means the record was not inspected; only an inspected
// absence establishes the recordless legacy admission. An inspection
// that could not examine every declaration source stays unknown.
abiFlags === null &&
(limitations === undefined || limitations.length === 0)
);
};
/** Keep family recognition separate from the deliberately bounded Ghidra lane. */
export const ghidraMipsUnsupportedReason = (
target: BinaryTarget,
@@ -48,13 +87,41 @@ export const ghidraMipsUnsupportedReason = (
return "MIPS16, microMIPS and other ASE encodings are outside this standard-instruction MIPS lane.";
if ((metadata.flags & 0x00ff0000) !== 0)
return "Machine-specific MIPS variants, including PSP Allegrex, need a separately supported processor profile.";
if ((metadata.flags & 0xf0000000) !== 0x70000000)
return "This Ghidra MIPS lane requires EF_MIPS_ARCH_32R2; other ISA revisions need separate verification.";
const arch = metadata.flags & 0xf0000000;
if (arch !== 0x70000000 && arch !== 0x50000000)
return "This Ghidra MIPS lane requires EF_MIPS_ARCH_32R2 or a recordless legacy EF_MIPS_ARCH_32 header; other ISA revisions need separate verification.";
const recordlessShape =
(metadata.flags & 0x0000f000) === 0 &&
(metadata.flags & 0x20) === 0 &&
metadata.abiFlags === null;
if (recordlessShape) {
if ((metadata.flags & 0x100) !== 0)
return "EF_MIPS_32BITMODE declares code for a 64-bit processor in 32-bit mode; it is outside the recordless MIPS32 admission.";
if ((metadata.flags & 0x40) !== 0)
return "EF_MIPS_ABI_ON32 declares the n32 ABI; recordless headers carrying it are outside the recordless legacy admission.";
if ((metadata.flags & 0x00000200) !== 0)
return "EF_MIPS_FP64 requires separate verification of 64-bit floating-point register semantics in this Ghidra lane.";
if ((metadata.flags & 0x00000400) !== 0)
return "EF_MIPS_NAN2008 requires separate verification of NaN encoding semantics in this Ghidra lane.";
if (hasLegacyMipsHeaderShape(target)) return null;
// A recordless relocatable object is not an incomplete inspection; the
// lane is scoped to executable firmware images by design.
if (metadata.type !== MIPS_ET_EXEC)
return "The recordless legacy admission covers ET_EXEC firmware images only; recordless relocatable objects need their own verified build, and the declared-ABI lane requires an ABI flags record.";
// The inspection could not examine every ABI declaration source, so the
// recordless admission is not established for this header.
return [
"This recordless legacy admission requires a complete ABI-record inspection; ABI declarations in unavailable headers remain unknown.",
...(metadata.limitations ?? []),
].join(" ");
}
if (
(metadata.flags & 0x0000f000) !== 0x00001000 ||
(metadata.flags & 0x20) !== 0
)
return "This Ghidra MIPS lane requires an explicit o32 ABI; unspecified, n32 and EABI targets remain unsupported.";
return "This Ghidra MIPS lane requires an explicit o32 ABI or a recordless legacy header with an unspecified ABI; n32, EABI and mixed declarations remain unsupported.";
if (arch !== 0x70000000)
return "This Ghidra MIPS lane requires EF_MIPS_ARCH_32R2 for headers that declare an ABI; EF_MIPS_ARCH_32 headers are admitted only through the recordless legacy admission.";
if ((metadata.flags & 0x00000200) !== 0)
return "EF_MIPS_FP64 requires separate verification of 64-bit floating-point register semantics in this Ghidra lane.";
if ((metadata.flags & 0x00000400) !== 0)
@@ -98,6 +165,11 @@ export const ghidraMipsUnsupportedReason = (
return null;
};
/** A legacy lane is established only after every MIPS declaration is admitted. */
export const isLegacyMipsAdmission = (target: BinaryTarget): boolean =>
hasLegacyMipsHeaderShape(target) &&
ghidraMipsUnsupportedReason(target) === null;
/** Soft-float prototype policy applied by ReaGhidraMipsSoftFloat.java after analysis. */
export const GHIDRA_MIPS_SOFT_FLOAT_STORAGE = "o32-soft-float-prototype-v1";
@@ -174,6 +246,7 @@ export const ghidraMipsSharedLimitations = (
/** Commit source ELF interpretation without confusing target ISA with host CPU. */
export const ghidraMipsProfileParameters = (
target: BinaryTarget,
languageOverride?: GhidraLanguageOverride,
): Readonly<Record<string, JsonValue>> => {
if (
target.kind !== "executable" ||
@@ -182,6 +255,18 @@ export const ghidraMipsProfileParameters = (
)
return {};
const abi = target.mips.abiFlags;
// A deliberate caller-selected language wins over the legacy pin; the pin
// exists because header auto-selection misselects a 64-bit language.
const legacy = isLegacyMipsAdmission(target);
const language = ghidraMipsLanguageOverride(target);
const pinnedLanguage =
legacy && languageOverride === undefined && language !== undefined
? {
language_id: language.languageId,
compiler_spec_id: language.compilerSpecId ?? "default",
language_selection: "provider-pinned-v1",
}
: {};
return {
mips_elf: {
elf_class: target.mips.elfClass,
@@ -231,10 +316,28 @@ export const ghidraMipsProfileParameters = (
? { mips_soft_float_storage: GHIDRA_MIPS_SOFT_FLOAT_STORAGE }
: {}),
instruction_context_evidence: "per-address-isa-mode-v1",
mips_support_lane: isGhidraMips16SharedTarget(target)
? "elf32-dyn-o32-arch32r2-mips16-local-rel32-v1"
: target.mips.type === MIPS_ET_REL
? "elf32-rel-o32-arch32r2-standard-v1"
: "elf32-exec-o32-arch32r2-standard-v3",
mips_support_lane: legacy
? "elf32-exec-arch32-legacy-pinned-v1"
: isGhidraMips16SharedTarget(target)
? "elf32-dyn-o32-arch32r2-mips16-local-rel32-v1"
: target.mips.type === MIPS_ET_REL
? "elf32-rel-o32-arch32r2-standard-v1"
: "elf32-exec-o32-arch32r2-standard-v3",
...(legacy ? { mips_abi_basis: "inferred-o32-assumption-v1" } : {}),
...pinnedLanguage,
};
};
/** Read the provider-pinned import language back from a resolved legacy profile. */
export const ghidraPinnedMipsLanguage = (
parameters: Readonly<Record<string, unknown>>,
): GhidraLanguageOverride | undefined => {
if (parameters.language_selection !== "provider-pinned-v1") return undefined;
const languageId = parameters.language_id;
const compilerSpecId = parameters.compiler_spec_id;
if (typeof languageId !== "string" || typeof compilerSpecId !== "string")
return undefined;
return compilerSpecId === "language-default"
? { languageId }
: { languageId, compilerSpecId };
};
+48 -8
View File
@@ -20,6 +20,7 @@ import {
sameGhidraDisabledAnalyzers,
sameGhidraLanguageOverride,
} from "./GhidraAnalysisProfile.js";
import { ghidraPinnedMipsLanguage } from "./GhidraMipsProfile.js";
import type { AnalysisProfileCommitment } from "../domain/analysisProfile.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import {
@@ -449,13 +450,39 @@ export const createGhidraProviderClient = (input: {
}),
);
const seeds = seedProfile.data;
const languageOverride = ghidraProfileLanguageOverride(
const parameterLanguage = ghidraProfileLanguageOverride(
committedProfile.parameters,
);
const pinnedLanguage = ghidraPinnedMipsLanguage(committedProfile.parameters);
const targetLanguage = ghidraPinnedLanguage(target);
if (pinnedLanguage !== undefined && targetLanguage === undefined)
return unavailableClient(
new ProviderAdapterError("ghidra", "open_binary", {
diagnostics: {
reason:
"The committed profile pins a MIPS language that the current target does not establish; reopen an admitted target to resolve a new profile.",
},
}),
);
// Provider-pinned profiles declare their language through the same
// parameter slot caller-configured profiles use, so only an environment
// override conflicts with the legacy pin; the slot itself carries it.
if (
pinnedLanguage !== undefined &&
config.ghidraLanguageOverride !== undefined
)
return unavailableClient(
new ProviderAdapterError("ghidra", "open_binary", {
diagnostics: {
reason:
"The committed legacy MIPS profile pins its import language; REA_GHIDRA_LANGUAGE_ID/REA_GHIDRA_COMPILER_SPEC_ID cannot be combined with it. Reopen the target without the override.",
},
}),
);
if (
!sameGhidraLanguageOverride(
languageOverride,
config.ghidraLanguageOverride ?? ghidraPinnedLanguage(target),
parameterLanguage,
config.ghidraLanguageOverride ?? targetLanguage,
)
)
return unavailableClient(
@@ -466,6 +493,9 @@ export const createGhidraProviderClient = (input: {
},
}),
);
// Both caller-selected and provider-pinned languages use the validated
// committed slot; the profile cannot supply its own applicability proof.
const importLanguage = parameterLanguage;
const disabledAnalyzers = ghidraProfileDisabledAnalyzers(
committedProfile.parameters,
);
@@ -483,6 +513,7 @@ export const createGhidraProviderClient = (input: {
},
}),
);
const invalidProfile = validateGhidraExtensionProfile(
extensions,
config,
@@ -523,6 +554,13 @@ export const createGhidraProviderClient = (input: {
...(target.kind === "executable" && target.architecture === "mips"
? (target.mips.limitations ?? [])
: []),
...(committedProfile.parameters.mips_abi_basis ===
"inferred-o32-assumption-v1"
? [
"The ELF header declares no ABI field and no ABI flags record was observed; o32 calling conventions are an analysis assumption of this lane, not a declared fact.",
"Floating-point ABI semantics are unverified for this recordless legacy admission.",
]
: []),
...ghidraMipsRelocatableLimitations(target),
...ghidraMipsSharedLimitations(target),
...ghidraRiscvLimitations(target),
@@ -563,7 +601,9 @@ export const createGhidraProviderClient = (input: {
baseAddr: target.entryPoint,
},
}),
...(languageOverride === undefined ? {} : { languageOverride }),
...(importLanguage === undefined
? {}
: { languageOverride: importLanguage }),
...(config.ghidraDisabledAnalyzers === undefined
? {}
: { disabledAnalyzers: config.ghidraDisabledAnalyzers }),
@@ -588,13 +628,13 @@ export const createGhidraProviderClient = (input: {
expectedCompilerSpecId: "default",
}
: rawLanguage === undefined
? languageOverride === undefined
? importLanguage === undefined
? {}
: {
expectedLanguageId: languageOverride.languageId,
...(languageOverride.compilerSpecId === undefined
expectedLanguageId: importLanguage.languageId,
...(importLanguage.compilerSpecId === undefined
? {}
: { expectedCompilerSpecId: languageOverride.compilerSpecId }),
: { expectedCompilerSpecId: importLanguage.compilerSpecId }),
}
: {
expectedLanguageId: rawLanguage.languageId,