Request to clarify intended usage of libnosys in regards to linker warnings

"Pavel V. Melnikov" <[email protected]> Thu, 26 Feb 2026 17:49:13 +0100
Newsgroups gmane.comp.lib.newlib
Message-ID <CAJMnEwzWHuLYP6MDtBuKjisMsdQFgnHb5pW3itBCtLwjBkHoDA@mail.gmail.com>
Hello newlib team,

I use libnosys in my Cortex-M0 project, and at some point I decided to
upgrade GCC. Surprisingly, the linker started to emit warnings on
unimplemented functions:

ld.exe: C:/Users/melnik47/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libc_nano.a(libc_a-lseekr.o):
in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): warning: _lseek is not implemented and
will always fail
ld.exe: C:/Users/melnik47/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libc_nano.a(libc_a-readr.o):
in function `_read_r':
readr.c:(.text._read_r+0x10): warning: _read is not implemented and
will always fail
ld.exe: C:/Users/melnik47/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libc_nano.a(libc_a-writer.o):
in function `_write_r':
writer.c:(.text._write_r+0x10): warning: _write is not implemented and
will always fail

After some googling, I found other people stumbling upon this, for example:
https://stackoverflow.com/questions/73742774/gcc-arm-none-eabi-11-3-is-not-implemented-and-will-always-fail
https://community.st.com/t5/stm32cubeide-mcus/linker-warnings-on-every-new-project/td-p/791910
https://community.silabs.com/s/question/0D5Vm0000047to9KAA/linker-errors-on-update-to-gnu-arm-v1221

Basically the result is that a working codebase starts to produce
warnings after switching to a newer GCC.
The matter is complicated by the fact that these linker warnings
cannot be disabled with switches (as opposed to gcc warnings).

It seems that ARM GCC has this issue starting with 11.3, and it's a
combination of LD feature of printing .gnu.warning sections and
libnosys feature of generating these sections.
I tried to dig into the source code, and found out that the code for
the warnings has been there for ~27 years, so something else must have
changed in the toolchain building process on arm.com/linaro side
around that time; the change causes the .gnu.warning. sections to be
compiled in.starting with 11.3. Before that the newlib that comes with
ARM GCC just did not have the warnings sections compiled in. I
couldn't find what exactly changed in the build process (I asked for
clarifications on arm.com forum), but I'm writing here to ask a
different question.

If the process produces warnings, it means that newlib/nosys
developers do not intend the library to be used like this, right? So,
what is the intended usage of libnosys, the one that does not produce
linker warnings? Are developers expected to provide their own stubs in
addition to libnosys stubs? Then the question is why use libnosys in
the first place? Isn't its purpose to provide the stubs exactly so
that the developers don't have to? I'm afraid I don't fully understand
the intended usage of nosys, because before I tried to upgrade the
compiler, I was linking with libnosys to get the behaviour (stubs that
fail if called, without having to write them myself) that the new
warning is warning me about.

Best wishes,
  Paul
___________________________________

Best wishes,
Paul Melnikov