Skip to content

Avoid clang crash when building protobuf for arm64#1534

Open
yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1296_workaround_protobuf_24897
Open

Avoid clang crash when building protobuf for arm64#1534
yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1296_workaround_protobuf_24897

Conversation

@yukawa

@yukawa yukawa commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

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

Issue IDs

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

1 participant