This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Replace __bzero with memset
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 12 Jun 2017 15:18:21 +0000
- Subject: Re: [PATCH] Replace __bzero with memset
- Authentication-results: sourceware.org; auth=none
- References: <AM5PR0802MB2610A62A60E00B406466E76983CD0@AM5PR0802MB2610.eurprd08.prod.outlook.com> <CAKCAbMjfOrJN0sauR0eyuq3amt3nRz3HbstX7G=uBpfkyj0gmA@mail.gmail.com>
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