This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: add .cc files to libgcc.a
On Oct 29, 2012, at 9:08 AM, David Edelsohn wrote:
>
> Some of the support you are adding is equivalent to code in
> libgcc/crtstuff.c. My question was if it is possible to re-use some
> of that code for the new AIX support.
>
> Is the code really C++? Both cxa_atexit.cc and cxa_finalize.cc are
> providing C interfaces.
The only thing I see in crtstuff.c is a call to __cxa_finalize which is inside ELF specific code.
There is no __cxa_atexit and no __cxa_finalize code in the GCC source.
There are also things like this:
> #ifdef CRTSTUFFS_O
> void *__dso_handle = &__dso_handle;
> #else
> void *__dso_handle = 0;
> #endif
which locks in one or the other at compile time for crtstuff.c but that decision needs to be made at link time because a "main" program needs to set it to 0 while a loadable shared module needs to set it to &__dso_handle (like I did in collect2).
So, there isn't much there. What is there is working for some platform that I don't know anything about. I chose to not touch it.
I'm sure they could be rewritten in C. GNUs libc choose to do them in C++ probably because C++ just gives a nicer way to do things.
The real c++ part of the new code is mostly around the locking.
Perry