This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: sparc elf
- From: "Martin Guy" <martinwguy at gmail dot com>
- To: Niklaus <niklaus at gmail dot com>
- Cc: "CrossGCC List" <crossgcc at sourceware dot org>, binutils at sourceware dot org, gcc at gcc dot gnu dot org
- Date: Mon, 12 Jun 2006 18:58:59 +0200
- Subject: Re: sparc elf
- References: <85e0e3140606120555t6745f858k855751169bc9a15@mail.gmail.com>
2006/6/12, Niklaus <niklaus@gmail.com>:
int main()
{
return 3;
}
i compiled it using sparc-elf-gcc -c test.c.
./sparc-elf-ld --entry=main test.o -o a.out
when i executed a.out on sparc machine it segfaulted and dumped core.
I guess 'cos you set entrypoint=main instead of __start or whatever it
is called.
You need to load in crtbegin.o (it may be called crt0.o), which
contains the correct entry point and calls main() and cleans up after
it, not just dive straight into main().
I wuold guess your segfault was caused by whatever non-existent code
your main() "returned" to :) You could just call _exit(3) instead
probably.
Or use "sparc-elf-gcc test.c", even better...
M