Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing
google::protobuf::RepeatedPtrField<std::string>
issue i…
…n GCC When we build DSOs in CMake, we use the `-fvisibility=hidden` flag to hide symbols by default and then explicitly export public-facing symbols using `__attribute__((visibility ("default")))` (for example via the `PROTOBUF_EXPORT_TEMPLATE_DECLARE` macro). A bunch of symbols related to `google::protobuf::RepeatedPtrField<std::string>` were not visible on libprotobuf.so for GCC builds, and it turned out to be because GCC was ignoring the visibility attribute due to it appearing after `RepeatedPtrField<std::string>` had already been instantiated. I tried moving the declaration up in the file, but found that if I move it up high enough to fix GCC then it breaks Clang. So instead, this change just disables the code size optimization that required us to centralize the template definition in one .cc file. Now any usage of `RepeatedPtrField<std::string>` will be inlined into each translation unit that uses it, so we don't have to worry about the definition being visible in libprotobuf.so. Fixes #10833. PiperOrigin-RevId: 487885077
- Loading branch information