----- Manuel López-Ibáñez <lopezibanez@xxxxxxxxx> schrieb: > 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. Yes, this is the easy part. However, the expand_builtin_memset_args() in builtins.c doesn't look so easy to me. I really have no idea how to tell GCC that it should stop to optimize this particular memset() variant away. This is why I asked for the memset_s(). > > 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 Thanks for all the useful links. A best-effort approach is probably all what we can get at the moment. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber at embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.