Darwin has had __cxa_atexit since 10.4, but it wasn't being used by
default because we didn't have __dso_handle being defined by the
linker. Unfortunately it also turned out to be a little buggy. This
patch makes it enabled and useful by default, and supplies it even on
pre-10.4 systems which don't have it. On those earlier systems it
isn't as good as a real system __cxa_atexit but still better than the
previous behaviour I hope.
It passes a bootstrap and testrun, but I wouldn't be surprised if
there turns out to be a bug or two in it, so look for follow-up
patches.
This requires cctools-590.36, which I've just uploaded to
gcc.gnu.org.