Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2018 19:55:56 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341439 - head/libexec/rtld-elf
Message-ID:  <201812031955.wB3JtuEr077687@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812031955.wB3JtuEr077687>