From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Russ.Shaw" To: Doug Evans Cc: crossgcc@sourceware.cygnus.com Subject: Re: gcc, crt0, and linker scripts... Date: Wed, 02 Aug 2000 16:51:00 -0000 Message-id: <3988B498.2623FAB6@webaxs.net> References: <001101c01fe1$7e10b260$58210b0a@huawei.com.cn> <3987B6DA.61538FBF@webaxs.net> <39880727.84586D00@webaxs.net> <14728.21640.41984.942659@casey.transmeta.com> X-SW-Source: 2000-08/msg00013.html 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, 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