about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/i486/bits/string.h29
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile19
3 files changed, 38 insertions, 11 deletions
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 60148b7da5..2cbac1029c 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -742,10 +742,11 @@ __strcat_c (char *__dest, __const char __src[], size_t __srclen)
   register unsigned long int __d0;
   register char *__tmp;
   __asm__ __volatile__
-    ("repne; cmpsb"
-     : "=S" (__tmp), "=&c" (__d0)
+    ("repne; scasb"
+     : "=D" (__tmp), "=&c" (__d0)
      : "0" (__dest), "1" (0xffffffff), "a" (0)
      : "cc");
+  --__tmp;
 #else
   register char *__tmp = __dest - 1;
   __asm__ __volatile__
@@ -798,8 +799,27 @@ __strcat_g (char *__dest, __const char *__src)
 __STRING_INLINE char *
 __strncat_g (char *__dest, __const char __src[], size_t __n)
 {
-  register char *__tmp = __dest - 1;
+  register char *__tmp = __dest;
   register char __dummy;
+#ifdef __i686__
+  __asm__ __volatile__
+    ("repne; scasb\n"
+     "decl %1\n\t"
+     "1:\n\t"
+     "decl	%3\n\t"
+     "js	2f\n\t"
+     "movb	(%2),%b0\n\t"
+     "movsb\n\t"
+     "testb	%b0,%b0\n\t"
+     "jne	1b\n\t"
+     "decl	%1\n"
+     "2:\n\t"
+     "movb	$0,(%1)"
+     : "=&a" (__dummy), "=&D" (__tmp), "=&S" (__src), "=&r" (__n)
+     : "0" (0), "1" (__tmp), "2" (__src), "3" (__n)
+     : "memory", "cc");
+#else
+  --__tmp;
   __asm__ __volatile__
     ("1:\n\t"
      "cmpb	$0,1(%1)\n\t"
@@ -816,10 +836,11 @@ __strncat_g (char *__dest, __const char __src[], size_t __n)
      "jne	2b\n\t"
      "decl	%1\n"
      "3:\n\t"
-     "movb	$0,(%1)\n\t"
+     "movb	$0,(%1)"
      : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n)
      : "1" (__tmp), "2" (__src), "3" (__n)
      : "memory", "cc");
+#endif
   return __dest;
 }
 
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 709f9abae5..181ac53d5e 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -5,6 +5,7 @@ init-first.h
 kernel_sigaction.h
 kernel_stat.h
 kernel_termios.h
+lddlibc4.c
 llseek.c
 s_pread64.c
 s_pwrite64.c
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 7a73ded547..2bc194384a 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -23,13 +23,18 @@ install-others += $(inst_includedir)/bits/syscall.h
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
 	rm -f $(@:.h=.d)
-	echo > $(@:.d=.h).new \
-	     '/* Generated at libc build time from kernel syscall list.  */'
-	SUNPRO_DEPENDENCIES='$(@:.h=.d) $(patsubst $(objpfx)%,$$(objpfx)%,\
-						   $(@:.d=.h) $(@:.h=.d))' \
-	$(CC) -E -x c $< -D_LIBC -dM | \
-	sed -n >> $(@:.d=.h).new \
-	      's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'
+	{ \
+	 echo '/* Generated at libc build time from kernel syscall list.  */';\
+	 echo ''; \
+	 echo '#ifndef _SYSCALL_H'; \
+	 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
+	 echo '#endif'; \
+	 echo ''; \
+	 SUNPRO_DEPENDENCIES='$(@:.h=.d) $(patsubst $(objpfx)%,$$(objpfx)%,\
+						    $(@:.d=.h) $(@:.h=.d))' \
+	 $(CC) -E -x c $< -D_LIBC -dM | \
+	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'; \
+	} > $(@:.d=.h).new
 	mv -f $(@:.d=.h).new $(@:.d=.h)
 
 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h