refactor(esp): split _exit into separate file for QEMU support#10
Conversation
Move _exit implementation from syscalls.c to syscalls_exit.c to allow easy replacement with semihosting version for QEMU emulator support. This separation enables llgo to compile the semihosting _exit as a separate object file that can override the default implementation when building for QEMU targets. Related to: goplus/llgo#1539 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @luoliwoshang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the _exit function by moving it from syscalls.c to a new, separate file syscalls_exit.c. This is a sensible refactoring that improves modularity and will allow the function to be more easily overridden for different build configurations, such as for QEMU support. The change is clear and well-motivated. I have one minor suggestion to improve the code by explicitly marking an unused function parameter.
| * with semihosting version for QEMU emulator support. | ||
| */ | ||
|
|
||
| void |
There was a problem hiding this comment.
IMPORTANT: This function should be marked as __attribute__((weak)) to enable the stated goal of "easy replacement with semihosting version for QEMU emulator support."
Following the pattern in syscalls.c:28 where _write is declared weak, this should be:
| void | |
| __attribute__((weak)) | |
| void |
Without the weak attribute, semihosting implementations cannot override this function, defeating the purpose of this refactoring.
|
CRITICAL: The Please add %C%_libsys_board_a_SOURCES = \
%D%/esp_board.c \
%D%/syscalls.c \
%D%/syscalls_exit.cWithout this change, the |
Code Review SummaryThe refactoring concept is sound—separating
These prevent the PR from achieving its stated goal. Please see inline comments for details. |
Summary
_exitimplementation fromsyscalls.ctosyscalls_exit.c_exitas a separate object file that can override the default implementationRelated
🤖 Generated with Claude Code