Skip to content

fix: preserve shared-library owner link configuration - #773

Closed
julixian wants to merge 2 commits into
mcpp-community:mainfrom
julixian:fix/shared-library-link-flags
Closed

julixian wants to merge 2 commits into
mcpp-community:mainfrom
julixian:fix/shared-library-link-flags

Conversation

@julixian

@julixian julixian commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Dependency-owned shared libraries currently link without their owning package's link group. Libraries and flags declared in that package's build.mcpp can therefore reach the consuming executable but disappear from the DLL link command, causing unresolved symbols or missing delay-load settings.

Assign shared images a link-only group containing their owner's dependency closure and runtime contract. Exclude artifact-only and build-time-only edges and ordinary consumer flags, and reuse the group for multiple shared targets from the same package without scheduling duplicate deployment.

Refresh dependency link snapshots after build scripts for ordinary path dependencies as well as workspace plans. Resolve library search paths against the package that declares them.

Closes #771.

Criteria

  • Self-built mcpp with LLVM 22.1.8 on Windows; all behavioral tests below use that fresh executable.
  • SharedLinkUsage.OwnerAndDependencyFlagsReachEverySharedImage failed before the fix because shared images had linkGroup == -1, and passes after it. It covers ordinary and workspace plans, Windows and ELF link emission, two shared targets, owner/dependency flags, consumer isolation, and runtime metadata.
  • E2E 880_shared_images_use_their_packages_link_configuration.sh failed before the fix with an unresolved BCryptGenRandom symbol. It passes after the fix for workspace, selected app, selected shared owner, and standalone path-dependency builds on Windows. Its helper also requires userenv and a delay-load flag. Native Linux/macOS execution remains for CI.
  • Built the original AVPlayer DLL and executable with the fresh binary. Both link successfully; llvm-readobj confirms d3d11 imports and a dcomp.dll delay import.
  • Full mcpp test: 146 of 147 test programs pass. The remaining failure is Glob.EscapedSpellingIsUtf8WhateverTheName, which throws a Windows code-page conversion exception. Rebuilding and running test_modgraph with the two modified implementation files restored to origin/main reproduces the same failure. This PR does not change that test or its implementation.
  • Documentation style/structure, version pins, workflow assertions, bash syntax, and diff whitespace checks pass.

Intersections

New rule or feature Invariant it crosses Test at the crossing
Owner-specific shared link groups Ordinary consumers and unrelated members must not leak their private flags into dependency DLLs New unit test checks negative flags in both workspace and ordinary plans
Dependency closure and runtime derivation Owner dependencies contribute link/runtime metadata without duplicate deployment New unit test checks helper flags, search paths, runtime metadata, link-only groups and empty placements
Reusing a group's configuration Multiple shared targets in one package must each receive the owner's flags New unit test emits and checks two shared images
Refreshing script-generated dependency flags Workspace selections and ordinary path dependencies must honor the same build.mcpp declarations New E2E exercises all four build selections

Compatibility

No manifest or build.mcpp API changes. Previously omitted declared link settings now apply to dependency-owned shared images. Existing object selection, import-library dependencies, export handling and deployment remain in place. No migration is required.

Checks before merging

  • bash .github/tools/check_docs_style.sh, check_docs_structure.sh and check_version_pins.sh pass.
  • python3 .github/tools/check_workflow_assertions.py passes.
  • No commit on the branch carries an attribution trailer.
  • The squash merge is given an explicit subject and body, so GitHub does not compose one from the branch's commits.

@julixian julixian closed this Oct 5, 2026
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.

fix: preserve package link flags on shared-library link units

1 participant