Avoid clang crash when building protobuf for arm64#1534
Open
yukawa wants to merge 1 commit into
Open
Conversation
As part of our on-going effort towards making it possible to build Mozc on Windows ARM64 machines (google#1296), this commit works around a known compiler crash issue when building protobuf for Windows Arm64 target. On the aarch64-pc-windows-msvc target, clang-cl 20.1.1 crashes when building protobuf/upb/wire/encode.c for Windows ARM64 target. This is due to a known compiler issue [1], which protobuf has already worked around [2]. The remaining issue for us is that the way how protobuf worked around this assumes that __SEH__ macro is defined, which is only true when clang is used for -windows-gnu target the upstream bug was filed against. For us who use -windows-msvc target, the guard never fires. As a quick workaround on our side, let's define __SEH__ ourselves only for protobuf/upb/wire/encode.c and only when building Mozc for Windows. Note that the per-file regex uses a "[+]" character class rather than "\+" because the bazelrc tokenizer strips the backslash before the pattern reaches the matcher. [1]: llvm/llvm-project#47432 [2]: protocolbuffers/protobuf@0e84323
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
As part of our on-going effort towards making it possible to build Mozc on Windows ARM64 machines (#1296), this commit works around a known compiler crash issue when building protobuf for Windows Arm64 target.
On the
aarch64-pc-windows-msvctarget, clang-cl 20.1.1 crashes when buildingprotobuf/upb/wire/encode.cfor Windows ARM64 target. This is due to a known compiler issue (llvm/llvm-project#47432), which protobuf has already worked around (protocolbuffers/protobuf@0e84323).The remaining issue for us is that the way how protobuf worked around this assumes that
__SEH__macro is defined, which is only true when clang is used for -windows-gnu target the upstream bug was filed against. For us who use-windows-msvc target, the guard never fires.As a quick workaround on our side, let's define
__SEH__ourselves only forprotobuf/upb/wire/encode.cand only when building Mozc for Windows.Note that the per-file regex uses a
[+]character class rather than\+because the bazelrc tokenizer strips the backslash before the pattern reaches the matcher.Issue IDs