-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Libstdc++ Nano? #1228
Comments
Looks like the nano C++ lib is not built alright. I presume that this is an omission in the build scripts? If you want a toolchain with this library then perhaps the xPack binary version from @ilg-ul might help? Better still might be the picolibc build of the tools since picolibc looks very promising as a replacement for newlib/nano-newlib? but, unfortunately, I'm not sure if that work was ever completed? Maybe @keith-packard could comment?
In what way exactly?
If you're using an embedded target then it normally makes sense to disable these and other (e.g. RTTI) options.
It doesn't really make sense to compare the size of binaries for completely different target architectures/ISAs. |
Thanks for the reply @TommyMurphyTM1234!
This was my thinking as well, it seems the ARM tools do this pass: https://github.com/ARM-software/toolchain-gnu-bare-metal/blob/master/build-toolchain.sh#L494-L499 and copy them: https://github.com/ARM-software/toolchain-gnu-bare-metal/blob/bcd60182260b887b9e798d3dbb67f8d3c0834a5a/build-common.sh#L201-L230. I'm still familiarizing myself with the build scripts here but would love to try to get a smaller libstdc++ out of this build, if theres a file I should be looking at.
I just meant the riscv nano specs don't seem to include a remap of libstdc++ like the arm one does:
(https://github.com/bminor/newlib/blob/master/libgloss/arm/elf-nano.specs and https://github.com/bminor/newlib/blob/master/libgloss/riscv/nano.specs)
My code is being compiled with:
Sorry, I meant the % of the resulting text segment that is "my code" versus "library code" I noticed was very much higher for this toolchain than arm, which lead me to look at the map file to see why. |
Does it make any difference if you use But the key issue that you reported - i.e. that the |
I'm not sure, and I cannot check this now, but the xPack scripts might build the nano version with some extra options for libstdc++ too in order to reduce the size. Or at least that was the intention. |
I checked and the xPack build scripts use
You can give the xPack binaries a try and check if you get shorter applications. As a side note, except for larger flash sizes, there is nothing wrong with carefully using exceptions in embedded C++ applications. By carefully I mean only for really catastrophic and non-recoverable cases when execution is anyway disrupted, and not for passing regular errors in time-critical code. |
When I build this toolchain locally (./configure --prefix=$INSTALL_DIR --with-arch=rv32i --with-cmodel=medlow --with-multilib-generator="rv32i-ilp32--;rv32ima-ilp32--") I notice in the output there are a few nano libs:
However, when comparing to my Arm toolchain:
Noticably, libstdc++_nano.a seems to not be built by RISCV toolchain and therefore my riscv binaries are larger than the stm ones as the full libcstd++ brings in exceptions and demangle. Is there a way to produce this build? (It also looks like nano.specs itself for riscv needs to be updated?).
Thanks!
The text was updated successfully, but these errors were encountered: