On 12/02/16 06:21, Sebastian Huber wrote:
If I were to tackle this problem, I would try first to implement a
__builtin_explicit_bzero() directly in GCC such that GCC will know exactly how
to handle it. This would be faster, safer and more portable than any trick you
may get working now (since LTO keeps improving), and it will provide the basis
for a gnu libc implementation.
Ok, since I am not a compiler expert, I need an example for this. My first try was to search for the memset_s() builtin. However, this doesn't seem to exist. Is memset_s() supported at all by GCC currently?
See https://gcc.gnu.org/git/?p=gcc.git;a=blob_plain;f=gcc/builtins.def;hb=HEAD
memset_s is not there, so I guess it is not provided as a builtin, but
implemented by the C library. Probably it is not LTO-safe either.
But there is:
DEF_EXT_LIB_BUILTIN (BUILT_IN_BZERO, "bzero", BT_FN_VOID_PTR_SIZE,
ATTR_NOTHROW_LEAF_LIST)
No need to be a compiler expert to hack on GCC. And I'm sure you are more
qualified than I am.
In any case, these questions are more appropriate for gcc@ and gcc-patches@.
Few devs read gcc-help@
Of course, there is the question of whether explicit_bzero() or similar
functions are a solution at all to any problem
(https://sourceware.org/ml/libc-alpha/2016-01/msg00208.html)
Would a builtin not fix this issue? I am not sure if I understood this post at all.
Sorry, wrong link. Correct one:
https://gcc.gnu.org/ml/gcc-help/2014-10/msg00061.html
Cheers,
Manuel.