Apply caller-selected analyzer opt-outs before Ghidra analysis, reject unknown or ineffective names, and commit raw/header imports to the same analyzer profile. Use supported x86 raw compiler specs and cover the real analyzer/readback and raw workflows. Adopts the original implementation from #1800 with validated corrections. Refs #1783, #1836. Co-authored-by: akushonkamen <74654766+akushonkamen@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import type { BinaryArchitecture } from "../domain/binaryTargetTypes.js";
|
|
|
|
/** Bound Ghidra language for a caller-supplied raw-binary architecture. */
|
|
export interface GhidraRawBinaryLanguage {
|
|
readonly languageId: string;
|
|
readonly compilerSpecId: "default" | "gcc";
|
|
}
|
|
|
|
/**
|
|
* Map the four caller-visible CPU families to little-endian generic Ghidra
|
|
* languages with a supported generic compiler specification. These are
|
|
* analysis conventions, not evidence of the target's original compiler.
|
|
* Big-endian, Thumb-only, and Cortex-M variants are out of scope.
|
|
*/
|
|
export const ghidraRawBinaryLanguage = (
|
|
architecture: Exclude<BinaryArchitecture, "mips">,
|
|
): GhidraRawBinaryLanguage => {
|
|
switch (architecture) {
|
|
case "x86":
|
|
return { languageId: "x86:LE:32:default", compilerSpecId: "gcc" };
|
|
case "x86_64":
|
|
return { languageId: "x86:LE:64:default", compilerSpecId: "gcc" };
|
|
case "arm":
|
|
return { languageId: "ARM:LE:32:v7", compilerSpecId: "default" };
|
|
case "arm64":
|
|
return { languageId: "AARCH64:LE:64:v8A", compilerSpecId: "default" };
|
|
}
|
|
};
|