Skip to content

Conversation

@copybara-service
Copy link

Stop forcing linker array entries to be retained. They will now be GC'd like normal, but will be iterable if retained.

There was no need to force them to be retained. Extensions only need to be retained if they are referenced, and normal linker GC can tell us if they are referenced.

This will make the ExtensionRegistry linker array agnostic to how extensions are packaged into TUs. However, TUs are still relevant if we want to perform "implicit weak" static tree shaking, because any extensions that are colocated in the same file will cause all referenced sub-message types to be pulled into the link. But this is no worse than what we get for regular messages -- for implicit weak we should always put every message and every extension into its own TU.

…'d like normal, but will be iterable if retained.

There was no need to force them to be retained.  Extensions only need to be retained if they are referenced, and normal linker GC can tell us if they are referenced.

This will make the ExtensionRegistry linker array agnostic to how extensions are packaged into TUs.  However, TUs are still relevant if we want to perform "implicit weak" static tree shaking, because any extensions that are colocated in the same file will cause all referenced sub-message types to be pulled into the link.  But this is no worse than what we get for regular messages -- for implicit weak we should always put every message and every extension into its own TU.

PiperOrigin-RevId: 803130581
@copybara-service copybara-service bot merged commit df180e2 into main Sep 4, 2025
@copybara-service copybara-service bot deleted the test_802760923 branch September 4, 2025 19:30
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 13, 2025
- partially revert protocolbuffers/protobuf#23378 to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Nov 13, 2025
- partially revert protocolbuffers/protobuf#23378 +to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
TomJo2000 pushed a commit to termux/termux-packages that referenced this pull request Nov 14, 2025
- partially revert protocolbuffers/protobuf#23378 to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
TomJo2000 pushed a commit to termux/termux-packages that referenced this pull request Nov 14, 2025
- partially revert protocolbuffers/protobuf#23378 +to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this pull request Nov 14, 2025
- partially revert protocolbuffers/protobuf#23378 to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this pull request Nov 14, 2025
- partially revert protocolbuffers/protobuf#23378 +to prevent error `ld.lld: error: undefined symbol: __stop_linkarr_upb_AllExts`
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.

1 participant