Skip to content

fix!: remove linker map file from driver packages - #735

Merged
Shravan Vasista (svasista-ms) merged 4 commits into
microsoft:mainfrom
svasista-ms:fix/709-drop-map-from-package
Sep 10, 2026
Merged

fix!: remove linker map file from driver packages#735
Shravan Vasista (svasista-ms) merged 4 commits into
microsoft:mainfrom
svasista-ms:fix/709-drop-map-from-package

Conversation

@svasista-ms

@svasista-ms Shravan Vasista (svasista-ms) commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Breaking change

This PR updates the packaging flow in both cargo-wdk and cargo-make to stop copying the <pkg>.map file to the final package. This PR also reverts the changes made in #707.

Resolves #709

Details

Currently, cargo-wdk packages the map file. In Cargo's build-dir layout v2 (rust-lang/cargo#15947, stabilized in 1.100.0 via rust-lang/cargo#17354) the map file is located at <build-dir>/<profile>/build/<pkg>/<unit-hash>/out/<pkg>.map, instead of target/<profile>/deps/<driver_name>.map. This causes the build to fail.

Since the package contains a pdb along with the sys/dll, if map files are omitted, cargo-wdk will be able to support both v2 and v1 (legacy) directory layouts. This PR proposes this change.

Package contents before vs after

07-package-contents

NOTE: Map file is still produced by the build — wdk-build continues to emit /MAP and /MAPINFO:EXPORTS

build-dir layout path
v1 (legacy) target/<profile>/deps/<driver_name>.map
v2 (Cargo ≥ 1.100) target/<profile>/build/<pkg>/<unit-hash>/out/<driver_name>.map

Copilot AI lite review requested due to automatic review settings September 9, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Some functional tests in build_command_test.rs still assert that <driver>.map exists in the package directory and will fail with the new packaging behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates cargo-wdk’s packaging flow to stop copying the linker map file (<driver>.map) into the <pkg>_package/ directory, avoiding a hard dependency on Cargo’s legacy target/<profile>/deps/ layout and preventing packaging failures under Cargo build-dir layout v2.

Changes:

  • Remove .map source/destination paths and the copy step from the packaging task implementation.
  • Update cargo-wdk unit-test harness/mocks to stop expecting a map-file copy.
  • Update the main package-verification helper to stop asserting the map file exists (but some functional tests still need updating).
File summaries
File Description
crates/cargo-wdk/tests/build_command_test.rs Updates package file verification helper to no longer require .map in the package directory.
crates/cargo-wdk/src/actions/build/tests.rs Removes mocked expectations and helper code for copying the .map file during packaging.
crates/cargo-wdk/src/actions/build/package_task.rs Removes .map path fields and stops copying the linker map into the package directory.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/cargo-wdk/tests/build_command_test.rs
Copilot AI review requested due to automatic review settings September 9, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The map file copy path was fully removed from packaging and all related tests/mocks were updated consistently, with no remaining .map references in cargo-wdk.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.52%. Comparing base (3655880) to head (aecdd03).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #735      +/-   ##
==========================================
- Coverage   82.93%   78.52%   -4.41%     
==========================================
  Files          25       30       +5     
  Lines        6685     7105     +420     
  Branches     6685     7105     +420     
==========================================
+ Hits         5544     5579      +35     
- Misses       1029     1407     +378     
- Partials      112      119       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wmmc88 Melvin Wang (wmmc88) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. but the PR description says it resolved #709, but this alone won't resolve that issue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CI still disables layout v2, leaving the targeted regression untested.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread crates/cargo-wdk/tests/build_command_test.rs
@gurry

Copy link
Copy Markdown
Contributor

Shravan Vasista (@svasista-ms) As per Alan's comment #709 (comment), all the changes he made in PR #707 need to be completely undone so that cargo-wdk uses V2 layout in CI. Please do that as a part of this PR as well.

@svasista-ms Shravan Vasista (svasista-ms) changed the title fix(cargo-wdk)!: stop packaging the linker map file fix!: remove linker map file from driver packages Sep 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Cargo-make can retain stale map files in existing package directories, and tests do not explicitly verify map-file absence.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread crates/wdk-build/rust-driver-makefile.toml
Comment thread crates/cargo-wdk/tests/build_command_test.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused changes consistently remove map packaging while preserving map generation and exercising the default Cargo layout in CI.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@svasista-ms
Shravan Vasista (svasista-ms) added this pull request to the merge queue Sep 10, 2026
Merged via the queue into microsoft:main with commit 343c81c Sep 10, 2026
252 of 253 checks passed
@svasista-ms
Shravan Vasista (svasista-ms) deleted the fix/709-drop-map-from-package branch September 10, 2026 13:57
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.

cargo-wdk needs to be updated to work with the new cargo build directory v2 layout

6 participants