This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Add __memcpy_chk/__memcpy_chk/__memset_chk for i586
- From: "H.J. Lu" <hjl at lucon dot org>
- To: GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Fri, 14 Sep 2007 17:26:34 -0700
- Subject: PATCH: Add __memcpy_chk/__memcpy_chk/__memset_chk for i586
i586 version of glibc doesn't provide __memcpy_chk, __memcpy_chk
nor __memset_chk. This patch adds them.
H.J.
----
2007-09-14 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/i386/i586/memcpy.S (__memcpy_chk): New.
* sysdeps/i386/i586/mempcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i586/memset.S (__memset_chk): Likewise.
--- sysdeps/i386/i586/memcpy.S.chk 2005-05-04 10:52:10.000000000 -0700
+++ sysdeps/i386/i586/memcpy.S 2007-09-14 16:59:30.000000000 -0700
@@ -35,6 +35,13 @@
#define LEN SRC+PTR_SIZE
.text
+#if defined PIC && !defined NOT_IN_libc
+ENTRY (__memcpy_chk)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memcpy_chk)
+#endif
ENTRY (BP_SYM (memcpy))
ENTER
--- sysdeps/i386/i586/mempcpy.S.chk 2004-05-27 23:39:37.000000000 -0700
+++ sysdeps/i386/i586/mempcpy.S 2007-09-14 17:06:38.000000000 -0700
@@ -1,4 +1,5 @@
#define memcpy __mempcpy
+#define __memcpy_chk __mempcpy_chk
#include <sysdeps/i386/i586/memcpy.S>
libc_hidden_def (BP_SYM (__mempcpy))
--- sysdeps/i386/i586/memset.S.chk 2005-05-03 23:21:50.000000000 -0700
+++ sysdeps/i386/i586/memset.S 2007-09-14 17:01:53.000000000 -0700
@@ -38,6 +38,13 @@
#endif
.text
+#if defined PIC && !defined NOT_IN_libc && !BZERO_P
+ENTRY (__memset_chk)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memset_chk)
+#endif
ENTRY (BP_SYM (memset))
ENTER