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: powerpc-*-elf versus powerpc-*-eabi


Dave Murphy wrote:
Is there any significant difference between the powerpc-*-elf &
powerpc-*-eabi targets?

powerpc-eabi gets used a lot more than powerpc-elf I believe, and thus is probably a better choice. powerpc-elf might be useful if you need compatibility with some other system, such as other processor elf targets, or linux. There are various eabi targets for special cases, e.g. eabispe, eabialtivec, eabisim, etc. These alternatives don't exist in the powerpc-elf case.


That message also mentions the use of a __main function which is also
confusing me a little. Currently I'm using a crt0 which has calls to _init &
_fini around the call to main as I've seen in the crt0 source provided with
newlib. What exactly is the accepted way to perform global constructor
initialisation? Under what circumstances should a call to __main be inserted
in the main function? Is there something wrong with my build if this call is
not being inserted?

Different systems have different ways of running static constructors and destructors. In old systems, that don't have .init/.fini, gcc would automatically insert a call to __main in the main routine. Eabi works this way even though we have elf, but the __main function is called __eabi.


The generally accepted way for ELF targets is to use .init/.fini sections. If you don't have a loader that support init/fini, then you call them from crt0.o. This is what newlib crt0s usually do.

If a call to __main is needed, the compiler will automatically insert it. On these systems, the crt0 does not call the init/fini sections.

If the __main call is missing, then no, there is nothing wrong. It just means that your system doesn't use __main. Most likely, it uses init/fini sections instead.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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