On Thu, Sep 15, 2011 at 12:13:07PM +0200, [email protected] wrote: > Hello, > > A warning for people who can be hit by the same or similar issue: > > gcc 4.1.2 with -march=i486 here with -Os and even with -O2 or -O > is "optimizing away" the check > > if (_stdio_term) > > in libc/stdlib/_atexit.c > > which results in a "call 0" and a segfault at exit > if you do not happen to link in stdio. > > Presumably gcc believes _stdio_term to be a non-zero constant. > > Setting -O0 produces a sane exit.os and a usable library.
I don't know if uClibc will accept this fix, but the way I approached issues like this in musl was to never use weak references, but instead always use a weak alias to an internal-linkage dummy function. This wastes a few bytes on the dummy function, but it has the benefit of removing the conditional around the call. You just always make the call, and if the "real" definition (strong symbol from another translation unit) is not available, the function immediately returns. Rich _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
