svn commit: r341439 - head/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Mon Dec 3 19:55:57 UTC 2018


Author: kib
Date: Mon Dec  3 19:55:55 2018
New Revision: 341439
URL: https://svnweb.freebsd.org/changeset/base/341439

Log:
  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

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Mon Dec  3 19:35:21 2018	(r341438)
+++ head/libexec/rtld-elf/rtld.c	Mon Dec  3 19:55:55 2018	(r341439)
@@ -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;
+}


More information about the svn-src-head mailing list