libg.a Vs libc.a

Can Finner can.finner@gmail.com
Mon Dec 19 05:26:00 GMT 2011


>
> While building newlib, i had expected the following libraries to be
> generated: libc.a, libg.a (a debugging-enabled libc), and libm.a.
> But if seems there is no difference between 'libc.a' and 'libg.a'.
> Based on the flags, either both are generated with debug info or both
> without debug info.
>
> Also, looking the build logs and makefile, it seems 'libg.a' is a copy
> of 'libc.a'.
>
> libc.a: libc/libc.a libm.a
>        rm -rf libc.a libg.a tmp
>        mkdir tmp
>        cd tmp; \
>         $(AR) x ../libm.a $(MATHOBJS_IN_LIBC) ; \
>         $(AR) x ../libc/libc.a ; \
>         $(AR) $(AR_FLAGS) ../$@ *.o
>        $(RANLIB) libc.a
>        ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
> ------------------------(A)
>        rm -rf tmp
>
> My requirement is to build libc.a [without debug info] and libg.a
> [with debug info] and update the gcc spec [#define LIB_SPEC] file to
> choose the required libraries automatically.
>
Hi, I also got a question on this.
I built cross toolchain for arm-none-eabi with newlib.
for c++ programs, the below command:
arm-none-eabi-g++ hello.cc --specs=rdimon.specs -lc -lrdimon -lc -o a.out

complains that:
--------------------------------
libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text+0x2c): undefined reference to `_exit'
libc.a(lib_a-abort.o): In function `abort':
abort.c:(.text+0x10): undefined reference to `_exit'
libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text+0x1c): undefined reference to `_kill'

whle below command is ok;
arm-none-eabi-g++ hello.cc --specs=rdimon.specs -lg -lrdimon -lg -o a.out

BTW, the hello.cc is just a c++ hello world program.

Thanks
-- 
Regards.



More information about the Newlib mailing list