mruby-bin-mrbc: define global_mrb for non-mruby targets#6902
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request conditionally declares or defines the global_mrb variable in mrbc.c depending on whether MRC_TARGET_MRUBY is defined. Feedback suggests defining global_mrb as a macro expanding to NULL in the #else block to avoid polluting the global symbol namespace with an unused global variable.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
PicoRuby builds its bootstrap mrbc without PICORB_VM_MRUBY so that the standalone compiler does not depend on mruby headers or generated presym definitions. As a result, MRC_TARGET_MRUBY is not defined and mruby-compiler does not provide global_mrb, causing mrbc to fail at link time with an undefined reference. This patch lets mrbc use NULL when MRC_TARGET_MRUBY is not defined. For normal mruby builds, the existing behavior is unchanged: mrbc declares the symbol extern and mruby-compiler's ccontext.c remains its definition. This also keeps the ownership conditions complementary and avoids both undefined and duplicate symbol errors.
1a57d78 to
d5b0bc6
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.
PicoRuby builds its bootstrap mrbc without PICORB_VM_MRUBY so that the standalone compiler does not depend on mruby headers or generated presym definitions. As a result, MRC_TARGET_MRUBY is not defined and mruby-compiler does not provide global_mrb, causing mrbc to fail at link time with an undefined reference.
This patch lets mrbc use NULL when MRC_TARGET_MRUBY is not defined.
For normal mruby builds, the existing behavior is unchanged: mrbc declares the symbol extern and mruby-compiler's ccontext.c remains its definition.
This also keeps the ownership conditions complementary and avoids both undefined and duplicate symbol errors.