GCC not calling __main()?
Rask Ingemann Lambertsen
rask@sygehus.dk
Fri Sep 14 15:18:00 GMT 2007
On Wed, Sep 12, 2007 at 04:27:19PM -0700, Rick Mann wrote:
>
> So, I currently build with -nostartfiles. I tried removing that, and
> I got a complaint about _start being defined twice (as I expected).
> So, I removed my own start.o, and it links fine. When I look at the
> resulting output, I see a bunch of code that looks like the right
> _init() stuff. However, I can no longer find _start (perhaps it's
> aliased somehow and objdump is using the alias?).
You'll just have to add code to your start.S to call atexit(_fini) and
call _init(). See the existing crt0.S. Also check with -v that you're
linking in the right order. You should have start.o crti.o crtbegin.o
<everything else here> crtend.o crtn.o.
--
Rask Ingemann Lambertsen
More information about the Gcc-help
mailing list