Where should _fini and _init be defined?

Joel Sherrill joel.sherrill at oarcorp.com
Thu Nov 27 17:42:39 UTC 2014


On 11/27/2014 10:56 AM, Hesham Moustafa wrote:
> Hi all,
>
> I had a compilation error when compiling RTEMS for Epiphany which is
> undefined reference to _init, and _fini. I got over it by defining
> dummy related functions at cpu.c, and hello world is working with it.
> I know this is not the right way, so I'd like to ask here what's the
> correct solution? Something relates to GCC port and included file or
> what?
>
I see them in ./lib/gcc/epiphany-elf/5.0.0/crti.o as
"init" and "fini".

Look at your build log and see where they came from. If GCC
is automatically prepending _ to the name from C, then the
name in the crti.o needs to be different. This is IMO a bug
in GCC. They have names accessible from C on all other
architectures.

File a GCC PR and let the Ephiphany guys know. If they
are in Bugzilla, cc them. Add me as well.

But for now, do what you have to to keep moving and
ignore C++.

> Thanks,
> Hesham
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel




More information about the devel mailing list