This is the mail archive of the
mailing list for the GCC project.
Re: at exit alternative for AIX
- From: Perry Smith <pedzsan at gmail dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, gcc at gcc dot gnu dot org
- Date: Sun, 16 Sep 2012 10:06:19 -0500
- Subject: Re: at exit alternative for AIX
- References: <EA5983AC-20FC-4ACA-87AE-823D13B4AC4D@gmail.com> <CAKOQZ8z=npS-DTgy6JnNKVym97s37t7FubiR=Mkczs0NPJEqcA@mail.gmail.com> <ABC48239-12FF-4621-8281-C643DCFE4AD7@gmail.com> <CAGWvny=BMfMu6X3MvaJif-o0_oSnhoL_SkAsPZPbkVvk7sfirstname.lastname@example.org> <B4B5BC63-99A9-4FB1-8DEA-B25BD5E72380@gmail.com> <B4759BE4-C7AC-40AA-BEBD-AF9633EB865D@gmail.com> <CAKOQZ8z1x_CxHKgURU-2amAJt_dJSKnkJZLFJY+q-SCiJjz1QQ@mail.gmail.com> <817F6198-762E-477F-A571-56A2ED2C1B31@gmail.com> <CAGWvnymfghkL1MtV1NN13EjMtukLFvd74-Qygidy_wBbjeeJ4A@mail.gmail.com>
On Aug 8, 2012, at 3:32 PM, David Edelsohn wrote:
> On Tue, Aug 7, 2012 at 1:42 PM, Perry Smith <email@example.com> wrote:
>> Thanks. You just provide what I wanted / needed which is a sanity check.
>> I'll open a bug report and that might get me some help.
>> I think I've concocted a plan to get __cxa_atexit to work. I am going to try that
>> first. That may have utility in other ways.
> You also might want to look at PR 33704, as well as PRs 17053, 13391
> and 2413. It would be good to figure out a way to utilize the patch in
> PR 33704.
> The problem is AIX semantics is different than SVR4 semantics and GCC
> should not assume that it is being used to link code expecting
> GNU/Linux semantics. AIX invokes initializers in the order the
> libraries are encountered while SVR4 wisely specifies initializers run
> in the proper dependency order. IBM's C++ compiler works around this,
> but it's name mangling, exception handling and initializers do not
> follow G++ and the Itanium ABI conventions, so GCC cannot directly use
> the same mechanisms.
> One can merge the patch from PR 33704, but that raises the question of
> when it should be used and what should be the default.
> Use the option to build libstdc++? Okay.
> Always use the option when linking with G++? Maybe.
> Always use the option when linking with GCC? Probably not.
> GCC is straddling the GNU/Linux and AIX environments. Should GCC
> provide GNU/Linux behavior, IBM VAC++, or IBM XLC behavior? When?
> Which default?
> A related situation that applied the GNU/Linux default of enabling
> long double support to AIX caused numerous problems because of missing
> library dependencies. G++/libstdc++ had to revert from GNU/Linux
> default behavior to AIX default behavior because pushing against AIX
> caused too many problems that could not be solved without
> re-implementing more and more of the AIX runtime.
> Users of GCC on AIX expect different, conflicting defaults and expect
> GCC the do the right thing based on context, which is impossible in
> this situation.
> Providing _cxa_atexit() using the existing finalizer function is the
> right direction, but it still may run into problems due to the
> lingering finalizer ordering bug. I am not trying to discourage you
> -- on the contrary I want to encourage you -- but I also want to
> introduce some context.
I finally created my bug report and supplied the changes that I'm using:
I added __cxa_atexit to libstdc++ which I believe will be a good feature for
the few platforms like AIX that do not already have it.
There is a subtle "who cares" type of bug in the configure script. When it
tries to detect if __cxa_atexit is present, it does not link with libstdc++. It
seems like __cxa_atexit is only used for c++ and so my thoughts are that
the detection should use c++ instead of just c.
I reviewed the other defects and thought about some of the issues. I think
my current issue is somewhat orthogonal to the others. i.e. it can be
implemented without breaking any existing compatibility.
As far as David's general question(s), I don't claim to 100% understand all the
issues but here are my thoughts:
When I wrote my SATA drivers for AIX back in 2006 in C++ (using G++), I picked a
compiler and stuck with it. I still use the same compiler for that project to this day.
I think anyone / everyone will do the same.
>From David's description, it sounds like AIX does not really have a design and did
not really address the issues that crop up if (for example) PR 33704 is implemented.
The end user just wants something that will work even if the path is long and
hard. An easy short path is just a benefit. The long path may include finding
open source code for libraries shipped with AIX but I did that anyway so I could
debug any problems that came up. I know that everything has a bug or two. I'd
rather have a hope of finding an understanding the bug than not. So I used open
source or rolled my own for all of the driver code.
I lean towards implementing it and make it the default with options to
go back to how things were before. It also sounds like if a user switched from
VAC to XLC, things would be subtly different. If that is the case, then I would be
even more inclined to implement it.
Thank you to all who helped. Thank you for gcc...