Package: libnewlib-arm-none-eabi Version: 3.3.0-1 Severity: normal Dear Maintainer,
newlib is supposed to be built with `-f{data,function}-sections`, and newlib-nano is supposed to be built with also `-Os -fshort-wchar`: === cut debian/rules === CFLAGS := CFLAGS="-g -O2 -ffunction-sections -fdata-sections" CFLAGS_NANO := CFLAGS="-g -Os -ffunction-sections -fdata-sections -fshort-wchar" === cut === Unfortunately, this is cross-compilation, and those flags are used to compile only *build host* objects, and not for *target* objects. So, all target libraries are built with wrong cflags. This is especially bad for newlib-nano, as `-fshort-wchar` is alters ABI (and lack of `-f*-sections` prevents removing unused data/functions on link time, which is important for ram/flash limited targets). (actually, I'm not sure if `-fshort-wchar` was that much good idea: you either don't use `wchar_t` at all, or you want "proper" 32-bit one; and given that `-fshort-wchar` is not automatically passed by `-specs=nano.specs`, this requires non-trivial and flaky auto-configuration from library users, e.g. https://github.com/RIOT-OS/RIOT/pull/5627 ). Fix: CFLAGS += CFLAGS_FOR_TARGET="-g -O2 -ffunction-sections -fdata-sections" CFLAGS_NANO += CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections -fshort-wchar" Disclaimer: noticed while building local backport; verified with buildd's logs https://buildd.debian.org/status/fetch.php?pkg=newlib&arch=all&ver=3.3.0-1&stamp=1583408649&raw=1 and inspecting lib*.a from "official" packages from sid/bullseye, buster, stretch (confirmed all was built without -f{funciton,data}-section). Bugreport metadata altered to match sid version. -- System Information: Debian Release: 9.13 APT prefers oldstable-updates APT policy: (500, 'oldstable-updates'), (500, 'oldstable-debug'), (500, 'oldstable') Architecture: i386 (x86_64) Foreign Architectures: amd64 Kernel: Linux 4.9.0-14-amd64 (SMP w/2 CPU cores) Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R), LANGUAGE=ru_RU.KOI8-R (charmap=KOI8-R) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages libnewlib-arm-none-eabi depends on: ii libnewlib-dev 3.3.0-1 Versions of packages libnewlib-arm-none-eabi recommends: ii gcc-arm-none-eabi 15:8-2019-q3-1 ii libstdc++-arm-none-eabi-ne 15:8-2019-q3-1 Versions of packages libnewlib-arm-none-eabi suggests: pn libnewlib-doc <none> -- no debconf information