fix(ghidra): verify dense jump tables on an optimized fixture (#1374)
The dense jump-table oracles (inspect-native-api CLI and the analyze_function dossier) ran against the -O0 debug fixture, which assumes the host compiler lowers dense switches to tables at -O0. GCC 16 and later expand them as compare chains instead, so on those hosts the lane rejected a correct provider and Ghidra build with empty jump_tables. Build the same inventory source once more at -O2 as a dedicated jump-table variant, run both strict dense oracles there, and keep the debug dossier at its complete generic shape. The dedicated switch lane already compiles at -O2 for the same reason.
This commit is contained in:
@@ -153,14 +153,15 @@ export async function verifyDebugFunctionOperations(
|
||||
const denseSwitchDossier = await functionCall(client, "analyze_function", {
|
||||
procedure: denseSwitchProcedure.address,
|
||||
});
|
||||
if (process.platform === "linux" && process.arch === "x64")
|
||||
assertDenseSwitchDossier(denseSwitchDossier, denseSwitchProcedure.address);
|
||||
else
|
||||
assertDossier(denseSwitchDossier, {
|
||||
address: denseSwitchProcedure.address,
|
||||
requireAssembly: true,
|
||||
requireMultiBlock: true,
|
||||
});
|
||||
// The debug fixture is compiled -O0, and GCC 16 and later lower dense
|
||||
// switches to compare chains at -O0, so this dossier asserts only its
|
||||
// complete shape; the optimized jump-table variant proves dense jump-table
|
||||
// completeness through assertDenseSwitchDossier.
|
||||
assertDossier(denseSwitchDossier, {
|
||||
address: denseSwitchProcedure.address,
|
||||
requireAssembly: true,
|
||||
requireMultiBlock: true,
|
||||
});
|
||||
assertIndirectDossier(indirectDossier, leaf.address);
|
||||
|
||||
const { cancellation, timeout } = await verifyRequestCancellationAndTimeout(
|
||||
@@ -372,6 +373,19 @@ async function verifyConcurrentRequests(client, entry, leaf) {
|
||||
return "serialized-two-results";
|
||||
}
|
||||
|
||||
/** Prove dense jump-table completeness on the optimized jump-table fixture. */
|
||||
export async function verifyJumpTableDenseSwitch(client, procedures) {
|
||||
const denseSwitchProcedure = requireProcedure(
|
||||
procedures,
|
||||
"rea_ghidra_inventory_dense_switch",
|
||||
);
|
||||
const dossier = await functionCall(client, "analyze_function", {
|
||||
procedure: denseSwitchProcedure.address,
|
||||
});
|
||||
assertDenseSwitchDossier(dossier, denseSwitchProcedure.address);
|
||||
return { dense_switch: dossierSummary(dossier) };
|
||||
}
|
||||
|
||||
export async function verifyStrippedFunctionOperations(client, entryString) {
|
||||
const stringXrefs = await functionCall(client, "xrefs", {
|
||||
document: null,
|
||||
|
||||
Reference in New Issue
Block a user