This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Fortification of STL
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, libstdc++ at gcc dot gnu dot org, Ulrich Drepper <drepper at redhat dot com>
- Date: Mon, 03 Sep 2007 16:17:25 +0200
- Subject: Re: Fortification of STL
- References: <20070903133435.GT2063@devserv.devel.redhat.com>
Hi Jakub,
The following patch of course is not meant to be directly used,
this should only be enabled if
1) _FORTIFY_SOURCE is defined
2) __OPTIMIZE__ > 0
3) we know the C library provides the checking functions (__memcpy_chk,
__memmove_chk, __memset_chk in this case)
and having conditionals everywhere is jus too ugly to live with.
Guess some __gnu_* namespace could have an __attribute__((always_inline))
memcpy, memmove and memset routine that would either return
__builtin_* or __builtin___*_chk depending on preprocessor macros...
Maybe it would be just matter of adding a few forwarding macros to
bits/c++config, similarly to what we have in ext/atomicity.h. Likewise,
we should probably add a bit of configury to enable the *_chk versions
in the exported library facilities.
Paolo.