How can I disable the default libgloss for arm when linking!

Mark Salter msalter@redhat.com
Wed May 9 06:39:00 GMT 2001


>>>>> Cliff Tsai writes:

> Hi:
>     When I link libc.a with my own libgloss.o functions,
>     The multiple definition errors occured!

>     When building newlib for arm.The libgloss functions(_open,_close....)
>     in /libc/sys/arm/systencalls and functions in libcfunc.c will be
> created.
>     How can I remove the installation when building newlib for arm?
>     Or how can I disable them?

> Thanks!


I just did this for ARM based boards running RedBoot. Having the syscalls.c
in libc was a mistake. It really should be moved out at some point. Anyway,
I created a readboot-crt0.o and a redboot-syscalls.o which has the right
(for RedBoot) trap binding functions. These are the same functions which
are provided by .../libc/sys/arm/systemcalls.c. To link an app, you have
to link in _all_ of systemcall trap bindings to prevent pulling in the
systemcalls.o from libc. I do this with a gcc specs file fragment:

--- cut here myboard.specs ---
%rename link                old_link

*link:
-T redboot.ld%s -Ttext 0xA0020000 %(old_link)

*startfile:
crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s

--- cut here myboard.specs ---

I can then build a simple app like this:

  % arm-elf-gcc -g -O2 -specs=myboard.specs hello.c -o hello.x

--Mark



More information about the Newlib mailing list