-
-
Notifications
You must be signed in to change notification settings - Fork 242
fix: LNK4291 on Native AOT WinExe with Control Flow Guard #5298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7d4187c
Fix LNK4291 on Native AOT WinExe with Control Flow Guard
jamescrosswell 34fb068
docs: add CHANGELOG entry for #5298
jamescrosswell 53dd96b
ci: force *.cmake to eol=lf so the native cache key is stable cross-OS
jamescrosswell 3854a77
Revert manual CHANGELOG entry
jamescrosswell 4c2038b
Trim windows-config.cmake comment to a PR link
jamescrosswell a81a1e0
refactor: centralize CFG/EHCONT arch detection in build script
jamescrosswell a9d6807
fix: pass CFG/EHCONT flags via env var, not -D
jamescrosswell f586e5a
refactor: pass MSVC flags directly via -D, drop windows-config.cmake
jamescrosswell 09cbb9e
chore: drop *.cmake eol rule, no tracked cmake files remain
jamescrosswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,16 @@ | ||
| # Include debug info in the static library itself. See https://github.com/getsentry/sentry-native/issues/895 for context. | ||
| set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Z7 /O2 /Ob1 /DNDEBUG" CACHE STRING "C Flags for RelWithDebInfo" FORCE) | ||
| set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z7 /O2 /Ob1 /DNDEBUG" CACHE STRING "CXX Flags for RelWithDebInfo" FORCE) | ||
| set(_sentry_msvc_flags "/Z7 /O2 /Ob1 /DNDEBUG") | ||
|
|
||
| # Build the static lib with Control Flow Guard metadata so a Native AOT consumer that links it | ||
| # with <ControlFlowGuard>Guard</ControlFlowGuard> doesn't get LNK4291 against every __try/__except | ||
| # translation unit ("module may contain '__except' but was not compiled with /guard:ehcont"). | ||
| # See https://github.com/getsentry/sentry-dotnet/issues/4801. | ||
| # /guard:cf applies to both x64 and arm64; /guard:ehcont (EH continuation metadata) is x64-only, | ||
| # and LNK4291 itself is an x64-only warning, so only emit ehcont for the x64 build. | ||
| string(APPEND _sentry_msvc_flags " /guard:cf") | ||
|
jamescrosswell marked this conversation as resolved.
Outdated
|
||
| if("$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "AMD64") | ||
| string(APPEND _sentry_msvc_flags " /guard:ehcont") | ||
| endif() | ||
|
sentry[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| set(CMAKE_C_FLAGS_RELWITHDEBINFO "${_sentry_msvc_flags}" CACHE STRING "C Flags for RelWithDebInfo" FORCE) | ||
| set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${_sentry_msvc_flags}" CACHE STRING "CXX Flags for RelWithDebInfo" FORCE) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.