You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
routing: TargetProbe — derive the link target from argv and inputs (reld#123 Phase 3, step 1) #178
Sub-issue of #123 (Phase 3, D2 — target-keyed routing).
Why
Engine selection today is keyed on the invocation: -flavor, the executable name, and otherwise PlatformKind::host() (crates/reld-core/src/args.rs). Phase 3 needs it keyed on what the link is for. Every other Phase 3 item — Engine::MingwLld, i386/arm32/mips/s390x/ppc64be/riscv32 routing to ld.lld, Mach-O cross from Linux — is a consumer of one fact: the target. This issue builds that fact and nothing else, so the wiring can follow as its own reviewable step.
Scope
A pure, unit-tested TargetProbe in a new module, crates/reld-core/src/target_probe.rs, which from the argv tokens and the leading bytes of the input files returns a probed target: object format (ELF / COFF / Mach-O / LLVM bitcode), architecture, class (32/64), and endianness, plus which signal decided it.
Signals, per #123 Phase 3: -m <emulation> (e.g. elf_i386, i386pep, elf64ppc, elf32btsmip), -EB/-EL, OUTPUT_FORMAT in a linker script, -arch/-platform_version, /OUT: (COFF), input e_machine / EI_CLASS / EI_DATA, and bitcode magic (BC\xC0\xDE and the wrapper magic). State the precedence explicitly and test it: an explicit -m beats inference from inputs.
Out of scope
Wiring the probe into engine selection (bridge.rs / Args::new) and adding Engine::MingwLld — that is the next sub-issue, and doing it here would overlap with other work in flight in bridge.rs.
Acceptance
target_probe_picks_engine_before_format at the probe level: -m i386pep, -m elf_i386, -arch arm64, /OUT:, an EM_ARM input, a big-endian input, and LLVM bitcode each yield the documented target, tested with hand-built headers — no toolchain needed.
No behavioural change to any link: the module is not yet called by routing.
Activity
feat(core): add TargetProbe to derive link target from argv and inputs (