Archive (library) with syscalls?
Fri Sep 25 04:34:00 GMT 2015
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
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:
> 3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In
> function `_kill_r':
> c:61: undefined reference to `_kill'
> .3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In
> function `_getpid_r':
> c:96: undefined reference to `_getpid'
> .3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-sbrkr.o): In
> function `_sbrk_r':
> 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!
More information about the Newlib