This is the mail archive of the gcc@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: Question about codes in libgcc/crtstuff.c


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?

Lei


2016-11-04 11:06 GMT-04:00 Ian Lance Taylor <iant@google.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


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