Skip to content

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

Closed

Description

@zackees

Sub-issue of #123 (Phase 0 checklist + Phase 5's response_file_quoting).

Two tokenizers that disagree

reld splits GNU response files (@file) in two places:

  • the native parser, crates/reld-core/src/args.rs (~line 1330), which errors Missing opening quote on a quote in the middle of a token, e.g. foo"bar baz";
  • the routing classifier, response_arguments in crates/reld-core/src/bridge.rs, which accepts it and has different escape handling.

GNU ld and lld (cl::TokenizeGNUCommandLine) accept quotes anywhere in a token and concatenate. So the native engine rejects a response file both reference linkers take, and the classifier and the linker can read the same file as different argv — meaning a route can be decided on tokens the native engine never sees. That is mold's response-file-quoting.sh, currently on the #14 skip list reporting exactly Missing opening quote.

Scope

  • One GNU response-file tokenizer following lld's TokenizeGNUCommandLine semantics (quotes anywhere, backslash escapes, adjacent quoted and unquoted pieces concatenate), in a new crates/reld-core/src/args/response_file.rs, declared from args.rs.
  • Both the native parser and the classifier call it. decode_response_file's UTF-16 handling for non-ELF engines stays as it is.
  • Remove response-file-quoting.sh from crates/reld/tests/external_tests/mold_skip_tests.toml if it passes; if it still fails, correct its reason to the real cause.
  • The four Phase 0 classifier tests from Polylinker no-gaps gate: classify every flag, route by target not host, prove coverage before reld becomes soldr's default #123 that have no test in the tree, each RED→GREEN and each fixing the classifier if it fails:
    • classifier_is_case_sensitive: -X native, -x routes; --ICF=all is unknown.
    • static_group_flags_stay_native: --start-group … --end-group from clang -static stays native.
    • plugin_opt_and_bitcode_route_to_lld: -plugin-opt= alone, and bitcode magic alone, each route.
    • reld_only_flags_never_reach_child: with a routed flag on the line, every reld-only option is excluded from the forwarded argv and named in the log.

Acceptance

  • response_file_quoting: the mold case passes natively, and the same file yields the same tokens in the classifier (asserted by a unit test on both call paths).
  • The four tests above exist and pass.

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