Skip to content

fix(bridge): Phase 0 of the no-gaps gate (reld#123) - #125

Merged
zackees merged 2 commits into
mainfrom
phase0-no-gaps
Sep 16, 2026
Merged

zackees merged 2 commits into
mainfrom
phase0-no-gaps

Conversation

@zackees

@zackees zackees commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Phase 0 of the reld#123 no-gaps gate — "stop the bleeding" after the adversarial audit found the prior #121 escalation was a fiction (it routed --start-group/--nostdlib/--sort-common/--stats to lld, which also ignores them, and made every +crt-static link leave the native engine). That escalation was already reverted in #124.

Changes

  • Case-sensitive classifier — -X (--discard-locals, native default) no longer routes to lld as DiscardAll; only -x/--discard-all does.
  • -plugin-opt → Lto — rustc -C linker-plugin-lto through clang emits -plugin-opt=… with no -plugin/-flto; bitcode now routes to lld's real LTO.
  • --fix-cortex-a53-835769 → loud error — lld rejects it too, so it's no longer silently warned-and-dropped.
  • --gc-sections defaults off — matches lld/ld/mold; rustc -C link-dead-code (which omits --gc-sections) now keeps the requested code.

Tests

  • New: discard_all_is_case_sensitive_x_not_X, plugin_opt_routes_to_lld_for_lto, gc_sections_defaults_off, fix_cortex_a53_835769_is_a_loud_error.
  • 192 reld-core lib tests pass; clippy/fmt clean.

Refs: #123.

🤖 Generated with Claude Code

zackees and others added 2 commits September 16, 2026 10:20
Start correcting the flag-classification model surfaced by the adversarial
audit in #123:

- Case-sensitive `-x` vs `-X`: `-X` is `--discard-locals` (a native default)
  and must not route to lld as `DiscardAll`.
- `-plugin-opt` (rustc `-C linker-plugin-lto` through clang) is now an `Lto`
  trigger, so bitcode routes to lld even with no `-plugin`/`-flto`.
- `--fix-cortex-a53-835769` is no longer warned-and-dropped: lld rejects it
  too, so it is a loud "unrecognized option" error.
- Default `--gc-sections` off, matching lld/ld/mold, so rustc's
  `-C link-dead-code` (which omits `--gc-sections`) keeps the requested code.

Refs: #123.

Co-Authored-By: Claude Code <[email protected]>
@zackees
zackees merged commit 734f5a3 into main Sep 16, 2026
16 of 17 checks passed
zackees added a commit that referenced this pull request Sep 16, 2026
… (reld#123)

Phase 0 (#125) changed the native engine's --gc-sections default from on to
off, matching ld/lld/mold. That change was landed without updating the
difftest fixtures, so ~26 fixture-level DiffIgnore entries that suppressed
gc-induced .rodata/.data/relocation/byte differences became stale. The
difftest ratchet now fails each unused entry with "is no longer needed".

Remove the stale entries: `section.rodata`, `section.rodata.alignment`,
`section.data`, `rel.match_failed.R_X86_64_PLT32`, and
`literal-byte-mismatch`. Arch-scoped variants (e.g. `... #13 arch=aarch64`)
and still-needed ignores are untouched.

Co-Authored-By: Claude Code <[email protected]>
zackees added a commit that referenced this pull request Sep 16, 2026
Phase 0's --gc-sections default flip (#125) made nine mold-suite tests pass
that were previously skipped. The Phase 1 external-test ratchet fails any
skipped test that now passes, so remove them from the skip list:

gc-sections.sh, start-lib.sh, undefined.sh, undefined2.sh, whole-archive.sh
(the five reld#123 Phase 0 names "Passes when --no-gc-sections is passed"),
plus nmagic.sh, section-attributes.sh, symbol-version.sh, symtab.sh.

Co-Authored-By: Claude Code <[email protected]>
zackees added a commit that referenced this pull request Sep 16, 2026
…ve + gc-sections difftest fixtures (#131)

* fix(bridge): keep --no-undefined-version native, not routed to lld (reld#123 §B)

The §A reclassification (PR #128) dropped --no-undefined-version /
--undefined-version from the native parser's satisfied-by-construction
list, believing they route to lld. But rustc emits --no-undefined-version
on every cdylib, dylib, and proc-macro link, so routing it pushes all of
those links off the fast native engine (and off the Nix RUNPATH derivation),
which reld#123 §B forbids.

Make them native: accept both flags as satisfied-by-construction (the native
engine has no version-script undefined-symbol tracking, so the check is
trivially satisfied), and delete the now-triggerless VersionScriptPolicy
capability and its route-to-lld arm.

Co-Authored-By: Claude Code <[email protected]>

* fix(difftest): drop stale ignores from the gc-sections default change (reld#123)

Phase 0 (#125) changed the native engine's --gc-sections default from on to
off, matching ld/lld/mold. That change was landed without updating the
difftest fixtures, so ~26 fixture-level DiffIgnore entries that suppressed
gc-induced .rodata/.data/relocation/byte differences became stale. The
difftest ratchet now fails each unused entry with "is no longer needed".

Remove the stale entries: `section.rodata`, `section.rodata.alignment`,
`section.data`, `rel.match_failed.R_X86_64_PLT32`, and
`literal-byte-mismatch`. Arch-scoped variants (e.g. `... #13 arch=aarch64`)
and still-needed ignores are untouched.

Co-Authored-By: Claude Code <[email protected]>

* test(external): un-skip mold tests that now pass under gc-sections-off

Phase 0's --gc-sections default flip (#125) made nine mold-suite tests pass
that were previously skipped. The Phase 1 external-test ratchet fails any
skipped test that now passes, so remove them from the skip list:

gc-sections.sh, start-lib.sh, undefined.sh, undefined2.sh, whole-archive.sh
(the five reld#123 Phase 0 names "Passes when --no-gc-sections is passed"),
plus nmagic.sh, section-attributes.sh, symbol-version.sh, symtab.sh.

Co-Authored-By: Claude Code <[email protected]>

---------

Co-authored-by: Claude Code <[email protected]>
@zackees
zackees deleted the phase0-no-gaps branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant