This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about codes in libgcc/crtstuff.c
- From: Ian Lance Taylor <iant at google dot com>
- To: lei wang <lei dot wang dot left at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 4 Nov 2016 08:24:44 -0700
- Subject: Re: Question about codes in libgcc/crtstuff.c
- Authentication-results: sourceware.org; auth=none
- References: <04728ABB-D10C-4644-A7D0-FB308B45BEE6@gmail.com> <CAKOQZ8weGkLC6tNJ_-0c36W5S=RKpnaT6wiVq+vEUenKgt7qKA@mail.gmail.com> <CANZXyhR_SCZhAqRv6zXMFS_63g6BHM3YHsLMnj-gTgJXQbRLYA@mail.gmail.com> <CANZXyhSWfA=7m9M7dnTpTP6kZyVa07K6n_+HsL-tpW=oQmCK7w@mail.gmail.com> <CAKOQZ8z2fTxmUmFwwUiZfzvz0o=Pz9J0gi6zQMWq9TOQeEEpCw@mail.gmail.com> <CANZXyhRyJHNaLv6+g4p+P7qov7SKDTJVtgKZT+P4c8+WJbzT5Q@mail.gmail.com>
On Fri, Nov 4, 2016 at 8:12 AM, lei wang <lei.wang.left@gmail.com> wrote:
>
> Thanks. One more question, my current entry point of the program is
> main, after which there is a call to __main to do the constructor
> stuffs and register destructors. Without INVOKE__main, which point
> should I define as the entry?
You should write some startup code that runs all the constructors in
.init_array, does any other required initialization, and then jumps to
main. The program's entry point should be that startup code. You can
name it anything you like; typical favorites are _init and _start.
You may want to look at libgloss, which is parallel to newlib, for
various examples.
Ian