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

See the CrossGCC FAQ for lots more information.


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

RE: help for mips


Hello,

Sorry, I forgot to add some things (my fault).
I use this for my m68k-coff-gcc :
(-nostartfiles -nodefaultlib (-nostdlib) is important)

m68k-coff-gcc -v -m68040 -g -O2 -nostartfiles -fverbose-asm -fpack-struct
-Wall -Wl,-Tauc.ld -nodefaultlib -Wl,--cref -Wl,--print-map -save-temps -o
boot.ieee main.c

For your question regarding GDB:

[prompt ]$ gdb hello

can not work for your mips target. "gdb" is made to debug programs on your
solaris machine.
If you want to debug "vi" or "emacs" or any other program that is somewhere
on your machine, you use "gdb".

If you want to debug programs made for another target (m68k, mips, arm, ...)
you have to make a cross-debugger in the same way you made your
cross-compiler and the cross-debugger will also be placed in the same
directory as your mips-elf-gcc program, and it will be called
"mips-elf-gdb", not gdb.

Enjoy,
Jan


-----Original Message-----
From: Liu Yong [mailto:yliu@newavetech.com]
Sent: vrijdag 3 augustus 2001 12:11
To: Jan.Vermeulen@siemens.atea.be
Subject: Re: help for mips


Thanks reply so quickly.
 I 'v done what you advise me. That's the result.
 linker2.ld:
 OUTPUT_ARCH(mips)   /* Specify the output machine architecture */
 OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips","elf32-littlemips")
   /*  Output format. Should be srec (S-records).   */
                     /* Same as the --oformat command-line option.    */

 ENTRY(main);

 SECTIONS {
   . = 0x400;
   .text :
     {
     *(.text)
     }
   . = 0xA00000;
   .data :
     {
     *(.data)
     }
   .bss  :
     {
     *(.bss)
       end = ALIGN(0x8);
     }
 }

 command:
 csh/ mips-elf-gcc  -g -Wall -Wl,-Tlinker2.ld -o hello hello.c -v
 output:
 Reading specs from
 /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/specs
 gcc version 2.95.3 20010315 (release)


/home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/cpp0 -lang-c -v -
D__GNU

C__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEB -DR3000 -D_mips -D_MIPSEB -
D_R3000
  -D__mips__ -D__MIPSEB__ -D__R3000__ -D___mips__ -D_MIPSEB -D_R3000 -
D__mip
s
  -D__MIPSEB -D__R3000 -D___mips -g -Wall -D__LANGUAGE_C -D_LANGUAGE_C -
DLAN
G
 UAGE_C -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int hello.c
 /var/tmp/cc44inXQ.i
 GNU CPP version 2.95.3 20010315 (release) [AL 1.1, MM 40] BSD Mips
 #include "..." search starts here:
 #include <...> search starts here:
  /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/include


/home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/../../../../mips-
elf/sy
s-include


/home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/../../../../mips-
elf/in
clude
 End of search list.
 The following default directories have been omitted from the search path:

/home/yliu/local/mipself/lib/gcc-lib/mips-
elf/2.95.3/../../../../include/g++
-3
 End of omitted list.
  /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/cc1
 /var/tmp/cc44inXQ.i -quiet -dumpbase hello.c -g -Wall -version -o
 /var/tmp/cc4It2zA.s
 GNU C version 2.95.3 20010315 (release) (mips-elf) compiled by GNU C
version
 2.95.3 20010315 (release).
 hello.c:2: warning: return-type defaults to `int'
  /home/yliu/local/mipself/mips-elf/bin/as -g -v -o /var/tmp/ccgJSScm.o
 /var/tmp/cc4It2zA.s
 GNU assembler version 2.11.2 (mips-elf) using BFD version 2.11.2
  /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/collect2 -o hello
 /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/crtbegin.o

crt0.o -L/home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3 -
L/home/yliu/l
 ocal/mipself/mips-elf/lib  /var/tmp/ccgJSScm.o -lgcc -lgcc
 /home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/crtend.o -
Tlinker2.ld
 /home/yliu/local/mipself/mips-elf/bin/ld: cannot open crt0.o: No such 
file
 or directory
 collect2: ld returned 1 exit status

 Why does ld need the crt0.o?
 Try again:
 csh/ mips-elf-ld -Tlinker2.ld -o hello -L/home/yliu/local/mipself
/lib/gcc-lib/mips-elf/2.95.3 -L/home/yliu/local/mipself/mips-elf/lib
 hello.o -lgcc -lc -v

It seems succeed.

Using GDB , still tell me :
don't know how to run hello.
So , What 's wrong ?


> > PS: GDB is the native debugger for your linux/windows machine. It can
only
> > understand your host target (maybe i586-linux-elf if you are running 
on
> > linux)
    What 's your mean? You mean I cann't debug mips-elf under sun-
solaris2.6
 by GDB ?
   If it 's true , how can I debug my program under sun-solaris2.6 ? Or 
how
can I run the program ?
   Then   what 's the mean of cross-debugger?
   Maybe I forget tell you I have installed cross-gdb target for mips-
elf .
   PS: Which is better between Insight and DDD ?  Now I am using DDD.

 DANK SE , :-)

 Best Regards.
 Yong Liu


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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