sparc elf

Martin Guy
Mon Jun 12 16:59:00 GMT 2006

2006/6/12, Niklaus <>:
> 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

Or use "sparc-elf-gcc test.c", even better...


For unsubscribe information see

More information about the crossgcc mailing list