Using __chk_fail from libstdc++

Roland McGrath roland@hack.frob.com
Fri Jun 1 19:50:00 GMT 2012


> It can be
> namespace __gnu_cxx
> {
>   extern "C" void __chk_fail () __attribute__((noreturn));
> };
> ...
>   __gnu_cxx::__chk_fail ();
> on the libstdc++ side IMHO (or some other appropriate namespace).

That means libstdc++ would have to provide a wrapper that's just a
tail-call to libc's __chk_fail, right?  That seems fine to me, but
Florian said he prefers to avoid a wrapper.

All in all, this does seem like the best idea to me.  Having libstdc++
headers refer to libstdc++ internal symbols rather than libc internal
symbols just seems like the wise thing.  We certainly don't care about
microoptimizing crashing cases, so the extra bounce through a tail call
is not something to fret about.


Thanks,
Roland



More information about the Libc-alpha mailing list