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 for issue #386 to enable LTO support. #419

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

daniel-starke
Copy link
Contributor

This pull request adds support for the gcc/g++ -flto flag by using the plugin enabled versions of ar and ranlib. This does not include the -flto flag by default. toolchain-gccarmnoneeabi 1.70201.0 seems to fail at linking stage when using LTO in some cases. A newer toolchain like 1.90201.191206 should be used instead when compiling with LTO.

@dzarda
Copy link

dzarda commented Sep 14, 2020

Is there a reason this cannot be merged ❓

@valeros
Copy link
Member

valeros commented Sep 15, 2020

Hi @daniel-starke ! Sorry for the late reply. Just to clarify, are there any possible side effects with enabled LTO on older toolchains like 1.70201.0 when gcc-ar and gcc-ranlib are used?

@daniel-starke
Copy link
Contributor Author

Like mentioned in the commit, this patch does only enable support for LTO. It does not enable LTO itself. LTO comes with various constraints that can break existing code if not handled correctly. It can, after applying this patch, be enabled via command-line option -flto. However, I advice that everyone uses it on his/her own risk. But as it stands today, this feature is not usable at all with PlatformIO. The here proposed fix closes this gap, allowing everyone to add LTO compatibility to their work.

Just replacing ar with gcc-ar and ranlib with gcc-ranlib has no side effect, as far as I know.

@valeros valeros merged commit 5d6d2e9 into platformio:develop Sep 15, 2020
@valeros
Copy link
Member

valeros commented Sep 15, 2020

Thanks!

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