Skip to content

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Nov 1, 2025

Define a generated registry for tracking linked-in extensions.

#test-continuous

This behaves similarly to the generated extension registry in other languages. A global ref-counted (lock-free thread-safe) singleton registry can be lazily constructed from the linker array data produced by gencode. For now, this is simply used to preserve custom options on the descriptors in our DefPool.

This design makes heavy use of various non-standard C extensions. It expands on the pre-existing linker arrays used for extensions, adding weak constructors to register all of the extensions linked into each binary. This was tested and works with clang and gcc, and a similar approach was implemented for MSVC. For unsupported compilers or architectures, the generated registry will be unpopulated.

@copybara-service copybara-service bot force-pushed the test_825343000 branch 26 times, most recently from 65d9c6d to 69b90e2 Compare November 5, 2025 18:53
#test-continuous

This behaves similarly to the generated extension registry in other languages.  A global ref-counted (lock-free thread-safe) singleton registry can be lazily constructed from the linker array data produced by gencode.  For now, this is simply used to preserve custom options on the descriptors in our DefPool.

This design makes heavy use of various non-standard C extensions.  It expands on the pre-existing linker arrays used for extensions, adding weak constructors to register all of the extensions linked into each binary.  This was tested and works with clang and gcc, and a similar approach was implemented for MSVC.  For unsupported compilers or architectures, the generated registry will be unpopulated.

PiperOrigin-RevId: 825343000
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.

2 participants