Skip to content
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

Add Compiler Condition to use inline assembly optimizations with ARM64 for Compatibility with MSVC #17671

Conversation

dsmith111
Copy link
Contributor

@dsmith111 dsmith111 commented Jul 30, 2024

#17665

Problem
google\protobuf\parse_context.h(721,10): error C2059: syntax error: ':'
google\protobuf\parse_context.h(898,14): error C3861: 'Ubfx7': identifier not found

The latest protobuf versions fail to compile with MSVC on Windows ARM64 architecture.

Inline assembly is only available for x86 targets. For similar functionality in x64 or ARM64 code, use compiler intrinsics.

https://learn.microsoft.com/en-us/cpp/assembler/inline/writing-functions-with-inline-assembly?view=msvc-170

Solution
As inline assembly for win ARM64 with MSVC as a compiler is not supported (even ARM specific assembly functions), a term has been added to the conditions in parse_context.h to prevent the assembly optimizations for arm64 from executing if the compiler is MSVC.

Tested by compiling protobuf with MSVC on Windows ARM64 and AMD64 architecture. Compilation was a success.

Copy link

google-cla bot commented Jul 30, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dsmith111 dsmith111 marked this pull request as ready for review July 30, 2024 22:54
@dsmith111 dsmith111 requested a review from a team as a code owner July 30, 2024 22:54
@dsmith111 dsmith111 requested review from fowles and removed request for a team July 30, 2024 22:54
@dsmith111
Copy link
Contributor Author

dsmith111 commented Aug 1, 2024

Hey @fowles, just a habit when contributing to open-source (I know teams change), want to check in and make sure you're still an active maintainer here! @acozzette, adding the other majority git-blame owner as well.

@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 1, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 1, 2024
@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 14, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 14, 2024
@dsmith111 dsmith111 deleted the smithdavi/msvc-compatibility-patch branch August 15, 2024 15:07
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.

2 participants