https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78483
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- FWIW Glibc defines this with _DEFAULT_SOURCE and _GNU_SOURCE: #ifdef __USE_MISC /* Register a function to be called with the status given to `exit' and the given argument. */ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __THROW __nonnull ((1)); #endif I don't know the origin of this function, it doesn't seem to be in BSD or SVR4.