-
-
Notifications
You must be signed in to change notification settings - Fork 697
Use gcc-ar and gcc-ranlib #702
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
Conversation
@TheRealMazur Great find! Just tried and compiled on Apple M1 and the flash size reduced from 1.427.984 bytes to 1.276.720 bytes. 147k less flash used. |
@Jason2866 just to be sure - you tried applying my changes and enabling lto, right? This PR should not have any effects without enabling lto AFAIK 😅 |
Yes, since I forked this github, and espressif Arduino32 for our needs already it was a easy change to use the option lto for compile and linking |
Just keep in mind that this can mess up backtrace symbols. I needed to add |
For me using |
It's possible that some specific linker flags or scripts would need to be modified to work with C3. That shouldn't block this PR, as it merely allows for opting in to use lto. Unfortunately I'm not able to help you with with debugging C3, as I don't own one. |
yes, this PR should be merged! |
This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions. |
@valeros @ivankravets Sorry for the direct pings but I'm not sure how to get some progress on this PR. Could you help move it forward? |
We use in our fork for Tasmota. |
Bump |
This is an official dev-platform and we try to keep it in accordance with official Espressif build workflows. Nevertheless, you can customize the toolchain for your project by leveraging PRE scripting: platformio.ini [env]
extra_scripts = pre:custom_toolchain.py custom_toolchain.py Import("env")
env.Replace(
AR="xtensa-esp32-elf-gcc-ar",
RANLIB="xtensa-esp32-elf-gcc-ranlib"
) Could you try the snippet above? |
Good reason. @me-no-dev can we switch to this versions? |
@Jason2866 feel free to PR to the 5.1-libs branch. We can have it as part of 3.0.0 |
+1 👍 for merging this into development. |
In order to use link time optimizations (lto)
ar
andranlib
need to have the lto plugin supplied. This is achieved easiest by using thegcc-*
equivalents. More info:https://embeddedartistry.com/blog/2020/04/13/prefer-gcc-ar-to-ar-in-your-buildsystems/
This won't affect most builds at all, because lto is disabled in the framework package. As far as I've found this setting comes from espressif/esp-idf#3989 and is more of a hotfix for Mac builds than a needed change.
I've successfully enabled lto in my project without any functional differences, achieving ~5% flash usage reduction.