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]
Other format: [Raw text]

compile hello.c using mipsel-elf


Abhijit Deshpande writes:
 > Hi,
 > 
 > I have successfully built a cross compiler for mipsel-elf target.. I have 
 > used binutils-2.13.1, gcc-3.2.2 and newlib-1.11.0..
 > 
 > I am working on redhat 7.2, linux kernel - 2.4.7-10..
 > 
 > But when I try to compile simple 'C' program, it fails while linking..
 > 
 > Are there any particular options missing in the following command line:
 > 
 > ./mipsel-elf-install/bin/mipsel-elf-gcc -T./mipsel-elf-install/mipsel-elf/lib/idt.ld ../hello.c, 
 > 
 > where hello.c is:
 > 
 > int main() {
 > return 0;
 > }
 > 
 > The error is:
 > 
 > ..../libgloss/mips/crt0.S:75: multiple definition of `_start'
 > ..../libgloss/mips/crt0.S:75: first defined here
 > 
 > ..../libgloss/mips/crt0.S:259: multiple definition of `_exit'
 > ..../libgloss/mips/crt0.S:259: first defined here
 > can anyone guide me??
 > 
 > Also, I would like to know why 
 > "-T./mipsel-elf-install/mipsel-elf/lib/idt.ld" option is needed??

As always, the output of running gcc with -v added is useful.

./mipsel-elf-install/bin/mipsel-elf-gcc -T./mipsel-elf-install/mipsel-elf/lib/idt.ld ../hello.c -v
[insert output here]

Also, including the contents of the linker script will also assist us
in debugging this.

Guessing, maybe both gcc and the linker script are adding crt0.o to the link.

It's the same kind of error you'd get if you did the following in linux:

gcc -c hello.c
gcc -o hello.x hello.o hello.o
-->
hello.o: In function `main':
hello.o(.text+0x0): multiple definition of `main'
hello.o(.text+0x0): first defined here

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


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