toolchain
toolchain copied to clipboard
Newlib's libgloss is not optimized for size even if "--specs=nano.specs" are used
Even if a user attempts to generate the smallest possible resulting binary specifying --specs=nano.specs
board-specific libs like libnsim.a
, libqemu.a
etc are used from "normal" (non-"nano" build) of the Newlib, thus contributing to the resulting binary size.
Why should we care about this? libnsim.a
and libqemu.a
are simulation only libraries. No reason to optimize them as they will never be used in production.
Fair enough, though why do ARM folks do that for "semi-hosting"? See https://github.com/foss-for-synopsys-dwc-arc-processors/newlib/blob/arc-2021.03/libgloss/arm/elf-rdimon.specs#L14:
# rdimon.specs
#
# Spec file for AArch64 baremetal newlib with version 2 of the
# AngelAPI semi-hosting using the SVC trap instruction.
...
*rdimon_libgloss:
%{!specs=nano.specs:-lrdimon} %{specs=nano.specs:-lrdimon_nano}
What about libdw_uart.a
, what if it is used in production?
You need to ask them :)
What about libdw_uart.a
?
And also even though we build & install "nano" version of libm.a
(libm_nano.a
) we don't replace -lm
with lm_nano
in `nano.specs, while RISCV folks do, see https://www.sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/riscv/nano.specs:
*link:
%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) %:replace-outfile(-lm -lm_nano)
What about
libdw_uart.a
?
My understanding is that you want to remove it (or refactor it?). You can pick this issue and make it part of your proposed solution.
And also even though we build & install "nano" version of
libm.a
(libm_nano.a
) we don't replace-lm
withlm_nano
in `nano.specs, while RISCV folks do, see https://www.sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/riscv/nano.specs:*link: %(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) %:replace-outfile(-lm -lm_nano)
libm
is not libgloss
:) Of course you can add a simple patch that is doing this.