Fixed linker array sentinel on GCC, and added a test.#27042
Draft
copybara-service[bot] wants to merge 1 commit intomainfrom
Draft
Fixed linker array sentinel on GCC, and added a test.#27042copybara-service[bot] wants to merge 1 commit intomainfrom
copybara-service[bot] wants to merge 1 commit intomainfrom
Conversation
787e53d to
70b1b5a
Compare
70b1b5a to
60db669
Compare
This change modifies the `UPB_LINKARR_DECLARE` macro to use inline assembly to create a weak anchor symbol within the linkarr section. This ensures that the `__start_linkarr_` and `__stop_linkarr_` symbols are always defined by the linker, even when no other objects are placed in that section. The previous sentinel mechanism was broken on GCC. A new test, generated_registry_empty_test, is added to verify that the generated registry can be loaded successfully and is empty when no extensions are actually linked into the binary. Also adds `upb_exttable_size` and `upb_ExtensionRegistry_Size` for testing purposes. PiperOrigin-RevId: 904021133
60db669 to
01da5b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed linker array sentinel on GCC, and added a test.
This change modifies the
UPB_LINKARR_DECLAREmacro to use inline assembly to create a weak anchor symbol within the linkarr section. This ensures that the__start_linkarr_and__stop_linkarr_symbols are always defined by the linker, even when no other objects are placed in that section. The previous sentinel mechanism was broken on GCC.A new test, generated_registry_empty_test, is added to verify that the generated registry can be loaded successfully and is empty when no extensions are actually linked into the binary.
Also adds
upb_exttable_sizeandupb_ExtensionRegistry_Sizefor testing purposes.