Skip to content

mdx: inherit link_flags from env stanza for mdx_gen executable - #15614

Open
Alizter with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-mdx-link-flags
Open

mdx: inherit link_flags from env stanza for mdx_gen executable#15614
Alizter with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-mdx-link-flags

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

The generated mdx_gen.bc.exe was linked with only the MDX-specific -linkall argument, so link_flags from env stanzas were skipped. This made environment-level linker configuration ineffective for MDX, including flags used to suppress duplicate-library warnings on macOS.

This restores the existing expectation that env link flags apply when Dune links an executable.

Implementation

  • Add a cram regression that configures -cclib -lm in a workspace env stanza and prints those flags from the mdx_gen.bc.exe linker trace.
  • Evaluate MDX link arguments with Ocaml_flags_db.link_flags sctx ~dir Dune_lang.Link_flags.Spec.standard, the same default link-flag path used by ordinary executable rules.
  • Keep the MDX-required -linkall argument prepended to the evaluated flags.
  • Add a changelog entry.

Using Link_flags.Spec.standard avoids a separate env-only lookup and gives MDX the normal executable link-flag semantics. Since this restores existing behavior, it is applied as a bug fix rather than being gated on Dune language 3.25.

Test plan

  • ./dune.exe runtest test/blackbox-tests/test-cases/stanzas/mdx-stanza/env-link-flags.t
  • ./dune.exe fmt

Fixes #15613

Checklist

  • Tests added.
  • Change log entry added.
  • Documentation added; not needed because this restores documented env behavior.

Copilot AI linked an issue Jul 28, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix mdx targets to use link flags mdx: inherit link_flags from env stanza for mdx_gen executable Jul 28, 2026
Copilot AI requested a review from Alizter July 28, 2026 18:17
Comment thread test/blackbox-tests/test-cases/stanzas/mdx-stanza/env-link-flags.t Outdated
@Alizter

Alizter commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@copilot address comments

Alizter added 2 commits July 29, 2026 00:13
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter
Alizter force-pushed the copilot/fix-mdx-link-flags branch from c40c778 to fd9a747 Compare July 28, 2026 22:23
Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter
Alizter force-pushed the copilot/fix-mdx-link-flags branch from 63b5462 to e65c461 Compare July 29, 2026 08:56
@Alizter
Alizter marked this pull request as ready for review July 29, 2026 09:14
@Alizter
Alizter requested a review from avsm July 29, 2026 09:19
@Alizter

Alizter commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

MDX executable link flags are now inherited from the relevant env stanzas. This initial PR was written by copilot and then iterated upon by me.

@avsm Can you confirm that this is what we want for the mdx executable? Addressing the ask in #15613.

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.

mdx targets do not get link flags

2 participants