gcc, crt0, and linker scripts...

Doug Evans dje@transmeta.com
Wed Aug 2 10:04:00 GMT 2000

 > 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. :-)

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