This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/9249] bootstrap fails with --enable-__cxa-atexit on Solaris
- From: "cludwig at cdc dot informatik dot tu-darmstadt dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2003 10:05:49 -0000
- Subject: [Bug bootstrap/9249] bootstrap fails with --enable-__cxa-atexit on Solaris
- References: <20030109082607.9249.cludwig@cdc.informatik.tu-darmstadt.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From cludwig at cdc dot informatik dot tu-darmstadt dot de 2003-12-11 10:05 -------
Subject: Re: bootstrap fails with --enable-__cxa-atexit on Solaris
On Thu, Dec 11, 2003 at 09:12:03AM -0000, dhazeghi at yahoo dot com wrote:
>
> How's this look (I lifted most of it directly from configure.in)?
>
> +++ doc/install.texi Thu Dec 11 01:08:53 2003
> @@ -938,6 +938,14 @@
> AltiVec code when appropriate. This option is only available for
> PowerPC systems.
>
> +@item --enable-__cxa_atexit
> +Define if you want to use __cxa_atexit, rather than atexit, to
> +register C++ destructors for local statics and global objects.
> +This is essential for fully standards-compliant handling of
> +destructors, but requires __cxa_atexit in libc. This option is currently
> +only available on sytems with GNU libc. When enabled, this will cause
> +@option{-fuse-cxa-exit} to be passed by default.
> +
> @item --enable-target-optspace
> Specify that target
> libraries should be optimized for code space instead of code speed.
It seems to state everything a user needs to know prior to calling
configure. Thank you.
> Regarding a configure check for this, I haven't got any good ideas. I gues we could blacklist
> systems whose triplet didn't end in GNU, but that seems unclean. Ideas?
I am not familiar with the restrictions that are imposed on the tests
in gcc's configure script. But IIUC libc has to be installed before
you build gcc anyway. Then why not try to link a program that
explicitly references __cxa_atexit. If the linker or the program
fails, then libc does not provide __cxx_atexit. I have something in
mind along the line of:
#### begin of cxa_atexit_test.c ####
void __cxa_atexit();
int main() {
typedef void (*ExitFunctionPtr)();
ExitFunctionPtr cxa_atexit_ptr = __cxa_atexit;
return cxa_atexit_ptr ? return 0 : return 1;
}
#### end of cxa_atexit_test.c ####
(The program runs on linux / gcc 3.3.2 but fails to link on Solaris 8
/ gcc 2.95, as expected. I didn't perform more thorough tests.)
If the gcc build process only assumes a K&R C-compiler then the
program probably needs to be adapted. I am much more used to C++
whence I'd need to look up the K&R syntax.
Regards
Christoph
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9249