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:06:30 -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>
On Fri, Nov 4, 2016 at 7:55 AM, lei wang <lei.wang.left@gmail.com> wrote:
>
> In fact, I just want to find a practical way to make the crt work.
> Currently, I did the following configure in my port:
>
> include "elfos.h" in tm.h
> define HAS_INIT_SECTION
> undefine OBJECT_FORMAT_ELF
> define INVOKE__main
> use default INIT_SECTION_OP
>
> My port is working on a bare metal machine with newlib support. Seems
> I fall into an spurious configure for compiling crtstuff.c. Could you
> give me some guide to lead me back to common configuration of this?
If you are using ELF, arrange for your startup code to execute the
functions in the .init_array section. If necessary, modify your
linker script to define symbols around .init_array that your startup
code can use to find the section. Pass --enable-initfini-array when
you run configure. Don't define INVOKE__main. Don't worry about
HAS_INIT_SECTION or OBJECT_FORMAT_ELF or INIT_SECTION_OP.
Ian