On Fri, Nov 4, 2016 at 7:55 AM, lei wang <lei.wang.l...@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