mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
refactor(native): consolidate section and PE subject ownership
Specialize the buffer-backed directory driver for its actual ELF consumers and remove the unused PE branch. Share PE subject architecture interpretation at the existing machine owner, preserving unknowns for conflicting formats and unproven managed overrides. Validation: runtime build and 108 focused service, native parser, GPU, and CLI/MCP tests passed using local fixtures. Live descriptor-backed PE readers remain supported.
This commit is contained in:
1 parent
92f32981da
commit
3f168af2e8
8 files changed
+32
-83
No files matched your search
@@ -14,11 +14,7 @@ import {
|
||||
type PeLoadConfig,
|
||||
} from "../../domain/native/peLoadConfig.js";
|
||||
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
||||
import {
|
||||
decodePeMachine,
|
||||
peOptionalHeaderMagic,
|
||||
type PeArchitecture,
|
||||
} from "../../domain/peMachine.js";
|
||||
import { peSubjectArchitecture } from "../../domain/peMachine.js";
|
||||
import { err, type Result } from "../../domain/result.js";
|
||||
import { completeProviderEvidence } from "../ProviderOperationExecution.js";
|
||||
|
||||
@@ -72,7 +68,7 @@ export class PeLoadConfigService {
|
||||
),
|
||||
);
|
||||
const value = report.data;
|
||||
const architecture = subjectArchitecture(value);
|
||||
const architecture = peSubjectArchitecture(value.machine, value.format);
|
||||
const locations = [
|
||||
{ kind: "artifact-path" as const, path: value.artifact.path },
|
||||
...fileRange(value.tls?.directory ?? null),
|
||||
@@ -109,17 +105,6 @@ export class PeLoadConfigService {
|
||||
}
|
||||
}
|
||||
|
||||
const subjectArchitecture = (
|
||||
report: PeLoadConfig,
|
||||
): PeArchitecture | undefined => {
|
||||
const machine = decodePeMachine(report.machine);
|
||||
if (machine === undefined || machine.nativeOsOverride) return undefined;
|
||||
const magic = report.format === "pe32-plus" ? 0x20b : 0x10b;
|
||||
return magic === peOptionalHeaderMagic(machine.architecture)
|
||||
? machine.architecture
|
||||
: undefined;
|
||||
};
|
||||
|
||||
const fileRange = (
|
||||
directory: { file_offset: number; size: number } | null,
|
||||
): { kind: "file-offset-range"; start: number; end: number }[] =>
|
||||
|
||||
Reference in new issue
Block a user