Skip to content

feat: Make all stubs weak imports - #383

Merged
GrayJack merged 1 commit into
masterfrom
weak-stubs
Aug 28, 2026
Merged

feat: Make all stubs weak imports#383
GrayJack merged 1 commit into
masterfrom
weak-stubs

Conversation

@GrayJack

Copy link
Copy Markdown
Contributor

Make all stubs weak. This makes modules not fail to load when a linked lib was not loaded yet.

This is benefitial mostly for plugins, as they are often loaded before all system modules were started. And CFW have API that allows to inject a module to be loaded as early as the second module the system loads; in this edge case, all modules but sysmem libraries ideally should be weak.

I also noticed that some stubs were with the version part as 0011 which is the system module version used on FW>=6.60 on some modules, this will cause any module linking to them to fail loading on firmware version <6.60 as the system checks the stubs version on load if the library module was already loaded (if the imports are below or equal to the loaded library version, the module fails to load). On the cases of library modules allowed to be loaded multiple instaces of the module, at least one loaded version must match the imported stub version. I did not test the case of a weak imported with version bigger than the version that will be loaded after, but my best guess is that some error will occur in this case as well. To avoid this, I put then all to zero on the SDK stubs.

Comment thread src/audio/sceAudio_driver.S Outdated
Comment thread src/mpeg/sceMpegbase_driver.S Outdated
@GrayJack
GrayJack force-pushed the weak-stubs branch 4 times, most recently from 8751ac1 to 17ce6c2 Compare August 28, 2026 01:33
Comment thread src/sascore/sceSasCore.S
@GrayJack
GrayJack requested a review from rofl0r August 28, 2026 04:23

@rofl0r rofl0r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you requested a review: optically looks good now, but i cant comment on the change of the constants, as i dont really have an insight what the effect of changing them might cause.

@JoseAaronLopezGarcia JoseAaronLopezGarcia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a necessary change, specially for low level kernel development.

@GrayJack
GrayJack merged commit 0dbc0fc into master Aug 28, 2026
2 checks passed
@diamant3
diamant3 deleted the weak-stubs branch August 29, 2026 10:58
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.

3 participants