Correct usage of nosys
Niklas Dusenlund <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAAHv3KF9Gt0sFtm7Qsx4XfO0iaGHP2n9Z2qS8LdL2ytJcqR=eg@mail.gmail.com> |
Hi!
I'm compiling for ARM cortex-m0. When I enable the nosys specs I get the
following warnings:
```
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-fstatr.o):
in function `_fstat_r':
fstatr.c:(.text._fstat_r+0x1c): warning: _fstat is not implemented and will
always fail
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-fstatr.o):
note: the message above does not take linker garbage collection into account
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-isattyr.o):
in function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): warning: _isatty is not implemented and
will always fail
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-isattyr.o):
note: the message above does not take linker garbage collection into account
```
I have no intention of using fstat or isatty. But if I implement the
missing functions like this:
```
int _fstat(int fildes, struct stat *st) {
errno = ENOSYS;
return -1;
}
int _isatty(int file) { return -1; }
```
I get the following errors:
```
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-isattyr.o):
in function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld:
/usr/local/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/lib/libc_nano.a(libc_a-fstatr.o):
in function `_fstat_r':
fstatr.c:(.text._fstat_r+0x1c): undefined reference to `_fstat'
```
If I remove the nosys specs I also get undefined references to _exit and
_sbrk.
In older versions of newlib I could use nano+nosys without warnings. What
is the appropriate way with the latest newlib? If I need to link in my own
stubs, how do I actually do that?
- Niklas