Skip to content

Add stubs for __CxxFrameHandler4 and __GSHandlerCheck_EH4 - #438

Merged
Gurinder Singh (gurry) merged 7 commits into
microsoft:mainfrom
ladipro:add-fh4
Aug 6, 2025
Merged

Add stubs for __CxxFrameHandler4 and __GSHandlerCheck_EH4#438
Gurinder Singh (gurry) merged 7 commits into
microsoft:mainfrom
ladipro:add-fh4

Conversation

@ladipro

Copy link
Copy Markdown
Member

Certain build environments may use version 4 of EH frame handlers and hit the same issue that prompted adding the __CxxFrameHandler3 stub. This change is adding two more stubs, __CxxFrameHandler4 and __GSHandlerCheck_EH4, and makes sure they are not folded (have distinct addresses in the resulting binary) by returning distinct values.

None of these functions will ever execute. They are a workaround for a compiler design issue which will take some time to resolve.

Copilot AI review requested due to automatic review settings August 4, 2025 12:17

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.

Pull Request Overview

This PR adds additional exception handling stubs to resolve linker issues in newer build environments that use version 4 of EH frame handlers. The change extends the existing workaround for compiler design issues by adding two new stub functions that return distinct values to prevent function folding.

  • Add __CxxFrameHandler4 stub function returning 1
  • Add __GSHandlerCheck_EH4 stub function returning 2
  • Update comment to reflect multiple stubs instead of single stub

Comment thread crates/wdk-sys/src/lib.rs Outdated
Comment thread crates/wdk-sys/src/lib.rs Outdated
@ladipro

Copy link
Copy Markdown
Member Author

cc Gurinder Singh (@gurry)

Ladi Prosek (ladipro) and others added 2 commits August 4, 2025 14:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ladi Prosek <ladi.prosek@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ladi Prosek <ladi.prosek@gmail.com>

@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.

just one small nit on constifying it since the feature has long since been stabilized. Otherwise LGTM.

this is blocked on #406 going in first, but that should be resolved shortly

Comment thread crates/wdk-sys/src/lib.rs Outdated
@gurry
Gurinder Singh (gurry) added this pull request to the merge queue Aug 6, 2025
Merged via the queue into microsoft:main with commit 935d41a Aug 6, 2025
118 checks passed
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.

4 participants