Skip to content

Escalate silently-ignored flags to lld — never drop linker semantics (reld-as-default prerequisite) #121

Closed

Description

@zackees

Goal

reld should be safe as soldr's default linker: it must never silently drop a flag's semantics. Any flag the fast native engine cannot honor must escalate to the bundled lld engine (the capable linker), the same way LTO/ICF already do — never fall through to the native engine's silent-ignore path.

Evaluation (as of this writing)

bridge.rs::collect_requested_capabilities already routes the following flags to lld by mapping them to a Capability:

Flag(s) Capability Status
-flto, --plugin, /LTCG Lto ✅ routed
--icf=all / --icf=safe Icf ✅ routed
--discard-all, -x DiscardAll ✅ routed
--fatal-warnings FatalWarnings ✅ routed
--color-diagnostics / --no-color-diagnostics ColorDiagnostics ✅ routed
--no-undefined-version / --undefined-version VersionScriptPolicy ✅ routed
--fix-cortex-a53-843419 CortexA53Erratum ✅ routed

These same flags (--fatal-warnings, --color-diagnostics, --no-undefined-version, --undefined-version) are also listed in SILENTLY_IGNORED_FLAGS (args/elf.rs), which is misleading dead weight — they are routed, not ignored.

The actual gap: flags silently dropped with no routing

These are in SILENTLY_IGNORED_FLAGS (or SILENTLY_IGNORED_SHORT_FLAGS) but have no Capability and no entry in collect_requested_capabilities, so their semantics are lost with no warning and no lld hand-off:

Flag(s) What is lost Migration
--start-group / --end-group / -( / -) archive-cycle re-scan semantics add a Capability (route to lld) or prove native demand-driven resolution is byte-equivalent (add a circular-liba.a ↔ libb.a test)
--nostdlib suppression of built-in search paths add a Capability (route to lld) or verify native adds no built-in paths (then keep a loud no-op + test)
--sort-common common-symbol ordering add a Capability (route to lld)
--stats linker statistics output add a Capability (route to lld) or implement natively

Requirement

  1. Every flag above must resolve to one of: native (honored, with a test), route to lld (a Capability + a collect_requested_capabilities arm), or loud error. No silent drops remain.
  2. Remove the misleading SILENTLY_IGNORED_FLAGS entries for --fatal-warnings, --color-diagnostics, --no-undefined-version, --undefined-version (already routed).
  3. RELD_LOG_ENGINE=1 must show the escalation for each migrated flag; an explicit --engine=reld on a flag that requires lld must fail loudly.

Acceptance

  • A link using any currently-dropped flag either links correctly through lld or fails with a capability-specific diagnostic — never a silent drop.
  • --start-group/--end-group circular-archive case is covered by a test (equivalence) or routed to lld.
  • RELD_LOG_ENGINE=1 shows the escalation for each migrated flag.

Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions