-
Notifications
You must be signed in to change notification settings - Fork 156
Build -Os and -O2 versions of every target library #821
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
@keith-packard that feature looks awesome, and as usual only two questions:
|
8d05234
to
ccd100c
Compare
Yup, once we know how this will work upstream in gcc, we can figure out how to get it merged to ct-ng.
Yup, already submitted. https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665446.html |
ccd100c
to
d5990cc
Compare
d5990cc
to
dc13a5e
Compare
fa1749a
to
e3595ae
Compare
This is actually working when I disabled newlib-nano to keep the build times in check. The only testing failure occurred when a newlib-nano test slipped through; that should be fixed with zephyrproject-rtos/zephyr#80161. Here's my best guess as to the space required for an x86_64 linux toolchain:
This includes -Os and -O2 versions of picolibc, newlib and newlib-nano along with libstdc++ compiled for each one. We could probably hack things up so that newlib was only provided in -O2 version while newlib-nano only in -Os; that would save two thirds of the increase measured above. There isn't a great alternative here -- we can tell people to use the module when they need -O2, but that rules out using C++ with -O2. When can we consider reducing the number of C library variants provided in the SDK? |
I have cherry-picked that patch into the
I think trying to completely remove newlib from the SDK is going to be met with a lot of backlashes. Another option would be to remove newlib from the main SDK distribution and create a separate newlib "overlay," which can be downloaded and installed only if one needs it (similar to what LLVM Embedded Toolchain for Arm does). |
Thanks.
Yeah, was only thinking about newlib-nano.
That would save a huge amount of space, and should be fairly easy to implement. |
e3595ae
to
abaa60e
Compare
@keith-packard crosstool-ng PR has been merged. Can you please open a PR for GCC and picolibc (or do upstream sync for it)? |
Will take care of this tomorrow. |
abaa60e
to
6fd2e1d
Compare
I've got the GCC PR queued. zephyrproject-rtos/picolibc main is sync'd with picolibc main to pull in fixes for arc, xtensa and add uchar.h |
Merged GCC PR. It looks like I merged wrong crosstool-ng PR (though, I assume it is still valid?) and crosstool-ng submodule is still pointing to Could you please open a PR for crosstool-ng as well? |
6fd2e1d
to
f68d9f5
Compare
zephyrproject-rtos/crosstool-ng#30 Note that the build tests are currently failing because Zephyr is defining values which are required to be present in limits.h (and which upstream picolibc now includes). zephyrproject-rtos/zephyr#80409 |
I've rebased this PR and have a plan to make it workable -- we don't need space optimized versions of every library for every target, only for targets which need the smallest possible executables. I've proposed that we deliver space optimized variants only for arm and arc. We can easiliy add more by modifying the SDK configuration files to add 'CT_MULTILIB_SPACE=y' as desired. |
29f7c44
to
70cfba4
Compare
70cfba4
to
42e26fa
Compare
84a5049
to
cae3442
Compare
Need to use BUILD_DIR instead of WORKSPACE as the latter hasn't been set at this point. Signed-off-by: Keith Packard <[email protected]>
Make sure we catch build failures. Signed-off-by: Keith Packard <[email protected]>
This makes it possible to build picolibc for microblazeel Signed-off-by: Keith Packard <[email protected]>
Picolibc has had microblazeel support since version 1.8.2, which was released about two years ago. Signed-off-by: Keith Packard <[email protected]>
Merge GCC version with multilib-space support which adds -Os versions of every multilib configuration. Signed-off-by: Keith Packard <[email protected]>
The CT_MULTILIB_SPACE option passes --enable-multilib-space to gcc so that we get -Os versions of every multilib configuration. Signed-off-by: Keith Packard <[email protected]>
Switch to latest picolibc release, 1.8.10 Signed-off-by: Keith Packard <[email protected]>
bc8f5cf
to
1cfc4b1
Compare
Add rx-zephyr target support and multilib options. Signed-off-by: Keith Packard <[email protected]>
This adds basic RX architecture information along with the rx.sh helper script. Signed-off-by: Keith Packard <[email protected]>
This commit only add minimal require part to enable Renesas RX architecture gcc toolchain build on Zephyr SDK Signed-off-by: Duy Nguyen <[email protected]>
Signed-off-by: Duy Nguyen <[email protected]>
Signed-off-by: Duy Nguyen <[email protected]>
This provides -Os versions of every toolchain library for these two targets. Other targets that want to add the -Os versions can include CT_MULTILIB_SPACE=y to their config files. Signed-off-by: Keith Packard <[email protected]>
1cfc4b1
to
5192bc8
Compare
This uses a new gcc config option, --enable-multilib-space, which duplicates every multilib configuration, adding
a new version which optimizes for space. With this, every library in the toolchain will get built twice and will be selected
depending on the options applied during the link phase. Add -Os or -Oz and you will get space-optimized versions of every toolchain library.
crosstool-ng PR:
zephyrproject-rtos/crosstool-ng#26GCC PR: zephyrproject-rtos/gcc#39
Picolibc PR: TBD