-
Notifications
You must be signed in to change notification settings - Fork 8
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
Use DbgPrint in place of internal _PDCLIB_print
#56
Comments
It should be replaced where? The above code is not part of pdclib. |
Called in both of these places. I haven't found where or why these are being called in such a binary yet. |
The |
vfprintf and vsnprintf are implementations of printing functions, so replacing anything there is not an option. While we could replace the fprintf and fputs calls in this instance it comes with drawbacks and the benefit of doing so is small. A much better solution would be to move forward with XboxDev/nxdk#172 and allow redirection of stdout and stderr, which is much closer to what a user can expect from a C standard library. If you want to minimize your executable size it's the same procedure for the Xbox as for all other platforms: Avoid the functions that have big dependencies. I doubt you require raise() for your program. |
I don't, however platform initialization calls it, as well as the printf's mentioned. |
crt0 does not call any of these functions. |
I don't know what to tell you. Compile the sample I gave in the OP and check the disassembly. |
I'm not interested in doing your size optimization for you, but here's a free hint: Disable |
DVD auto mounting adds essentially nothing due to alignment. I'm not asking you to size optimize for me, I'm reporting an issue where things are being included and compiled that aren't being used, and you admit yourself that the platform init isn't using these functions, as well as functions that produce no user viewable output being redirected to DbgPrint. |
I think this is a bit of a niche. For nxdk, it should be higher priority to actually work / be functional, rather than optimizing for size.
His point was that some code must depend on those functions so they end up in the binary.
That shouldn't happen (if you instruct your compiler / linker to remove unused stuff) and would potentially be out of scope for nxdk (and more of a clang/lld thing) I think we can look into fixing the size issue if you can actually figure out which functions depend on Even if there's a bug (/ misconfiguration) in nxdk, you could work around it. Also note that |
Removing the forced stack protection and associated bits brings the majority of savings. Perhaps we can add define, or somehow check when nxdk-pdclib/platform/xbox/crt0.c Line 10 in 5a3a4c6
And signal being included is because of |
Attempting to minimize executable size, PDClib' print function uses a fair amount of space and is frankly unneeded, also as far as I can tell these aren't actually printed anywhere to the user(?), either the screen or via serial port. So it should be replaced with a call to
DbgPrint
.As is, this results in a 32KB binary. Nuking the while loops in
vfprintf
andvsnprintf
we end up with 28KB.The text was updated successfully, but these errors were encountered: