public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pedzsan at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54601] New: AIX uses atexit which causes unloading of shared modules to break Date: Sun, 16 Sep 2012 14:36:00 -0000 [thread overview] Message-ID: <bug-54601-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54601 Bug #: 54601 Summary: AIX uses atexit which causes unloading of shared modules to break Classification: Unclassified Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: pedzsan@gmail.com Created attachment 28200 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28200 git diff -c of base 4.5.2 tarball against new files and changes The bug was hit when using Apache httpd with a module called passenger. passenger uses some c++ code. httpd does an unload of all of the modules that it loads when it exits. The symptom is a core dump because by the time the atexit is run, the TOC entries as well as the code to execute which are registered as the DTORs have been unloaded. Using the x1.cpp attached, I determined that the atexit is used to register a DTOR for a static object with a non-trivial DTOR that is declared inside a function. The DTOR is registered only if the function is called. (x1.cpp does not demonstrate the problem. It was just used to educate me about when gcc used the atexit service.) I am also supplying a patch to the base 4.5.2 tarball that fixes the problem. I stole the cxa_atexit and cxa_finialize from GNU's glibc-2.16.0 implementation. I believe I have removed glibc's locking and successfully added back in the locking that gcc uses so that the file is built properly on the four different platforms: 32 bit, 32 bit threaded, 64 bit and 64 bit threaded. The changes to the configure and makefiles will need to be ported to the real files. I added references to the two new files introduced into the makefile and changed the configure script to assume cxa_atexit is present on AIX systems so that it will honor the --enable-__cxa_atexit configure option. The options I used for configure are: "--with-gmp=${PUBLIC_BASE}" \ "--with-mpfr=${PUBLIC_BASE}" \ "--with-mpc=${PUBLIC_BASE}" \ "--disable-nls" \ "--enable-threads=aix" \ "--with-libiconv-prefix=/usr" \ "--enable-__cxa_atexit" \ "--enable-languages=c,c++" If all goes well, I propose to have --enable-__cxa_atexit be the default for AIX. The final big change is to collect2. The changes are rather large. I tried to keep the proper style. There may be some debugging that can be removed. A new c stub is created in the first link pass so that __dso_handle can be declared to allow the first link to complete. I generalized a few things in the process. I hope all that is ok. I've used this new compiler for a month now but only on the original problem. All seems to be working.
next reply other threads:[~2012-09-16 14:36 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-16 14:36 pedzsan at gmail dot com [this message] 2012-09-16 14:39 ` [Bug c++/54601] " pedzsan at gmail dot com 2012-09-16 14:40 ` pedzsan at gmail dot com 2012-09-16 18:47 ` redi at gcc dot gnu.org 2012-09-17 14:18 ` pedzsan at gmail dot com 2012-10-01 16:31 ` paolo.carlini at oracle dot com 2012-10-03 17:53 ` dje at gcc dot gnu.org 2013-01-30 16:59 ` dje at gcc dot gnu.org 2013-01-30 21:58 ` dje at gcc dot gnu.org 2013-01-31 4:53 ` dje at gcc dot gnu.org 2013-01-31 5:50 ` pedzsan at gmail dot com 2013-01-31 6:11 ` dje at gcc dot gnu.org 2013-02-01 20:27 ` dje at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-54601-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).