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

✨[FEATURE REQUEST] LTO #660

Open
SizzinSeal opened this issue May 9, 2024 · 1 comment
Open

✨[FEATURE REQUEST] LTO #660

SizzinSeal opened this issue May 9, 2024 · 1 comment
Labels
enhancement This builds on top of an existing feature

Comments

@SizzinSeal
Copy link

Overview
Linker Time Optimization (LTO) performs optimizations during linking, as the name suggests. This allows for more aggressive optimizations, especially around binary size, and especially in larger projects with many files.

Is your feature request related to a problem? Please describe.
The PROS cold package is huge. This makes wireless upload times very long when updating the cold package, and downloading new kernel versions slower, a big problem with slow internet. It also makes online storage a concern.

OPTIONAL Describe any solutions you've considered
GCC has a -flto flag to enable linker-time optimization

Additional context
This requires modification of the common.mk file, it's not related to the PROS API.

@SizzinSeal SizzinSeal added the enhancement This builds on top of an existing feature label May 9, 2024
@djava
Copy link
Contributor

djava commented May 9, 2024

Um, does LTO work nicely with dynamic linking? I'm unsure if we would actually get any shrinkage of binary size - If anything, I would expect binary sizes to grow from this without that because the symbols are all visible by default (see: The cobs_encode clashing issue, #418), but would be additionally inlined more heavily causing more duplication.

That issue could probably be mitigated if we do quite a bit of littering [[gnu::visibility("hidden")]] (or the equivalent __attribute__((visibility("hidden"))) in C) around the kernel codebase for anything internal.

Experimentation would be needed to determine if this is worth doing, as well as evaluating the compile-time tradeoff.

Regardless, within each individual template you could turn on LTO, as the PROS template format allows additional Makefiles to be added. This might be good enough for what you want.

I could also see an argument that LTO could be turned on for user projects and not for the kernel, but I'm doubtful of any observable benefit there in the vast majority of cases.

Overall, I'm not against this but I don't think its a no-brainer without further investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This builds on top of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants