This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems with m68k-coff-ld


Well I was using m68k-coff (and am currently using m68k-elf, but I had to
hack gcc to do it...). My target is a CPU32P (68360).

The initialised data appears to works for me, try adding -Wl,-Map,link.map
and checking what section your foo variable is being put in. Then check
the handling of that section in your startup code.

If you need ieee695 files with debug info, you have probably already
discovered it is not possible to directly produce them from the linker. 
You will have to compile and link with -g using a different object file
format (m68k-coff with the default coff dbg format worked for me). Then
run objcopy WITH the --debugging option (this appears to be
equivalent to the "try and work flag" :-)).

Unfortunately the IEEE695 format is badly defined with different vendors
implementing different sub-sets AND adding different proprietary
extensions, so the resulting file may, or may not, load into your
particular debugger. I managed to get it mostly working with XRAY (2.3?),
but I had to modify the compiler build to put constants in their own
section (email me if you need to try this, I have a patch). I have also
managed to get it working somewhat better with SingleStep (though that
required elf object files and more extensive patching).

Good Luck
Mark



Mark S. Phillips        ESN 742 2461
msp@nortel.co.uk        Tel. +44 1279 402461

On Sun, 7 Sep 1997, Josef Wolf wrote:

> Hi there!
> 
> I have successfully built (and used) an m68k-coff cross-compiler hosted
> on a linux box. But there are still some problems with it. Maybe someone
> out there could help me with my problems?
> 
> First, the versions of the toolchain:
> -rw-r-----   1 jw      jw     4480026 Jul 15  1996 binutils-2.7.tar.gz
> -rw-r-----   1 jw      jw     7132291 Aug 14  1996 gcc-2.7.2.1.tar.gz
> -rw-r-----   1 jw      jw       19184 Jan  6  1996 crossgcc-gcc-2.7.2.patch
> -rw-r-----   1 jw      jw     1454028 Jan  6  1996 newlib-1.7.0.tar.gz
> 
> And (not installed yet...)
> -rw-r-----   1 jw      jw      128790 Jul 21  1996 gdb-4.16-bdm-patches.tgz
> -rw-r-----   1 jw      jw      464522 Apr 24  1996 gdb-4.16-testsuite.tar.gz
> -rw-r-----   1 jw      jw     5996836 Apr 24  1996 gdb-4.16.tar.gz
> 
> Now the Problems:
> 
> - Things like
> 
>   static char *foo=NULL;
>   void bar (void)
>   {
>     if (foo) do_something (foo);
>   }
> 
>   fail because foo won't get initialized properly to NULL. Seems to be a
>   problem with the startup-code. Currently it clears the BSS segment and
>   copies the initialzed data (DATA segment) from ROM into RAM. Do I need
>   to do more?
> 
> - With -g the compiler generates .file statements, which the linker strips
>   off. So I can't do source-level-debugging :-(). Output-format is -ieee.
> 
> - When using the standard-library (newlib) the linker always catches the
>   68020-version of the library. This leads to problems with my 68332 :-()
>   This problem appears when I use m68k-coff-ld directly as well as when
>   I use it through m68k-coff-gcc. The --verbose output seems to be OK, so
>   I assume the libraries are not properly built? Here's the output:
> 
> m68k-coff-gcc -Wl,--verbose -ansi -Wall -g3 --verbose -m68332 -msoft-float  -T ldscript.be -o be.iee crt0.o main.o -lc
> Reading specs from /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/specs
> gcc version 2.7.2.1
>  /usr/local/m68k-emb/m68k-coff/bin/ld -o be.iee -L/usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float -L/usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1 -L/usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float -L/usr/local/m68k-emb/m68k-
coff/lib -T ldscript.be --verbose crt0.o main.o -lc -lgcc -lg -lc -lgcc
> ld version 2.7 (with BFD 2.7)
>   Supported emulations:
>    m68kcoff
> attempt to open crt0.o succeeded
> crt0.o
> attempt to open main.o succeeded
> main.o
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libc.a failed
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/libc.a failed
> attempt to open /usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float/libc.a succeeded
> (/usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float/libc.a)ctype_.o
> [ ... many lines deleted ... ]
> (/usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float/libc.a)callocr.o
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libgcc.a succeeded
> (/usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libgcc.a)_mulsi3.o
> [ ... many lines deleted ... ]
> (/usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libgcc.a)_floatex.o
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libg.a failed
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/libg.a failed
> attempt to open /usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float/libg.a succeeded
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libc.a failed
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/libc.a failed
> attempt to open /usr/local/m68k-emb/m68k-coff/lib/m68000/msoft-float/libc.a succeeded
> attempt to open /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/m68000/msoft-float/libgcc.a succeeded
> 
> Many thanks in Advance!
>