[PATCH] Replace __bzero with memset

Joseph Myers joseph@codesourcery.com
Mon Jun 12 15:18:00 GMT 2017


On Mon, 12 Jun 2017, Zack Weinberg wrote:

> > +/* Set memory like memset, but different argument order and no return
> > +   value required.  Also only integer caller-saves may be used.  */
> >  void
> >  __aeabi_memclr (void *dest, size_t n)
> >  {
> > -  __bzero (dest, n);
> > +  memset (dest, 0, n);
> >  }
> 
> It's a pre-existing condition, so it shouldn't hold up your patch, but
> this comment concerns me; there is no guarantee that memset will avoid
> using FP or vector registers.  The existing arm/memset.S *doesn't*,
> but it doesn't look like it's all that fine-tuned (compare
> arm/armv7/multiarch/memcpy_impl.S).

__aeabi_memcpy* are (in the multiarch case) aliased to __memcpy_arm to 
avoid such issues.  (There is still an issue for the dynamic linker, see 
bug 15792.  Even with the dynamic linker built to use only core registers 
there might be issues with e.g. interposed malloc called from the dynamic 
linker, unless all relevant registers are saved and restored.)

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list