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: 487885077pull/10979/head
parent
21815faf0f
commit
225b936c01
2 changed files with 1 additions and 4 deletions
Loading…
Reference in new issue