Changes the UPB_CONSTRUCTOR macro for ELF platforms to use COMDAT-grouped assembly for .init_array. This allows the linker to deduplicate the constructor pointer entries to exactly one copy, eliminating binary bloat and preventing the weak constructor from being executed multiple times at startup.
PiperOrigin-RevId: 945282190
* Updates edition to 2026 in the unittest protos.
* Removes the obsolete target compile option `cc_enable_arenas` since C++
options are moved and arenas are enabled by default.
* Updates `maximum_edition` target constraints to edition 2026 in Java,
Python, C#, and upb build targets to allow loading and validation of
Edition 2026 files.
* Regenerates internal_options_bootstrap compiler files.
PiperOrigin-RevId: 944424868
Avoid generating double-checked locking inside every generated message class's
dynamicMethod(GET_PARSER) by centralizing the parser instantiation and caching
in a thread-safe map inside GeneratedMessageLite.
This saves substantial DEX and ODEX size for apps with many protobuf classes.
Note: This change requires the generated code to run against a runtime of at
least the same version. Mixing new generated code with an older runtime version
is not supported (see https://protobuf.dev/support/cross-version-runtime-guarantee/).
PiperOrigin-RevId: 944139195
Move all the tags to the high bits. This avoids alignment issues and we can
unconditionally mask all the tags in one go. Previously we would have to know
the type of the field to see if we could mask the low bit tags.
We can now remove both the template type and the runtime type input parameters.
PiperOrigin-RevId: 943899071
Currently if you build with `--incompatible_enable_proto_toolchain_resolution`
(on by default in Bazel 9) on main or any recent Git commit, you end up using
an old v33.0 prebuilt protoc binary. The `authenticity_validation` rule does
not catch this, because it just checks that the `RELEASE_VERSION` prebuilt we
downloaded has version `RELEASE_VERSION`. This constant is never updated in
Git, only in releases published to BCR. As a result, we get mysterious compiler
errors rather than a clear error about what is going wrong.
This commit fixes the problem by keeping `RELEASE_VERSION` up to date with the
existing `PROTOC_VERSION`. This will cause the build to fail loudly if you try
to use a prebuilt protoc binary with a protobuf Git checkout. To make sure that
developers do not hit this issue, I updated .bazelrc to explicitly turn off use
of the prebuilt protoc.
I also removed `examples/example_without_cc_toolchain/`, because I don't think
this test is doing anything useful anymore. It attempts to exercise the
prebuilt protoc, but that is something we do not expect to work correctly with
unreleased protobuf code, and with my change it would result in a build error.
Closes#28167
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/28167 from protocolbuffers:prebuilt d7c67c9ce7
PiperOrigin-RevId: 943511369
In this mode we collocate the default instance, the ClassData and the parse
table in a single structure. This allows for better memory locality, but also
reduces pointer crosslinking, making the merged data structure smaller than its
parts.
For now, we only turn on in ASan builds to give it some more coverage.
PiperOrigin-RevId: 943327512
Fixes https://github.com/protocolbuffers/protobuf/issues/28261 by setting symbol visibility in `setup.py`, similar to `py_extension.bzl`, using the existing branching logic to bypass the flag on MSVC.
This issue manifests in the [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs) build of the `protobuf` python package, which contains upb symbols, and causes fatal failures when loaded in a process that separately links/loads libprotobuf. We'll supply a patch there as well, until this can be backported or released in future protobuf versions.
Closes#28264
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/28264 from mitchallain:mallain/fix-python-upb-symbols 6e118a62bf
PiperOrigin-RevId: 942223178