gcc, crt0, and linker scripts...
Russ.Shaw
russell@webaxs.net
Wed Aug 2 16:51:00 GMT 2000
Hi,
My last reply i sent last night bounced after 5 hours.
I got it all to compile and link now :)
I found that the source for crt0.S is in:
newlib-1.8.2/newlib/libc/sys/h8300hms/crt0.S
The last error i was getting was that the _end symbol in some
C libraries remained undefined. I found that this was defined
in the supplied linker scripts:
/usr/local/h8300-hms/lib/ldscripts/h8300h.x
h8300h.xbn
h8300h.xn
h8300h.xr
h8300h.xu
So i added _end to my own script, and voila, no errors :)
I'll check that _nostartfiles option to see whether i need it for
the separate ld command. gcc and binutils are quite impressive after
one gets the hang of it :)
Doug Evans wrote:
>
> > However, what does gcc use for a linker script? I need to tell
> > gcc about my eprom memory map etc.
>
> It uses these:
>
> > /usr/local/h8300-hms/lib/ldscripts/h8300h.x
> > h8300h.xbn
> > h8300h.xn
> > h8300h.xr
> > h8300h.xu
>
> > I could get gcc to use my own script using -Wl,T<myscript>, but
> > i'll still get linker errors because the output section names
> > need to be compatible with the supplied crt0 start-up file.
> >
> > I can't use my own startup file, because the standard C libraries
> > refer to symbols such as _end in crt0.o.
>
> Maybe take the source for newlib's crt0.o
> (newlib/libc/sys/h8300hms/crt0.S), and munge it with your crt0.S
> to achieve something usable?
>
> When linking, specify your crt0.o and -nostartfiles.
>
> > So what is the 'normal' procedure for configuring a cross-gcc to
> > custom hardware?
>
> In general, it's always the same (just as you have already done).
> There's no trick (in general) to configuring the gnu tools
> for custom hardware. The trick comes at link time.
> You need to write your own linker script (and maybe crt0) and
> work out the right args to pass to gcc (or ld) when you link.
>
> Keep at it, you're almost there. :-)
--
*******************************************
* Russell Shaw, B.Eng, M.Eng(Research) *
* email: russell@webaxs.net *
* Australia *
*******************************************
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list