Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _exit issue #52

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Fix _exit issue #52

merged 1 commit into from
Jul 24, 2024

Conversation

fjtrujy
Copy link
Member

@fjtrujy fjtrujy commented Jul 22, 2024

Description

This PR is required after improving exit flow in pspsdk
pspdev/pspsdk#222

The reason why now is this required is because _exit definition has been moved to crt0 and crt0_prx files.
In theory, this is totally right, however, the bootstrap module being used here, is quite messy.
When generating a prx if you define the function module_start the whole ctr0_prx will be skipped, then the boostrap module uses some functions from newlib, and these functions from newlib ends needing _exit, which wasn't included because crt0_prx was skipped.

I'm not sure if we should move _end out of the crt0 and crt0_prx, I don't think so, however, I'm pretty sure that the issue we are suffering is an edge case, so I think we shouldn't worry that much for now...

Cheers.

@sharkwouter
Copy link
Member

Wouldn't it be possible to run ctr0 or rename the module_start? I'd expect more prx files to run into this issue.

@fjtrujy
Copy link
Member Author

fjtrujy commented Jul 24, 2024

Wouldn't it be possible to run ctr0 or rename the module_start? I'd expect more prx files to run into this issue.

We shouldn’t suffer this issue that “often”. Usually when creating PRX there 2 approaches, either you create it without any additional change (as you do it when you want to debug in pspslinkusb), or you generate super tiny PRXs that don’t use any additional custom library (as all the remaining PRXs we have inside of “psplinusb”).
However, with this PRX we aren’t doing none of them, and this is actually dangerous as we may face unexpected issues, it uses newlib functions (this is why termínate is being used) without the proper libcglue init steps, it works just by chance.

Said that I still think that we should keep _exit where it is, you as a user will face this “strange” compilation issue as a kind of warning, saying something strange is going on…
Additionally, to move it to a different place will force you to have it in one the standards files/libs.
Previously it was part of “libcglue” which IMO is also wrong

@fjtrujy fjtrujy merged commit 2d9dbc7 into master Jul 24, 2024
6 checks passed
@fjtrujy fjtrujy deleted the fix_exit branch July 24, 2024 07:29
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