This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC not calling __main()?



On Sep 12, 2007, at 3:39 PM, Rask Ingemann Lambertsen wrote:


On Wed, Sep 12, 2007 at 02:43:32PM -0700, Rick Mann wrote:
Hmm. It seems that I shouldn't need to modify GCC just to get this
support in there. Perhaps the default approach used by arm-elf is
sufficient, and I'm just side-stepping it by having my own start.S
file? I find it hard to believe that modifying GCC would be necessary
just to get C++ to behave for arm-elf...

I think you _are_ side-stepping it with your start.S as well as probably
not using the correct linker command.

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?).


In fact, _init seems to be the very first code in the file now, and it looks like a subroutine call (that is, it appears to return; now I know why the bootloader complained that "the kernel returned"). I do get a symbol _mainCRTStartup, but it is never called (nor is it not at the start of the file, nor does it call _init).

--
Rick



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