From b83a05f02ac26ff33d1e2573ed17e5f78177bdaf Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Sun, 12 Jan 2025 14:49:54 -0800 Subject: [PATCH 1/4] fix: add missing arm64rt library to linker flags for arm64 kernel-mode builds --- crates/wdk-build/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index db2e8aa8..acfe4c8e 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -698,6 +698,12 @@ impl Config { println!("cargo::rustc-link-lib=static=hal"); println!("cargo::rustc-link-lib=static=wmilib"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CPUArchitecture::ARM64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); @@ -717,6 +723,12 @@ impl Config { println!("cargo::rustc-link-lib=static=WdfLdr"); println!("cargo::rustc-link-lib=static=WdfDriverEntry"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CPUArchitecture::ARM64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); From 10ee5fb6f2d889dc981c3000ffc4ffb0805a9970 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Sun, 12 Jan 2025 14:49:54 -0800 Subject: [PATCH 2/4] fix: add missing arm64rt library to linker flags for arm64 kernel-mode builds --- crates/wdk-build/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index db2e8aa8..acfe4c8e 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -698,6 +698,12 @@ impl Config { println!("cargo::rustc-link-lib=static=hal"); println!("cargo::rustc-link-lib=static=wmilib"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CPUArchitecture::ARM64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); @@ -717,6 +723,12 @@ impl Config { println!("cargo::rustc-link-lib=static=WdfLdr"); println!("cargo::rustc-link-lib=static=WdfDriverEntry"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CPUArchitecture::ARM64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); From d488e6a693ced3d95e44ab384eff7585ff78af69 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 15 Jan 2025 12:53:29 -0800 Subject: [PATCH 3/4] fix: correct type casing for CPUArchitecture in ARM64 binary build configuration --- crates/wdk-build/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index acfe4c8e..8e3960f8 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -700,7 +700,7 @@ impl Config { // Emit ARM64-specific libraries to link to derived from // WindowsDriver.arm64.props - if self.cpu_architecture == CPUArchitecture::ARM64 { + if self.cpu_architecture == CpuArchitecture::ARM64 { println!("cargo::rustc-link-lib=static=arm64rt"); } @@ -725,7 +725,7 @@ impl Config { // Emit ARM64-specific libraries to link to derived from // WindowsDriver.arm64.props - if self.cpu_architecture == CPUArchitecture::ARM64 { + if self.cpu_architecture == CpuArchitecture::ARM64 { println!("cargo::rustc-link-lib=static=arm64rt"); } From e7534b40825d41cc43e765296bae10d0103bd81c Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 15 Jan 2025 15:59:27 -0800 Subject: [PATCH 4/4] fix: correct type casing for CPUArchitecture in binary build configuration --- crates/wdk-build/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 8e3960f8..73b31381 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -700,7 +700,7 @@ impl Config { // Emit ARM64-specific libraries to link to derived from // WindowsDriver.arm64.props - if self.cpu_architecture == CpuArchitecture::ARM64 { + if self.cpu_architecture == CpuArchitecture::Arm64 { println!("cargo::rustc-link-lib=static=arm64rt"); } @@ -725,7 +725,7 @@ impl Config { // Emit ARM64-specific libraries to link to derived from // WindowsDriver.arm64.props - if self.cpu_architecture == CpuArchitecture::ARM64 { + if self.cpu_architecture == CpuArchitecture::Arm64 { println!("cargo::rustc-link-lib=static=arm64rt"); }