[MOJO] Fix xlinker forwarding for mojo run/debug by mahendrarathore1742 · Pull Request #6328 · modular/modular

Pull request overview

Fixes mojo run / mojo debug ignoring -Xlinker by extracting those flags from CLI args and forwarding them via MODULAR_MOJO_MAX_SYSTEM_LIBS, eliminating “unused -Xlinker” warnings and restoring expected runtime linking behavior (Fixes #6155).

Changes:

  • Add argument parsing to capture -Xlinker / -Xlinker,... flags for run and debug and append them into MODULAR_MOJO_MAX_SYSTEM_LIBS.
  • Strip forwarded -Xlinker flags from the argv passed to the underlying driver while preserving args after --.
  • Add unit tests covering forwarding behavior, combined-flag syntax, and existing env var appends.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
mojo/python/mojo/_entrypoints.py Implements -Xlinker extraction/forwarding for mojo run and mojo debug before execve.
mojo/python/test/test_entrypoints.py Adds tests validating env forwarding and argv filtering behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.