Skip to content

Enable the 'custom vtable' feature on ARM64e#26475

Open
EdSchouten wants to merge 1 commit intoprotocolbuffers:mainfrom
EdSchouten:eschouten/20260319-custom-vtable
Open

Enable the 'custom vtable' feature on ARM64e#26475
EdSchouten wants to merge 1 commit intoprotocolbuffers:mainfrom
EdSchouten:eschouten/20260319-custom-vtable

Conversation

@EdSchouten
Copy link

ARM64e is ARM64 plus pointer authentication:
https://clang.llvm.org/docs/PointerAuthentication.html

With pointer authentication enabled, there are certain constructs that are no longer permitted/supported. For example, it is no longer possible to memcpy() C++ objects that use vtables. The reason being that each object's vtable pointer is signed using the object's address. Unfortunately, the Protobuf library does that a lot. This leads to various crashes.

One way to work around this is to build the Protobuf library with the 'custom vtable' feature enabled. This causes message types to follow the standard layout (i.e., not having a C++ class vtable).

ARM64e is ARM64 plus pointer authentication:
https://clang.llvm.org/docs/PointerAuthentication.html

With pointer authentication enabled, there are certain constructs that
are no longer permitted/supported. For example, it is no longer possible
to memcpy() C++ objects that use vtables. The reason being that each
object's vtable pointer is signed using the object's address.
Unfortunately, the Protobuf library does that a lot. This leads to
various crashes.

One way to work around this is to build the Protobuf library with the
'custom vtable' feature enabled. This causes message types to follow the
standard layout (i.e., not having a C++ class vtable).
@zhangskz zhangskz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 20, 2026
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 20, 2026
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.

3 participants