[PATCH] New configuration option for lite exit

Jeff Johnston jjohnstn@redhat.com
Tue Jul 2 21:35:00 GMT 2013

Revised patch checked in.  I have added a ChangeLog for you.


-- Jeff J.

----- Original Message -----
From: "Joey Ye" <joey.ye@arm.com>
To: "Jeff Johnston" <jjohnstn@redhat.com>
Cc: newlib@sourceware.org, "Joey Ye" <Joey.Ye@arm.com>
Sent: Friday, June 28, 2013 4:33:48 AM
Subject: RE: [PATCH] New configuration option for lite exit

> From: Jeff Johnston <jjohnstn@redhat.com>
> Date: Fri, Jun 14, 2013 at 4:55 AM
> Subject: Re: [PATCH] New configuration option for lite exit
> To: newlib@sourceware.org
> Please add such documentation to your patch.  I might suggest both adding
> to the new README section you have started regarding newlib configuration
> options and to at least one of the source files and you can reference that
> from the others (e.g. put it in atexit and have the other files that are
> tell the developer to look in atexit.c for more details)..
Updated with following changes
- Add description of new option in README
- Add detail description in __atexit.c, and add comments in other .c to look
in it
- Remove dependence between __cxa_finalize and __register_exitproc, replace
with dependence of __call_exitprocs
- Remove changes in __call_atexit.c as it can be covered by

> >> AFAICT, if a call is made to __cxa_atexit, nothing will occur unless
> >> a call is also made to __cxa_finalize or atexit() or on_exit().  The
> >> exit list won't be run on exit if just on_exit() is called because
> >> __call_exitprocs() won't be brought in.
> >
> > This doesn't appear to be true, as __call_exitprocs is always called in
> >
> Maybe I'm missing something.  Following the logic, __call_exitprocs is a
> reference in exit.  If the user calls on_exit without an
> atexit() call then nothing solidifies the __call_exitprocs linkage.
> If I am correct, please fix and update documentation.
on_exit refers __register_exitproc as non-weak, and now the latter brings in
__call_exitprocs. So it is fixed in this version.

OK to trunk?


    Lite exit support.
    * README (enable-lite-exit): Doc for new option.
    * acconfig.h (_LITE_EXIT): New macro.
    * configure.in (enable-lite-exit): New option.
    (_LITE_EXIT): Define new macro.
    * configure: Regenerated.
    * newlib.hin (_LITE_EXIT): New macro.
    * libc/stdlib/__atexit.c (__atexit_dummy): Explicit reference to
    * libc/stdlib/cxa_atexit.c (__register_exitproc): Weak reference.
    * libc/stdlib/exit.c (exit): Remove TWS and weak reference to

    * arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini
    when lite exit is enabled.

More information about the Newlib mailing list