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

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.

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

@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

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
Jaco (jacobocasado) pushed a commit to starredjaco/windows-drivers-rs that referenced this pull request Oct 27, 2026
## 🤖 New release

* `wdk-build`: 0.5.1 -> 0.6.0 (✓ API compatible changes)
* `cargo-wdk`: 0.1.1 -> 0.2.0
* `wdk-macros`: 0.5.1 -> 0.5.2
* `wdk-sys`: 0.5.1 -> 0.5.2 (✓ API compatible changes)
* `wdk`: 0.4.1 -> 0.5.0 (⚠ API breaking changes)
* `wdk-alloc`: 0.4.1 -> 0.4.2 (✓ API compatible changes)
* `wdk-panic`: 0.4.1 -> 0.5.0 (⚠ API breaking changes)

The release branch also synchronizes manifests, Cargo Make requirements,
templates, and independent lockfiles with the release versions, and
installs the panic hook in generated and sample UMDF drivers (Closes
microsoft#646).

### ⚠ `wdk` breaking changes

```text
--- failure feature_not_enabled_by_default: package feature is not enabled by default ---

Description:
A feature is no longer enabled by default for this package. This will break downstream crates which rely on the package's default features and require the functionality of this feature.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove-another
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/feature_not_enabled_by_default.ron

Failed in:
  feature alloc in the package's Cargo.toml
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `wdk-build`

<blockquote>

##
[0.6.0](microsoft/windows-drivers-rs@wdk-build-v0.5.1...wdk-build-v0.6.0)
- 2026-10-22

### Added

- add linker directive for VHF lib + move static linker directives from
wdk-build to wdk-sys
([microsoft#685](microsoft#685))

### Fixed

- [**breaking**] remove linker map file from driver packages
([microsoft#735](microsoft#735))
- unnecessary trailing commas in format! macros
([microsoft#619](microsoft#619))
- *(ci)* remove the nightly_toolchain feature gate for assert_matches
([microsoft#612](microsoft#612))
- *(ci)* use latest nightly toolchain in the Test workflow, fix
`assert_matches` import and the `clippy` warning
([microsoft#604](microsoft#604))
- warn when WDK env vars are non-UTF8
([microsoft#596](microsoft#596))

### Other

- improve Dependabot and refresh repo-wide dependencies
([microsoft#745](microsoft#745))
- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- add `-fno-builtin` to bindgen builder
([microsoft#695](microsoft#695))
- *(wdk-build)* fix clippy lints
([microsoft#655](microsoft#655))
- fix `collapsable_if` lint, rust 1.95 `assert_matches` destabilization
([microsoft#643](microsoft#643))
- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
- add new unit tests for Wdk::try_from method
([microsoft#491](microsoft#491))
- add tests for setup_path function
([microsoft#578](microsoft#578))
</blockquote>

## `cargo-wdk`

<blockquote>

##
[0.2.0](microsoft/windows-drivers-rs@cargo-wdk-v0.1.1...cargo-wdk-v0.2.0)
- 2026-10-22

### Added

- *(cargo-wdk)* support hyphen-prefixed signtool args and support empty
custom args
([microsoft#737](microsoft#737))
- *(cargo-wdk)* add `--stampinf-args` passthrough to customize
`stampinf` options
([microsoft#733](microsoft#733))
- *(cargo-wdk)* add `--infverif-args` passthrough to customize `inverif`
options
([microsoft#734](microsoft#734))
- add `--inf2cat-args` passthrough to customize `inf2cat` options
([microsoft#702](microsoft#702))
- *(cargo-wdk)* add `--signtool-args` passthrough to customize driver
signing
([microsoft#699](microsoft#699))
- add linker directive for VHF lib + move static linker directives from
wdk-build to wdk-sys
([microsoft#685](microsoft#685))
- *(cargo-wdk)* add `--target-platform` option to the `build` command
([microsoft#683](microsoft#683))
- add feature selection options to the `build` command
([microsoft#665](microsoft#665))
- improve user-mode and kernel-mode driver panic handlers
([microsoft#642](microsoft#642))
- add `--locked` option to the `build` command
([microsoft#656](microsoft#656))
- introduce sign mode for driver packaging, allowing skipping of signing
steps ([microsoft#649](microsoft#649))
- add `cargo wdk clean` command
([microsoft#638](microsoft#638))
- *(cargo-wdk)* support target architecture override through
`config.toml` and `CARGO_BUILD_TARGET`
([microsoft#494](microsoft#494))

### Fixed

- *(cargo-wdk)* use `CARGO` environment variable for nested invocations
([microsoft#742](microsoft#742))
- modify `WinGet` module selection in CI and resolve Clippy errors
([microsoft#739](microsoft#739))
- [**breaking**] remove linker map file from driver packages
([microsoft#735](microsoft#735))
- *(cargo-wdk)* update WDK build number range to skip `InfVerif` when
building `sample` class drivers
([microsoft#679](microsoft#679))
- *(cargo-wdk)* use `--message-format=json-render-diagnostics` in the
build command to render compiler errors instead of the plain `json`
option
([microsoft#645](microsoft#645))
- do not sanitize `CARGO_HOME` & `RUSTUP_HOME`
([microsoft#609](microsoft#609))
- replace direct call to `std::fs::create_dir_all` with `fs` provider
`fs::create_dir_all`
([microsoft#602](microsoft#602))
- disable ANSI colors when output is redirected
([microsoft#601](microsoft#601))
- move cargo-wdk output to stderr
([microsoft#599](microsoft#599))
- cargo wdk new now respects default VCS behavior
([microsoft#575](microsoft#575))

### Other

- improve Dependabot and refresh repo-wide dependencies
([microsoft#745](microsoft#745))
- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- fix assert_is_empty and branches_sharing_code clippy lints
([microsoft#713](microsoft#713))
- add opt out env variable to temporarily prevent using build-dir v2 in
nightly runs
([microsoft#707](microsoft#707))
- *(cargo-wdk)* [**breaking**] rename `windows-driver` target-platform
value to `windows`
([microsoft#705](microsoft#705))
- update `anyhow` and `crossbeam-epoch` to resolve RUSTSEC-2026-0190 and
RUSTSEC-2026-0204
([microsoft#704](microsoft#704))
- update bindgen to fix compatibility with LLVM 22
([microsoft#682](microsoft#682))
- Bump serde_json from 1.0.140 to 1.0.143 in
/crates/cargo-wdk/tests/wdm-driver
([microsoft#547](microsoft#547))
- fix `install-winget` dependency install loop
([microsoft#680](microsoft#680))
- Bump regex from 1.11.1 to 1.12.2 in /crates/cargo-wdk/tests/wdm-driver
([microsoft#548](microsoft#548))
- Bump regex from 1.11.1 to 1.12.2 in
/crates/cargo-wdk/tests/umdf-driver
([microsoft#546](microsoft#546))
- Bump serde_json from 1.0.139 to 1.0.143 in
/crates/cargo-wdk/tests/umdf-driver
([microsoft#544](microsoft#544))
- Bump regex from 1.11.1 to 1.12.2 in
/crates/cargo-wdk/tests/kmdf-driver
([microsoft#539](microsoft#539))
- Bump serde_json from 1.0.140 to 1.0.143 in
/crates/cargo-wdk/tests/kmdf-driver
([microsoft#541](microsoft#541))
- bump remaining crates to 2024
([microsoft#634](microsoft#634))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
- Bump semver from 1.0.26 to 1.0.27 in
/crates/cargo-wdk/tests/wdm-driver
([microsoft#549](microsoft#549))
- Add code coverage
([microsoft#556](microsoft#556))
- Skip build step in `cargo-wdk new` tests for release-plz PRs
([microsoft#584](microsoft#584))
- make cargo wdk integration tests faster
([microsoft#553](microsoft#553))
- add unit tests for cargo wdk new subcommand action flow
([microsoft#551](microsoft#551))
</blockquote>

## `wdk-macros`

<blockquote>

##
[0.5.2](microsoft/windows-drivers-rs@wdk-macros-v0.5.1...wdk-macros-v0.5.2)
- 2026-10-22

### Fixed

- unnecessary trailing commas in format! macros
([microsoft#619](microsoft#619))

### Other

- improve Dependabot and refresh repo-wide dependencies
([microsoft#745](microsoft#745))
- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- bump remaining crates to 2024
([microsoft#634](microsoft#634))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
</blockquote>

## `wdk-sys`

<blockquote>

##
[0.5.2](microsoft/windows-drivers-rs@wdk-sys-v0.5.1...wdk-sys-v0.5.2)
- 2026-10-22

### Added

- add linker directive for VHF lib + move static linker directives from
wdk-build to wdk-sys
([microsoft#685](microsoft#685))

### Other

- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
</blockquote>

## `wdk`

<blockquote>

##
[0.5.0](microsoft/windows-drivers-rs@wdk-v0.4.1...wdk-v0.5.0)
- 2026-10-22

### Added

- [**breaking**] stack-based format buffer for `wdk` crate
([microsoft#611](microsoft#611))
- add dbg! macro to wdk
([microsoft#610](microsoft#610))

### Other

- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- fix assert_is_empty and branches_sharing_code clippy lints
([microsoft#713](microsoft#713))
- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
</blockquote>

## `wdk-alloc`

<blockquote>

##
[0.4.2](microsoft/windows-drivers-rs@wdk-alloc-v0.4.1...wdk-alloc-v0.4.2)
- 2026-10-22

### Other

- re-format .rs files with the current nightly rustfmt
([microsoft#732](microsoft#732))
- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))
</blockquote>

## `wdk-panic`

<blockquote>

##
[0.5.0](microsoft/windows-drivers-rs@wdk-panic-v0.4.1...wdk-panic-v0.5.0)
- 2026-10-22

### Added

- Add `install_panic_hook()` for UMDF drivers to log panic details to
the debugger and abort the host process. Call it early in `DriverEntry`.
([microsoft#642](microsoft#642))

### Changed

- [**breaking**] WDM/KMDF panics now explicitly bugcheck instead of
looping indefinitely, recording the panic source location in the
bugcheck parameters. With debug assertions enabled, it breaks into the
debugger first.
([microsoft#642](microsoft#642))
- Added a dependency on `wdk 0.5`. Consumers with a direct `wdk 0.4.x`
dependency must upgrade it to be compatible with `wdk-panic 0.5.0`

### Other

- add cargo-wdk preview callout to Cargo Make section in README
([microsoft#641](microsoft#641))
- replace cargo-sort with taplo for dependency sorting
([microsoft#632](microsoft#632))

</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Gurinder Singh <[email protected]>
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