Skip to content

feat(core): single GNU response-file tokenizer and Phase 0 classifier tests (#179) - #183

Merged
zackees merged 2 commits into
mainfrom
feat/meta-work-179
Sep 18, 2026
Merged

zackees merged 2 commits into
mainfrom
feat/meta-work-179

Conversation

@zackees

@zackees zackees commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Closes #179

reld now reads GNU @file response files with one tokenizer, and the four Phase 0 classifier tests from #123 are added.

What changed

  • One tokenizer (args/response_file.rs): tokenize_gnu follows LLVM's cl::TokenizeGNUCommandLine.
    • Only space, tab, CR and LF separate tokens.
    • A backslash takes the next character literally, inside or outside quotes.
    • An unterminated quote ends the token without an error.
    • Empty tokens are dropped and a leading BOM is stripped.
  • Old parser removed (args.rs): read_args_from_file now calls tokenize_gnu, and the old arguments_from_string parser is deleted. The only change in args/elf.rs is removing that parser's test.
  • Router (bridge.rs): ELF @files are tokenized the same way for routing, the invocation log and the expansion handed to lld. COFF and Mach-O response files keep their own UTF-16-aware splitter.
  • Classifier fixes:
    • GNU flag matching is now case-sensitive. Only the MSVC /LTCG and /GL spellings are still matched case-insensitively.
    • A bare input that is a regular file starting with LLVM bitcode magic now routes to lld.
    • Flags that only reld understands are removed before forwarding to lld, including inside @files, and a stderr note lists what was removed.
  • New tests:
    • response_file_quoting_matches_on_native_and_classifier_paths
    • classifier_is_case_sensitive
    • static_group_flags_stay_native
    • plugin_opt_and_bitcode_route_to_lld
    • reld_only_flags_never_reach_child
    • stripped_reld_only_flags_are_dropped
    • tokenize_gnu_follows_llvm_gnu_quoting
  • mold skip list: response-file-quoting.sh moved from the unsupported-options group to the ignore group. The quoted @file now parses natively. The test still fails, but only on its error-message check: it greps cannot open foobar:, and reld prints Failed to open input file `foobar` .

Validation

  • cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p reld-core --lib: 223 passed.
  • cargo test -p reld-core --lib -- args::response_file bridge::tests: 56 passed, including all new tests.
  • mold response-file-quoting.sh:
    • With the ignore entry, the expected failure is confirmed.
    • With the entry temporarily removed, the only failure is command failed: 19: grep 'cannot open foobar:'. Both @file links before that step succeed.
  • Full mold corpus: 399 passed, 4 failed, 4 ignored. The 4 failures are the known environmental ones: rpath.sh, sframe.sh, trace.sh and weak-export-dso2.sh.
  • act: act -W .github/workflows/ci.yml -j phase1-native --matrix kind:linux-gnu -P ubuntu-24.04=catthehacker/ubuntu:act-24.04 --pull=false --action-offline-mode gave Job succeeded. In that run, the reld-core lib tests passed 223, the Linux acceptance tests passed 239 (0 failed, 621 ignored) and the mold corpus passed 406 (0 failed, 1 ignored).

🤖 Generated with Claude Code

zackees and others added 2 commits September 17, 2026 21:08
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit d4a577d into main Sep 18, 2026
18 checks passed
@zackees
zackees deleted the feat/meta-work-179 branch September 18, 2026 04:19
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.

classifier: one GNU response-file tokenizer, and the missing Phase 0 classifier tests (reld#123)

1 participant