Archive (library) with syscalls?
Freddie Chopin
freddie_chopin@op.pl
Fri Sep 25 04:34:00 GMT 2015
Hi!
I'm trying to archive the majority of my RTOS project (
https://github.com/DISTORTEC/distortos ) as a static library. It works with
every single source/object file except for the files where I override (or
provide) syscalls.
If I link with the syscalls files as objects (not archived) and the archive
with rest of the code, then everything is fine.
If I want to link with the syscalls archived I get the following error:
> /home/freddie/gcc-arm-none-eabi-4_9-150626/bin/../lib/gcc/arm-none-eabi/4.9.
> 3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In
> function `_kill_r':
> /home/freddie/bleeding-edge-toolchain/src/newlib/newlib/libc/reent/signalr.
> c:61: undefined reference to `_kill'
> /home/freddie/gcc-arm-none-eabi-4_9-150626/bin/../lib/gcc/arm-none-eabi/4.9
> .3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In
> function `_getpid_r':
> /home/freddie/bleeding-edge-toolchain/src/newlib/newlib/libc/reent/signalr.
> c:96: undefined reference to `_getpid'
> /home/freddie/gcc-arm-none-eabi-4_9-150626/bin/../lib/gcc/arm-none-eabi/4.9
> .3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-sbrkr.o): In
> function `_sbrk_r':
> /home/freddie/bleeding-edge-toolchain/src/newlib/newlib/libc/reent/sbrkr.c:
> 58: undefined reference to `_sbrk'
> collect2: error: ld returned 1 exit status
The problem is that my own _sbrk_r() from the archive is discarded and the
function from libg.a is used (a wrapper for _sbrk())... Is there any (possibly
simple and generic) way to solve it? Maybe I'm missing some command line
switch or a command in linker script? I've tried grouping (via command line
and in linker script) or forcing _sbrk_r() to be initially undefined with
EXTERN(_sbrk_r) in the linker script, but this didn't change much. However - I
might have done something wrong...
It works if I explicitly call any of the functions from the code that is
linked as objects (so not from any source that goes into the archive), but
that can hardly be considered a solution...
Thanks in advance for any help!
Regards,
Freddie Chopin
More information about the Newlib
mailing list