Provide naive but self-contained implementations of memset(3) and

bzero(3) for rtld.

This again reduces rtld dependency on libc, and in future, avoid ifunc
relocations when the functions are converted to ifuncs in libc.

Reported by:	mjg
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18400
This commit is contained in:
Konstantin Belousov 2018-12-03 19:55:55 +00:00
parent 7aaf685ba7
commit 5962a71ecf

View File

@ -5618,3 +5618,25 @@ rtld_strerror(int errnum)
return ("Unknown error");
return (sys_errlist[errnum]);
}
/*
* No ifunc relocations.
*/
void *
memset(void *dest, int c, size_t len)
{
size_t i;
for (i = 0; i < len; i++)
((char *)dest)[i] = c;
return (dest);
}
void
bzero(void *dest, size_t len)
{
size_t i;
for (i = 0; i < len; i++)
((char *)dest)[i] = 0;
}