summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-09-11 12:09:10 +0000
committerUlrich Drepper <drepper@redhat.com>1997-09-11 12:09:10 +0000
commit9a0a462ceb4ab96c909b182f3052de2ef13fbe3a (patch)
tree59456497b6acefe69aab04fc28c38ea38852ccc7 /sysdeps/i386
parent26b4d7667169f8db26fd8194b3c498ec58e50f90 (diff)
downloadglibc-9a0a462ceb4ab96c909b182f3052de2ef13fbe3a.tar.gz
glibc-9a0a462ceb4ab96c909b182f3052de2ef13fbe3a.tar.xz
glibc-9a0a462ceb4ab96c909b182f3052de2ef13fbe3a.zip
Update.
1997-09-11 04:36  Ulrich Drepper  <drepper@cygnus.com>

	* db2/db_int.h: Define __set_errno if not yet available.
	* db2/btree/bt_rec.c: Use __set_errno to set errno value.
	* db2/clib/getlong.c: Likewise.
	* db2/db185/db185.c: Likewise.
	* db2/db185/db185_int.h: Likewise.
	* db2/dbm/dbm.c: Likewise.
	* db2/lock/lock_deadlock.c: Likewise.
	* db2/log/log_archive.c: Likewise.

	* elf/dl-profile.c: Implement mcount function.

	* gmon/gmon.c: Use __profil not profil because of namespace pollution.
	* gmon/mcount.c: Remove BSD kernel code.
	Use compare&swap instruction if possible to change state variable.
	Optimize frompc folding.
	* gmon/sys/gmon.h (struct gmonparam): Change state field to long int.
	* sysdeps/i386/i486/atomicity.h: New file.
	* sysdeps/stub/atomicity.h: New file.
	* sysdeps/mach/hurd/profil.c: Define function as __profil and make
	profil weak alias.
	* sysdeps/posix/profil.c: Likewise.

	* string/bits/string2.h: New file.
	* include/bits/string2.h: New file.
	* string/Makefile (routines): Add mempcpy.
	(tests): Add inl-tester.
	Remove _D__NO_STRING_INLINES from CFLAGS-* variables.
	* sysdeps/generic/mempcpy.c: New file.
	* sysdeps/generic/memccpy.c: Undef function name to enable definition
	as macro.
	* sysdeps/generic/memchr.c: Likewise.
	* sysdeps/generic/memcmp.c: Likewise.
	* sysdeps/generic/memmem.c: Likewise.
	* sysdeps/generic/memmove.c: Likewise.
	* sysdeps/generic/strcat.c: Likewise.
	* sysdeps/generic/strchr.c: Likewise.
	* sysdeps/generic/strcmp.c: Likewise.
	* sysdeps/generic/strcpy.c: Likewise.
	* sysdeps/generic/strcspn.c: Likewise.
	* sysdeps/generic/strlen.c: Likewise.
	* sysdeps/generic/strncat.c: Likewise.
	* sysdeps/generic/strncmp.c: Likewise.
	* sysdeps/generic/strncpy.c: Likewise.
	* sysdeps/generic/strpbrk.c: Likewise.
	* sysdeps/generic/strrchr.c: Likewise.
	* sysdeps/generic/strsep.c: Likewise.
	* sysdeps/generic/strspn.c: Likewise.
	* sysdeps/generic/strstr.c: Likewise.
	* sysdeps/generic/strtok.c: Likewise.
	* sysdeps/generic/strtok_r.c: Likewise.
	* sysdeps/i386/memset.c: Likewise.
	* sysdeps/i386/bits/string.h: Correct a few types and constraints.
	* sysdeps/i386/i486/bits/string.h: Heavy rewrites and optimizations.
	* string/stratcliff.c: Undefine __USE_STRING_INLINES.
	* string/tst-strlen.c: Likewise.
	* string/string.h: Add prototype for mempcpy.  Include bits/string2.h
	header always if optimizing.
	* intl/dcgettext.c: Don't unconditionally define stpcpy, only if not
	yet defined.
	* intl/l10nflist.c: Likewise.

	* string/tester.c: Add copyright and make little cleanups.

	* inet/test_ifindex.c: Change type of ni variable to unsigned int.

	* locale/programs/ld-ctype.c (struct locale_ctype_t): Change type
	of fields map_collection_max and map_collection_act to size_t.

	* nss/libnss_files.map: Group entries.

	* posix/unistd.h: Add prototype for __setpgid and __profil.

	* sysdeps/generic/crypt.h: Declare __crypt_r.

	* sysdeps/i386/bits/select.h: Fix fatal bugs, use correct casts now.

	* sysdeps/i386/fpu/bits/mathinline.h (isgreater, isgreaterequal,
	isless, islessequal, islessgreater, isunordered): Optimize a bit.

	* sysdeps/stub/ftruncate.c: Include missing header for prototype.
	* sysdeps/stub/getdents.c: Likewise.
	* sysdeps/stub/reboot.c: Likewise.
	* sysdeps/stub/swapon.c: Likewise.
	* sysdeps/stub/syscall.c: Likewise.
	* sysdeps/stub/ualarm.c: Likewise.
	* sysdeps/stub/usleep.c: Likewise.

	* sysdeps/unix/sysv/linux/if_index.c: Don't compile or use opensock
	if SIOGIFINDEX and SIOGIFNAME are not defined.

	* sysdeps/unix/sysv/linux/net/if.h: Add IFF_PORTSEL and IFF_AUTOMEDIA
	according to recent kernel changes.

1997-09-10 21:32  Klaus Espenlaub  <kespenla@student.informatik.uni-ulm.de>

	* Makeconfig: Use $(have-initfini) instead of $(elf) to figure out
	the installed name of the startup code.
	(common-generated): Add version.mk.
	* Makefile (distclean-1): Add glibcbug.
	* Makerules: Replace -lgcc by $(gnulib).
	* catgets/Makefile (generated): Add xmalloc.o.
	* csu/Makefile (generated): Replace align.h and end.h by defs.h to
	match the generated file.
	* manual/Makefile (mostlyclean): Add stub-manual and stamp.o.
	(realclean): Changed to remove chapters-incl[12].
	* po/Makefile (realclean): New rule to remove the generated .mo files.
	* time/Makefile: Only include zonefile dependencies if $(no_deps) is
	not true to avoid make clean failure when directory time doesn't exist
	yet.
	(generated): Add tzselect.

	* stdio/fgets.c (fgets): Add casts to reduce gcc warning noise.
	* stdio/internals.c (flushbuf): Likewise.
	* stdio/linewrap.c (lwupdate): Likewise.
	* stdio/memstream.c (enlarge_buffer): Likewise.
	* stdio-common/vfscanf.c (_IO_vfscanf): Likewise.
	* time/tzset.c (compute_change): Likewise.
	* misc/init-misc.c (__init_misc): Only declare static if HAVE_GNU_LD
	is defined.
	* sysdeps/posix/pipestream.c (FUNC): Change to generate ANSI C style
	functions.
	* sysdeps/stub/init-posix.c: Likewise.
	* sysdeps/stub/profil.c: Likewise.
	* munch-tmpl.c (__libc_init): Convert to ANSI C style declaration to
	reduce gcc warning noise.
	* stdio/glue.c (_filbuf, _flsbuf): Likewise.
	* stdio/obstream.c (grow, seek, input, init_obstream): Likewise.
	* stdio/vasprintf.c (enlarge_buffer): Likewise.
	* sysdeps/generic/sysd-stdio.c (__stdio_read, __stdio_write,
	__stdio_seek, __stdio_close, __stdio_fileno, __stdio_open,
	__stdio_reopen): Likewise.
	* sysdeps/posix/defs.c (_cleanup): Likewise.
	* time/offtime.c (__offtime): Add cast.

	* posix/getopt.c: Don't use text_set_element if not defined.

	* configure.in: Provide a check for underscores before user labels
	that works even when the compiler used for building doesn't work
	(like when there is no C library).  Use the old way if the compiler
	works.

1997-09-10 05:08  David S. Miller  <davem@caip.rutgers.edu>

	* sysdeps/unix/sysv/linux/sparc/bits/ioctls.h: The TC* ioctls use
	'T' not 't' on SparcLinux.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: tcflag_t is 32 bits.

	* sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Add aliases for
	_longjmp and siglongjmp.

1997-09-09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libio/stdio.h: Add format attributes to the extra printf and
	scanf like functions.
	* stdio/stdio.h: Likewise.

1997-09-09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r):
	Print tablename_val, not tablename_len.

	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_getntohost_r):
	Use sprintf instead of sprintf, the string always fits.
	* nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_gethostbyaddr_r):
	Likewise.
	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r):
	Likewise.
	* nis/nss_nisplus/nisplus-proto.c
	(_nss_nisplus_getprotobynumber_r): Likewise.
	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_getrpcbynumber_r):
	Likewise.
	* nis/nss_nisplus/nisplus-service.c
	(_nss_nisplus_getservbynumber_r): Likewise.

	* nis/nss_nisplus/nisplus-alias.c (_nss_create_tablename): Use
	__stpcpy, __stpncpy and __strdup instead of public names.
	* nis/nss_nisplus/nisplus-ethers.c (_nss_create_tablename):
	Likewise.
	* nis/nss_nisplus/nisplus-grp.c (_nss_create_tablename): Likewise.
	* nis/nss_nisplus/nisplus-hosts.c (_nss_create_tablename):
	Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_parse_netgroup):
	Likewise.
	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_parse_netent):
	Likewise.
	(_nss_create_tablename): Likewise.
	* nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_parse_protoent):
	Likewise.
	(_nss_create_tablename): Likewise.
	* nis/nss_nisplus/nisplus-pwd.c (_nss_create_tablename):
	Likewise.
	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_parse_rpcent):
	Likewise.
	(_nss_create_tablename): Likewise.
	* nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent):
	Likewise.
	(_nss_create_tablename): Likewise.
	* nis/nss_nisplus/nisplus-spwd.c (_nss_create_tablename):
	Likewise.

	* libc.map: Export __stpcpy and __strdup.

1997-09-09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/Makefile (CFLAGS-test-float.c, CFLAGS-test-double.c,
	CFLAGS-test-ldouble.c): Pass -ffloat-store to avoid excessive
	precision.

1997-09-09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* include/rpc/auth_des.h: New file.

1997-09-09  Paul Eggert  <eggert@twinsun.com>

	* time/mktime.c (__mktime_internal): Declare sec_requested even if
	!LEAP_SECONDS_POSSIBLE, since it's needed at the end when checking
	for time_t overflow.

1997-09-09 22:11  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/posix/getcwd.c: Correct test for too small buffer.
	Reported by Erik Troan <ewt@redhat.com>.

	* elf/dl-close.c: Include <bits/libc-lock.h>, not <libc-lock.h>.
	* elf/dl-open.c: Likewise.

1997-09-07 17:09  Richard Henderson  <rth@cygnus.com>

	* sysdeps/alpha/Makefile: Kill setjmp_aux.
	* sysdeps/alpha/bits/setjmp.h: Rewrite in terms of an array.
	* sysdeps/alpha/__longjmp.c: Remove.
	* sysdeps/alpha/setjmp_aux.c: Remove.
	* sysdeps/alpha/__longjmp.S: New file.
	* sysdeps/alpha/bsd-_setjmp.S: Stub out.
	* sysdeps/alpha/bsd-setjmp.S: Likewise.
	* sysdeps/alpha/setjmp.S: Do the work; don't call __setjmp_aux.
	Move _setjmp and setjmp from bsd-*.S.

1997-09-06  20:20  Ulrich Drepper  <drepper@cygnus.com>

	* include/rpc/auth.h: New file.
	* include/rpc/auth_unix.h: New file.

1997-09-06  Paul Eggert  <eggert@twinsun.com>

	Fix gmtime so that it reports leap seconds when TZ
	indicates that leap seconds are desired.

	* time/gmtime.c (<stddef.h>): Remove unnecessary include.
	(gmtime): Put after gmtime_r, to help the compiler inline.
	(__tz_convert): New decl.
	(gmtime_r): Use __tz_convert instead of __offtime,
	so that leap seconds are handled correctly.

	* time/localtime.c (<errno.h>, <libc-lock.h>): Remove includes that
	are now unnecessary.
	(__tzset_internal, __tz_compute, __tzfile_compute, __use_tzfile,
	__tzset_lock): Remove extern decls that are now unnecessary.
	(localtime_internal): Moved to __tz_convert in tzset.c.
	so that localtime and gmtime can both use it easily.
	(localtime): Put after localtime_r, to help the compiler inline.
	(localtime_r): Use __tz_convert instead of localtime_internal.

	* time/strftime.c (__tz_compute): Remove unused (and now incorrect)
	decl.

	* time/tzfile.c (__tzfile_compute): New arg USE_LOCALTIME.

	* time/tzset.c (<errno.h>): Include.
	(_tmbuf): New decl.
	(__tzfile_compute): New function.
	(tz_compute): Renamed from __tz_compute.  No longer extern.
	Remove redundant call to tzset_internal.
	(tzset_internal): Renamed from __tzset_internal.  No longer extern.
	(tzset_lock): Renamed from __tzset_lock.  No longer extern.
	(__tz_convert): New function, containing functionality of old
	localtime_internal function, plus locking and optional UTC.

1997-09-06  Paul Eggert  <eggert@twinsun.com>

	* time/tzfile.c (__tzfile_read): Don't read a file if TZ is the empty
	string, just use UTC without leap seconds.  This is for compatibility
	with the Olson code.

1997-09-06  Paul Eggert  <eggert@twinsun.com>

	* time/tzset.c (__tzname_max): Lock tz data structures before
	invoking tzset_internal.

	* time/tzfile.c: Define compute_tzname_max statically.

1997-09-07 10:57  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nis_call.c: Remove not longer necessary HAVE_SECURE_RPC ifdefs.
	* nis/nis_intern.h: Likewise.
	* nis/nss_nis/nis-publickey.c: Likewise.
	* nis/nss_nisplus/nisplus-publickey.c: Likewise.
	* nis/ypclnt.c: Likewise.

	* sunrpc/auth_des.c: Don't dereference NULL pointer,
	initialize ad->ad_timediff.

	* sunrpc/auth_none.c: Don't define our own prototypes, use the one
	from the header files.
	* sunrpc/auth_unix.c: Likewise.
	* sunrpc/clnt_raw.c: Likewise.
	* sunrpc/clnt_tcp.c: Likewise.
	* sunrpc/rpc_cmsg.c: Likewise.

	* sunrpc/key_call.c: Fix signal handling.

	* sunrpc/openchild.c: Don't use /bin/sh to start /usr/etc/keyenvoy,
	or we will get a deadlock with NIS+.

	* sunrpc/rpc/auth.h: Add prototype for xdr_opaque_auth, don't define
	HAVE_SECURE_RPC.

1997-09-07 15:51  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/i386/bits/select.h [__GNUC__] (__FD_ZERO, __FD_SET, __FD_CLR,
	__FD_ISSET): Use correct casts to address array correctly.
	Reported by urbanw@cs.umu.se.

1997-09-07 05:07  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-close.c: Include <bits/libc-lock.h>, not <libc-lock.h>.
	* elf/dl-open.c: Likewise.
	* sysdeps/i386/memset.c: Undefine memset in case the header with the
	optimized functions is included.
	Patches by NIIBE Yutaka <gniibe@mri.co.jp>.

	* sysdeps/i386/bits/string.h [__PIC__] (strcspn, strspn, strpbrk,
	strsep): Use register for second parameter.
	* sysdeps/i386/i486/bits/string.h: Likewise.
	Reported by NIIBE Yutaka <gniibe@mri.co.jp>.

1997-09-03 09:48  Geoff Keating  <geoffk@ozemail.com.au>

	* math/libm-test.c: Change various tolerances to match what the
	tested routines can actually provide.

	* math/Makefile: Add new tests.
	* math/atest-sincos.c: New file.
	* math/atest-exp.c: New file.

	* csu/Makefile: Give initfini.s and initfiniS.s their own
	CFLAGS-* macros so they can be overridden.
	* sysdeps/powerpc/Makefile [subdir=csu]: Override flags for
	initfiniS.s to use -fpic instead of -fPIC, because the sed script
	breaks otherwise.

	* sysdeps/powerpc/Makefile [build-shared]: Use -fpic not -fPIC for
	efficiency.

	* sysdeps/powerpc/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
	Don't use register 0, to let _mcount be in a shared object.

	* sysdeps/powerpc/dl-machine.h: Use full sentences in comments.
	Generally clean up.  Suppress some code we don't need when relocating
	ld.so.
	* sysdeps/powerpc/test-arith.c: Change loop indices to size_t when
	appropriate to suppress gcc warning.
	* resolv/res_send.c: Suppress warning.
	* sunrpc/xdr_sizeof.c: Suppress warning.

	* FAQ: Add ppc-linux.
	* manual/maint.texi: Add ppc-linux.  Explain that gcc can't build it
	yet.

	* sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Correct for
	current kernels.

1997-08-15 07:45  Geoff Keating  <geoffk@ozemail.com.au>

	* stdlib/fmtmsg.c: Use two parameters for __libc_once_define.
	* sysdeps/i386/machine-gmon.h: Correct typo.

	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Change to match
	kernel.

	* sysdeps/generic/dl-sysdep.c: Add hook for bizzare PPC argument hack.
	* sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Rewrite to use
	sysdeps/linux/dl-sysdep.c.

	* sysdeps/powerpc/Makefile [subdir=gmon]: Compile ppc-mcount.
	* sysdeps/powerpc/machine-gmon.h: Use ppc-mcount.
	* sysdeps/powerpc/ppc-mcount: New file.

	The following are mostly changes to allow profiling:
	* sysdeps/powerpc/add_n.S: Added.
	* sysdeps/powerpc/add_n.s: Removed.
	* sysdeps/powerpc/addmul_1.S: Added.
	* sysdeps/powerpc/addmul_1.s: Removed.
	* sysdeps/powerpc/bsd-_setjmp.S: Use JUMPTARGET macro.
	* sysdeps/powerpc/bsd-setjmp.S: Use JUMPTARGET macro.
	* sysdeps/powerpc/lshift.S: Added.
	* sysdeps/powerpc/lshift.s: Removed.
	* sysdeps/powerpc/memset.S: Added.
	* sysdeps/powerpc/memset.s: Removed.
	* sysdeps/powerpc/mul_1.S: Added.
	* sysdeps/powerpc/mul_1.s: Removed.
	* sysdeps/powerpc/rshift.S: Added.
	* sysdeps/powerpc/rshift.s: Removed.
	* sysdeps/powerpc/s_copysign.S: Use ENTRY, END, weak_alias macros.
	* sysdeps/powerpc/s_fabs.S: Use ENTRY, END, weak_alias macros.
	* sysdeps/powerpc/setjmp.S: Use JUMPTARGET macro.
	* sysdeps/powerpc/strchr.S: Added.
	* sysdeps/powerpc/strchr.s: Removed.
	* sysdeps/powerpc/strcmp.S: Added.
	* sysdeps/powerpc/strcmp.s: Removed.
	* sysdeps/powerpc/strlen.S: Added.
	* sysdeps/powerpc/strlen.s: Removed.
	* sysdeps/powerpc/sub_n.S: Added.
	* sysdeps/powerpc/sub_n.s: Removed.
	* sysdeps/powerpc/submul_1.S: Added.
	* sysdeps/powerpc/submul_1.s: Removed.
	* sysdeps/unix/sysv/linux/powerpc/_exit.S: Removed.
	* sysdeps/unix/sysv/linux/powerpc/brk.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/brk.c: Removed.
	* sysdeps/unix/sysv/linux/powerpc/clone.S: Use new macros. Fix
	various bugs. Document that it isn't tested.
	* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Make look like
	sysdeps/unix/_exit.S.
	* sysdeps/unix/sysv/linux/powerpc/socket.S: Use new macros.
	* sysdeps/unix/sysv/linux/powerpc/syscall.S: Use new macros.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Define some new macros
	to make assembler (possibly) more portable, allow profiling, etc.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/bits/select.h15
-rw-r--r--sysdeps/i386/bits/string.h17
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h21
-rw-r--r--sysdeps/i386/i486/atomicity.h57
-rw-r--r--sysdeps/i386/i486/bits/string.h850
-rw-r--r--sysdeps/i386/machine-gmon.h4
-rw-r--r--sysdeps/i386/memset.c2
7 files changed, 815 insertions, 151 deletions
diff --git a/sysdeps/i386/bits/select.h b/sysdeps/i386/bits/select.h
index 8c9a5434b9..edcb562945 100644
--- a/sysdeps/i386/bits/select.h
+++ b/sysdeps/i386/bits/select.h
@@ -24,29 +24,30 @@
 #if defined __GNUC__ && __GNUC__ >= 2
 
 # define __FD_ZERO(fdsetp) \
-  __asm__ __volatile__ ("cld ; rep ; stosl"				      \
-			: "=m" (*(__fd_set *) (fdsetp))			      \
+  __asm__ __volatile__ ("cld; rep; stosl"				      \
+			: "=m" (((__fd_mask *)				      \
+				 (fdsetp))[__FDELT (__FD_SETSIZE)])	      \
 			: "a" (0), "c" (sizeof (__fd_set)		      \
 					/ sizeof (__fd_mask)),		      \
 			  "D" ((__fd_set *) (fdsetp))			      \
 			:"cx","di")
 # define __FD_SET(fd, fdsetp) \
   __asm__ __volatile__ ("btsl %1,%0"					      \
-			: "=m" (((__fd_set *) (fdsetp))[__FDELT (fd)])	      \
+			: "=m" (((__fd_mask *) (fdsetp))[__FDELT (fd)])	      \
 			: "r" (((int) (fd)) % __NFDBITS)		      \
 			: "cc")
 # define __FD_CLR(fd, fdsetp) \
   __asm__ __volatile__ ("btrl %1,%0"					      \
-			: "=m" (((__fd_set *) (fdsetp))[__FDELT (fd)])	      \
+			: "=m" (((__fd_mask *) (fdsetp))[__FDELT (fd)])	      \
 			: "r" (((int) (fd)) % __NFDBITS)		      \
 			: "cc")
 # define __FD_ISSET(fd, fdsetp) \
   (__extension__							      \
-   ({unsigned int __result;						      \
-     __asm__ __volatile__ ("btl %1,%2 ; setcb %b0; andl $1,%0"		      \
+   ({register char __result;						      \
+     __asm__ __volatile__ ("btl %1,%2 ; setcb %b0"			      \
 			   : "=q" (__result)				      \
 			   : "r" (((int) (fd)) % __NFDBITS),		      \
-			     "m" (((__fd_set *) (fdsetp))[__FDELT (fd)])      \
+			     "m" (((__fd_mask *) (fdsetp))[__FDELT (fd)])     \
 			   : "cc");					      \
      __result; }))
 
diff --git a/sysdeps/i386/bits/string.h b/sysdeps/i386/bits/string.h
index 254db3e7f3..2931684781 100644
--- a/sysdeps/i386/bits/string.h
+++ b/sysdeps/i386/bits/string.h
@@ -41,7 +41,7 @@
 __STRING_INLINE void *
 __memcpy_c (void *__dest, __const void *__src, size_t __n)
 {
-  switch (n)
+  switch (__n)
     {
     case 0:
       return __dest;
@@ -102,10 +102,10 @@ __memcpy_c (void *__dest, __const void *__src, size_t __n)
      "rep; movsl"							      \
      x									      \
      : /* no outputs */							      \
-     : "c" (n / 4), "D" (__dest), "S" (__src)				      \
+     : "c" (__n / 4), "D" (__dest), "S" (__src)				      \
      : "cx", "di", "si", "memory");
 
-  switch (n % 4)
+  switch (__n % 4)
     {
     case 0:
       __COMMON_CODE ("");
@@ -232,8 +232,7 @@ __memset_gg (void *__s, char __c, size_t __n)
 {
   __asm__ __volatile__
     ("cld\n\t"
-     "rep\n\t"
-     "stosb"
+     "rep; stosb"
      : /* no output */
      : "a" (__c),"D" (__s), "c" (__n)
      : "cx", "di", "memory");
@@ -518,7 +517,7 @@ strcspn (__const char *__s, __const char *__reject)
      "2:\n\t"
      "popl	%%ebx"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__reject)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "r" (__reject)
      : "ax", "cx", "di", "cc");
   return (__res - 1) - __s;
 }
@@ -577,7 +576,7 @@ strspn (__const char *__s, __const char *__accept)
      "2:\n\t"
      "popl	%%ebx"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "r" (__accept)
      : "ax", "cx", "di", "cc");
   return (__res - 1) - __s;
 }
@@ -639,7 +638,7 @@ strpbrk (__const char *__s, __const char *__accept)
      "3:\n\t"
      "popl	%%ebx"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "r" (__accept)
      : "ax", "cx", "di", "cc");
   return __res;
 }
@@ -704,7 +703,7 @@ strstr (__const char *__haystack, __const char *__needle)
      "2:\n\t"
      "popl	%%ebx"
      : "=a" (__res)
-     : "0" (0), "c" (0xffffffff), "S" (__haystack), "g" (__needle)
+     : "0" (0), "c" (0xffffffff), "S" (__haystack), "r" (__needle)
      : "cx", "di", "si", "cc");
   return __res;
 }
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 17f62a080f..55e9171459 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -28,43 +28,40 @@
    These must not be inline functions since we have to be able to handle
    all floating-point types.  */
 # define isgreater(x, y) \
-     ({ int __result;							      \
+     ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al;"	      \
-		 "andl $0x01, %0"					      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
 # define isgreaterequal(x, y) \
-     ({ int __result;							      \
+     ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;"	      \
-		 "andl $0x01, %0"					      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
 # define isless(x, y) \
-     ({ int __result;							      \
+     ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;"      \
-		 "setz %%al; andl $0x01, %0"				      \
+		 "setz %%al"						      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
 # define islessequal(x, y) \
-     ({ int __result;							      \
+     ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;"      \
-		 "setz %%al; andl $0x01, %0"				      \
+		 "setz %%al"						      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
 # define islessgreater(x, y) \
-     ({ int __result;							      \
+     ({ register char __result;						      \
 	__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;"	      \
-		 "andl $0x01, %0"					      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 
 # define isunordered(x, y) \
-     ({ int __result;							      \
-	__asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0x01, %0"	      \
+     ({ register char __result;						      \
+	__asm__ ("fucompp; fnstsw; sahf; setp %%al"			      \
 		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
 	__result; })
 #endif
diff --git a/sysdeps/i386/i486/atomicity.h b/sysdeps/i386/i486/atomicity.h
new file mode 100644
index 0000000000..98a2531365
--- /dev/null
+++ b/sysdeps/i386/i486/atomicity.h
@@ -0,0 +1,57 @@
+/* Low-level functions for atomitc operations.  ix86 version, x >= 4.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H	1
+
+#include <inttypes.h>
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+  register int result;
+  __asm__ __volatile__ ("lock; xaddl %0,%1"
+			: "=r" (result) : "0" (val), "m" (*mem) : "memory");
+  return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+  __asm__ __volatile__ ("lock; addl %0,%1"
+			: : "ir" (val), "m" (*mem) : "memory");
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+  char ret;
+  long int readval;
+
+  __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
+                        : "=q" (ret), "=m" (*p), "=a" (readval)
+                        : "r" (newval), "m" (*p), "a" (oldval));
+  return ret;
+}
+
+#endif /* atomicity.h */
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index f141bd50e1..770f5c1e15 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -32,16 +32,19 @@
 
 
 /* Copy N bytes of SRC to DEST.  */
+#define _HAVE_STRING_ARCH_memcpy 1
 #define memcpy(dest, src, n) \
   (__extension__ (__builtin_constant_p (n)				      \
 		  ? __memcpy_c (dest, src, n)				      \
 		  : __memcpy_g (dest, src, n)))
 #define __memcpy_c(dest, src, n) \
-  (((n) % 4 == 0)							      \
-   ? __memcpy_by4 (dest, src, n)					      \
-   : (((n) % 2 == 0)							      \
-      ? __memcpy_by2 (dest, src, n)					      \
-      : __memcpy_g (dest, src, n)))
+  ((n) == 0								      \
+   ? (dest)								      \
+   : (((n) % 4 == 0)							      \
+      ? __memcpy_by4 (dest, src, n)					      \
+      : (((n) % 2 == 0)							      \
+	 ? __memcpy_by2 (dest, src, n)					      \
+	 : __memcpy_g (dest, src, n))))
 
 __STRING_INLINE void *
 __memcpy_by4 (void *__dest, __const void *__src, size_t __n)
@@ -135,6 +138,7 @@ memmove (void *__dest, __const void *__src, size_t __n)
 
 
 /* Compare N bytes of S1 and S2.  */
+#define _HAVE_STRING_ARCH_memcmp 1
 #ifndef __PIC__
 /* gcc has problems to spill registers when using PIC.  */
 __STRING_INLINE int
@@ -157,6 +161,7 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
 
 
 /* Set N bytes of S to C.  */
+#define _HAVE_STRING_ARCH_memset 1
 #define memset(s, c, n) \
   (__extension__ (__builtin_constant_p (c)				      \
 		  ? (__builtin_constant_p (n)				      \
@@ -166,17 +171,21 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
 		     ? __memset_gc (s, c, n)				      \
 		     : __memset_gg (s, c, n))))
 #define __memset_cc(s, c, n) \
-  (((n) % 4 == 0)							      \
-   ? __memset_cc_by4 (s, c, n)						      \
-   : (((n) % 2== 0)							      \
-      ? __memset_cc_by2 (s, c, n)					      \
-      : __memset_cg (s, c, n)))
+  ((n) == 0								      \
+   ? (s)								      \
+   : (((n) % 4 == 0)							      \
+      ? __memset_cc_by4 (s, c, n)					      \
+      : (((n) % 2== 0)							      \
+	 ? __memset_cc_by2 (s, c, n)					      \
+	 : __memset_cg (s, c, n))))
 #define __memset_gc(s, c, n) \
-  (((n) % 4== 0)							      \
-   ? __memset_gc_by4 (s, c, n)						      \
-   : (((n) % 2 == 0)							      \
-      ? __memset_gc_by2 (s, c, n)					      \
-      : __memset_gg (s, c, n)))
+  ((n) == 0								      \
+   ? (s)								      \
+   : (((n) % 4== 0)							      \
+      ? __memset_gc_by4 (s, c, n)					      \
+      : (((n) % 2 == 0)							      \
+	 ? __memset_gc_by2 (s, c, n)					      \
+	 : __memset_gg (s, c, n))))
 
 __STRING_INLINE void *
 __memset_cc_by4 (void *__s, int __c, size_t __n)
@@ -196,7 +205,7 @@ __memset_cc_by4 (void *__s, int __c, size_t __n)
 }
 
 __STRING_INLINE void *
-__memset_cc_by2 (void *__s, char __c, size_t __n)
+__memset_cc_by2 (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
   register int __dummy;
@@ -217,7 +226,7 @@ __memset_cc_by2 (void *__s, char __c, size_t __n)
 }
 
 __STRING_INLINE void *
-__memset_gc_by4 (void *__s, char __c, size_t __n)
+__memset_gc_by4 (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
   register int __dummy;
@@ -238,7 +247,7 @@ __memset_gc_by4 (void *__s, char __c, size_t __n)
 }
 
 __STRING_INLINE void *
-__memset_gc_by2 (void *__s, char __c, size_t __n)
+__memset_gc_by2 (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
   register int __dummy1, __dummy2;
@@ -263,7 +272,7 @@ __memset_gc_by2 (void *__s, char __c, size_t __n)
 }
 
 __STRING_INLINE void *
-__memset_cg (void *__s, char __c, size_t __n)
+__memset_cg (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
   __asm__ __volatile__
@@ -279,7 +288,7 @@ __memset_cg (void *__s, char __c, size_t __n)
 }
 
 __STRING_INLINE void *
-__memset_gg (void *__s, char __c, size_t __n)
+__memset_gg (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
   __asm__ __volatile__
@@ -297,6 +306,7 @@ __memset_gg (void *__s, char __c, size_t __n)
 
 
 /* Search N bytes of S for C.  */
+#define _HAVE_STRING_ARCH_memchr 1
 __STRING_INLINE void *
 memchr (__const void *__s, int __c, size_t __n)
 {
@@ -318,16 +328,21 @@ memchr (__const void *__s, int __c, size_t __n)
 
 
 /* Return the length of S.  */
+#define _HAVE_STRING_ARCH_strlen 1
+#define strlen(str) \
+  (__extension__ (__builtin_constant_p (str)				      \
+		  ? sizeof (str) - 1					      \
+		  : __strlen_g (str)))
 __STRING_INLINE size_t
-strlen (__const char *__str)
+__strlen_g (__const char *__str)
 {
   register char __dummy;
   register __const char *__tmp = __str;
   __asm__ __volatile__
     ("1:\n\t"
-     "movb	(%0),%1\n\t"
+     "movb	(%0),%b1\n\t"
      "leal	1(%0),%0\n\t"
-     "testb	%1,%1\n\t"
+     "testb	%b1,%b1\n\t"
      "jne	1b"
      : "=r" (__tmp), "=q" (__dummy)
      : "0" (__str)
@@ -337,19 +352,25 @@ strlen (__const char *__str)
 
 
 /* Copy SRC to DEST.  */
+#define _HAVE_STRING_ARCH_strcpy 1
+#define strcpy(dest, src) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? (char *) memcpy (dest, src, strlen (src) + 1)	      \
+		  : __strcpy_g (dest, src)))
+
 __STRING_INLINE char *
-strcpy (char *__dest, __const char *__src)
+__strcpy_g (char *__dest, __const char *__src)
 {
   register char *__tmp = __dest;
   register char __dummy;
   __asm__ __volatile__
     (
      "1:\n\t"
-     "movb	(%0),%2\n\t"
-     "incl	%0\n\t"
-     "movb	%2,(%1)\n\t"
-     "incl	%1\n\t"
-     "testb	%2,%2\n\t"
+     "movb	(%0),%b2\n\t"
+     "leal	1(%0),%0\n\t"
+     "movb	%b2,(%1)\n\t"
+     "leal	1(%1),%1\n\t"
+     "testb	%b2,%b2\n\t"
      "jne	1b"
      : "=r" (__src), "=r" (__tmp), "=q" (__dummy)
      : "0" (__src), "1" (__tmp)
@@ -358,9 +379,233 @@ strcpy (char *__dest, __const char *__src)
 }
 
 
+#ifdef __USE_GNU
+# define _HAVE_STRING_ARCH_stpcpy 1
+/* Copy SRC to DEST.  */
+# define __stpcpy(dest, src) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? (strlen (src) + 1 <= 8				      \
+		     ? __stpcpy_small (dest, src, strlen (src) + 1)	      \
+		     : __stpcpy_c (dest, src, strlen (src) + 1))	      \
+		  : __stpcpy_g (dest, src)))
+# define __stpcpy_c(dest, src, srclen) \
+  ((srclen) % 4 == 0							      \
+   ? __mempcpy_by4 (dest, src, srclen)					      \
+   : ((srclen) % 2 == 0							      \
+      ? __mempcpy_by2 (dest, src, srclen)				      \
+      : __mempcpy_byn (dest, src, srclen)))
+
+/* In glibc itself we use this symbol for namespace reasons.  */
+# define stpcpy(dest, src) __stpcpy (dest, src)
+
+__STRING_INLINE char *
+__stpcpy_small (char *__dest, __const char __src[], size_t __srclen)
+{
+  register char *__tmp = __dest;
+  switch (__srclen)
+    {
+    case 7:
+      *((unsigned short int *) __tmp)++ = *((unsigned short int *) __src)++;
+    case 5:
+      *((unsigned int *) __tmp)++ = *((unsigned int *) __src)++;
+      *((unsigned char *) __tmp) = '\0';
+      return __tmp;
+
+    case 8:
+      *((unsigned int *) __tmp)++ = *((unsigned int *) __src)++;
+    case 4:
+      *((unsigned int *) __tmp) = *((unsigned int *) __src);
+      return __tmp + 3;
+
+    case 6:
+      *((unsigned int *) __tmp)++ = *((unsigned int *) __src)++;
+    case 2:
+      *((unsigned short int *) __tmp) = *((unsigned short int *) __src);
+      return __tmp + 1;
+
+    case 3:
+      *((unsigned short int *) __tmp)++ = *((unsigned short int *) __src)++;
+    case 1:
+      *((unsigned char *) __tmp) = '\0';
+      return __tmp;
+
+    default:
+      break;
+    }
+  /* This should never happen.  */
+  return NULL;
+}
+
+__STRING_INLINE char *
+__mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen)
+{
+  register char *__tmp = __dest;
+  register int __dummy1, __dummy2;
+  __asm__ __volatile__
+    ("1:\n\t"
+     "movl	(%2),%0\n\t"
+     "leal	4(%2),%2\n\t"
+     "movl	%0,(%1)\n\t"
+     "leal	4(%1),%1\n\t"
+     "decl	%3\n\t"
+     "jnz	1b"
+     : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
+     : "memory", "cc");
+  return __tmp - 1;
+}
+
+__STRING_INLINE char *
+__mempcpy_by2 (char *__dest, __const char *__src, size_t __srclen)
+{
+  register char *__tmp = __dest;
+  register int __dummy1, __dummy2;
+  __asm__ __volatile__
+    ("shrl	$1,%3\n\t"
+     "jz	2f\n"                 /* only a word */
+     "1:\n\t"
+     "movl	(%2),%0\n\t"
+     "leal	4(%2),%2\n\t"
+     "movl	%0,(%1)\n\t"
+     "leal	4(%1),%1\n\t"
+     "decl	%3\n\t"
+     "jnz	1b\n"
+     "2:\n\t"
+     "movw	(%2),%w0\n\t"
+     "movw	%w0,(%1)"
+     : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "1" (__tmp), "2" (__src), "3" (__srclen / 2)
+     : "memory", "cc");
+  return __tmp + 1;
+}
+
+__STRING_INLINE char *
+__mempcpy_byn (char *__dest, __const char *__src, size_t __srclen)
+{
+  register char *__tmp = __dest;
+  __asm__ __volatile__
+    ("cld\n\t"
+     "shrl	$1,%%ecx\n\t"
+     "jnc	1f\n\t"
+     "movsb\n"
+     "1:\n\t"
+     "shrl	$1,%%ecx\n\t"
+     "jnc	2f\n\t"
+     "movsw\n"
+     "2:\n\t"
+     "rep; movsl"
+     : "=D" (__tmp)
+     : "c" (__srclen), "0" (__tmp),"S" (__src)
+     : "cx", "di", "si", "memory", "cc");
+  return __tmp - 1;
+}
+
+__STRING_INLINE char *
+__stpcpy_g (char *__dest, __const char *__src)
+{
+  register char *__tmp = __dest;
+  register char __dummy;
+  __asm__ __volatile__
+    (
+     "1:\n\t"
+     "movb	(%0),%b2\n\t"
+     "leal	1(%0),%0\n\t"
+     "movb	%b2,(%1)\n\t"
+     "leal	1(%1),%1\n\t"
+     "testb	%b2,%b2\n\t"
+     "jne	1b"
+     : "=r" (__src), "=r" (__tmp), "=q" (__dummy)
+     : "0" (__src), "1" (__tmp)
+     : "memory", "cc");
+  return __tmp - 1;
+}
+#endif
+
+
 /* Copy no more than N characters of SRC to DEST.  */
+#define _HAVE_STRING_ARCH_strncpy 1
+#define strncpy(dest, src, n) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? ((strlen (src) + 1 >= ((size_t) (n))		      \
+		      ? (char *) memcpy (dest, src, n)			      \
+		      : __strncpy_cg (dest, src, strlen (src) + 1, n)))	      \
+		  : __strncpy_gg (dest, src, n)))
+#define __strncpy_cg(dest, src, srclen, n) \
+  (((srclen) % 4 == 0)							      \
+   ? __strncpy_by4 (dest, src, srclen, n)				      \
+   : (((srclen) % 2 == 0)						      \
+      ? __strncpy_by2 (dest, src, srclen, n)				      \
+      : __strncpy_byn (dest, src, srclen, n)))
+
+__STRING_INLINE char *
+__strncpy_by4 (char *__dest, __const char __src[], size_t __srclen, size_t __n)
+{
+  register char *__tmp = __dest;
+  register int __dummy1, __dummy2;
+  __asm__ __volatile__
+    ("1:\n\t"
+     "movl	(%2),%0\n\t"
+     "leal	4(%2),%2\n\t"
+     "movl	%0,(%1)\n\t"
+     "leal	4(%1),%1\n\t"
+     "decl	%3\n\t"
+     "jnz	1b"
+     : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
+     : "memory", "cc");
+  (void) memset (__tmp, '\0', __n - __srclen);
+  return __dest;
+}
+
 __STRING_INLINE char *
-strncpy (char *__dest, __const char *__src, size_t __n)
+__strncpy_by2 (char *__dest, __const char __src[], size_t __srclen, size_t __n)
+{
+  register char *__tmp = __dest;
+  register int __dummy1, __dummy2;
+  __asm__ __volatile__
+    ("shrl	$1,%3\n\t"
+     "jz	2f\n"                 /* only a word */
+     "1:\n\t"
+     "movl	(%2),%0\n\t"
+     "leal	4(%2),%2\n\t"
+     "movl	%0,(%1)\n\t"
+     "leal	4(%1),%1\n\t"
+     "decl	%3\n\t"
+     "jnz	1b\n"
+     "2:\n\t"
+     "movw	(%2),%w0\n\t"
+     "movw	%w0,(%1)\n\t"
+     : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "1" (__tmp), "2" (__src), "3" (__srclen / 2)
+     : "memory", "cc");
+  (void) memset (__tmp + 2, '\0', __n - __srclen);
+  return __dest;
+}
+
+__STRING_INLINE char *
+__strncpy_byn (char *__dest, __const char __src[], size_t __srclen, size_t __n)
+{
+  register char *__tmp = __dest;
+  __asm__ __volatile__
+    ("cld\n\t"
+     "shrl	$1,%%ecx\n\t"
+     "jnc	1f\n\t"
+     "movsb\n"
+     "1:\n\t"
+     "shrl	$1,%%ecx\n\t"
+     "jnc	2f\n\t"
+     "movsw\n"
+     "2:\n\t"
+     "rep; movsl"
+     : "=D" (__tmp)
+     : "c" (__srclen), "0" (__tmp),"S" (__src)
+     : "cx", "di", "si", "memory", "cc");
+  (void) memset (__tmp, '\0', __n - __srclen);
+  return __dest;
+}
+
+__STRING_INLINE char *
+__strncpy_gg (char *__dest, __const char *__src, size_t __n)
 {
   register char *__tmp = __dest;
   register char __dummy;
@@ -390,14 +635,35 @@ strncpy (char *__dest, __const char *__src, size_t __n)
 
 
 /* Append SRC onto DEST.  */
+#define _HAVE_STRING_ARCH_strcat 1
+#define strcat(dest, src) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? __strcat_c (dest, src, strlen (src) + 1)		      \
+		  : __strcat_g (dest, src)))
+
+__STRING_INLINE char *
+__strcat_c (char *__dest, __const char __src[], size_t __srclen)
+{
+  register char *__tmp = __dest - 1;
+  __asm__ __volatile__
+    ("1:\n\t"
+     "incl	%0\n\t"
+     "cmpb	$0,(%0)\n\t"
+     "jne	1b\n"
+     : "=r" (__tmp)
+     : "0" (__tmp)
+     : "cc");
+  (void) memcpy (__tmp, __src, __srclen);
+  return __dest;
+}
+
 __STRING_INLINE char *
-strcat (char *__dest, __const char *__src)
+__strcat_g (char *__dest, __const char *__src)
 {
   register char *__tmp = __dest - 1;
   register char __dummy;
   __asm__ __volatile__
-    (
-     "1:\n\t"
+    ("1:\n\t"
      "incl	%1\n\t"
      "cmpb	$0,(%1)\n\t"
      "jne	1b\n"
@@ -416,16 +682,23 @@ strcat (char *__dest, __const char *__src)
 
 
 /* Append no more than N characters from SRC onto DEST.  */
+#define _HAVE_STRING_ARCH_strncat 1
+#define strncat(dest, src, n) \
+  (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
+		  ? (strlen (src) < ((size_t) (n))			      \
+		     ? strcat (dest, src)				      \
+		     : (memcpy (strchr (dest, '\0'), src, n), dest))	      \
+		  : __strncat_g (dest, src, n)))
+
 __STRING_INLINE char *
-strncat (char *__dest, __const char *__src, size_t __n)
+__strncat_g (char *__dest, __const char __src[], size_t __n)
 {
   register char *__tmp = __dest - 1;
   register char __dummy;
   __asm__ __volatile__
-    (
-     "1:\n\t"
-     "incl	%1\n\t"
-     "cmpb	$0,(%1)\n\t"
+    ("1:\n\t"
+     "cmpb	$0,1(%1)\n\t"
+     "leal	1(%1),%1\n\t"
      "jne	1b\n"
      "2:\n\t"
      "decl	%3\n\t"
@@ -435,7 +708,8 @@ strncat (char *__dest, __const char *__src, size_t __n)
      "movb	%b0,(%1)\n\t"
      "leal	1(%1),%1\n\t"
      "testb	%b0,%b0\n\t"
-     "jne	2b\n"
+     "jne	2b\n\t"
+     "decl	%1\n"
      "3:\n\t"
      "movb	$0,(%1)\n\t"
      : "=q" (__dummy), "=r" (__tmp), "=r" (__src), "=r" (__n)
@@ -446,6 +720,7 @@ strncat (char *__dest, __const char *__src, size_t __n)
 
 
 /* Compare S1 and S2.  */
+#define _HAVE_STRING_ARCH_strcmp 1
 __STRING_INLINE int
 strcmp (__const char *__s1, __const char *__s2)
 {
@@ -474,8 +749,16 @@ strcmp (__const char *__s1, __const char *__s2)
 
 
 /* Compare N characters of S1 and S2.  */
+#define _HAVE_STRING_ARCH_strncmp 1
+#define strncmp(s1, s2, n) \
+  (__extension__ (__builtin_constant_p (s1) && strlen (s1) < ((size_t) (n))   \
+		  ? strcmp (s1, s2)					      \
+		  : (__builtin_constant_p (s2) && strlen (s2) < ((size_t) (n))\
+		     ? strcmp (s1, s2)					      \
+		     : __strncmp_g (s1, s2, n))))
+
 __STRING_INLINE int
-strncmp (__const char *__s1, __const char *__s2, size_t __n)
+__strncmp_g (__const char *__s1, __const char *__s2, size_t __n)
 {
   register int __res;
   __asm__ __volatile__
@@ -505,18 +788,18 @@ strncmp (__const char *__s1, __const char *__s2, size_t __n)
 
 
 /* Find the first occurrence of C in S.  */
+#define _HAVE_STRING_ARCH_strchr 1
 #define strchr(s, c) \
   (__extension__ (__builtin_constant_p (c)				      \
 		  ? __strchr_c (s, ((c) & 0xff) << 8)			      \
 		  : __strchr_g (s, c)))
 
 __STRING_INLINE char *
-__strchr_g (__const char *__s, int __c)
+__strchr_c (__const char *__s, int __c)
 {
   register char *__res;
   __asm__ __volatile__
-    ("movb	%%al,%%ah\n"
-     "1:\n\t"
+    ("1:\n\t"
      "movb	(%0),%%al\n\t"
      "cmpb	%%ah,%%al\n\t"
      "je	2f\n\t"
@@ -532,11 +815,12 @@ __strchr_g (__const char *__s, int __c)
 }
 
 __STRING_INLINE char *
-__strchr_c (__const char *__s, int __c)
+__strchr_g (__const char *__s, int __c)
 {
   register char *__res;
   __asm__ __volatile__
-    ("1:\n\t"
+    ("movb	%%al,%%ah\n"
+     "1:\n\t"
      "movb	(%0),%%al\n\t"
      "cmpb	%%ah,%%al\n\t"
      "je	2f\n\t"
@@ -553,18 +837,56 @@ __strchr_c (__const char *__s, int __c)
 
 
 /* Find the last occurrence of C in S.  */
+#define _HAVE_STRING_ARCH_strrchr 1
 #define strrchr(s, c) \
   (__extension__ (__builtin_constant_p (c)				      \
 		  ? __strrchr_c (s, ((c) & 0xff) << 8)			      \
 		  : __strrchr_g (s, c)))
 
+#ifdef __i686__
+__STRING_INLINE char *
+__strrchr_c (__const char *__s, int __c)
+{
+  register char *__res;
+  __asm__ __volatile__
+    ("cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "cmpb	%%ah,%%al\n\t"
+     "cmovne	%%esi,%0\n\t"
+     "testb	%%al,%%al\n\t"
+     "jne 1b"
+     : "=d" (__res)
+     : "0" (1), "S" (__s),"a" (__c)
+     : "ax", "si", "cc");
+  return __res - 1;
+}
+
 __STRING_INLINE char *
 __strrchr_g (__const char *__s, int __c)
 {
   register char *__res;
   __asm__ __volatile__
-    ("cld\n\t"
-     "movb	%%al,%%ah\n"
+    ("movb	%%al,%%ah\n"
+     "cld\n\t"
+     "1:\n\t"
+     "lodsb\n\t"
+     "cmpb	%%ah,%%al\n\t"
+     "cmovne	%%esi,%0\n\t"
+     "testb	%%al,%%al\n\t"
+     "jne 1b"
+     : "=r" (__res)
+     : "0" (1), "S" (__s),"a" (__c)
+     : "ax", "si", "cc");
+  return __res - 1;
+}
+#else
+__STRING_INLINE char *
+__strrchr_c (__const char *__s, int __c)
+{
+  register char *__res;
+  __asm__ __volatile__
+    ("cld\n"
      "1:\n\t"
      "lodsb\n\t"
      "cmpb	%%ah,%%al\n\t"
@@ -580,11 +902,12 @@ __strrchr_g (__const char *__s, int __c)
 }
 
 __STRING_INLINE char *
-__strrchr_c (__const char *__s, int __c)
+__strrchr_g (__const char *__s, int __c)
 {
   register char *__res;
   __asm__ __volatile__
-    ("cld\n\t"
+    ("movb	%%al,%%ah\n"
+     "cld\n\t"
      "1:\n\t"
      "lodsb\n\t"
      "cmpb	%%ah,%%al\n\t"
@@ -593,66 +916,140 @@ __strrchr_c (__const char *__s, int __c)
      "2:\n\t"
      "testb	%%al,%%al\n\t"
      "jne 1b"
-     : "=d" (__res)
+     : "=r" (__res)
      : "0" (0), "S" (__s),"a" (__c)
      : "ax", "si", "cc");
   return __res;
 }
+#endif
 
 
 /* Return the length of the initial segment of S which
    consists entirely of characters not in REJECT.  */
-#ifdef __PIC__
+#define _HAVE_STRING_ARCH_strcspn 1
+#define strcspn(s, reject) \
+  (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1  \
+		  ? ((reject)[0] == '\0'				      \
+		     ? strlen (s)					      \
+		     : ((reject)[1] == '\0'				      \
+			? __strcspn_c1 (s, (((reject)[0] << 8) & 0xff00))     \
+			: __strcspn_cg (s, reject, strlen (reject))))	      \
+		  : __strcspn_g (s, reject)))
+
 __STRING_INLINE size_t
-strcspn (__const char *__s, __const char *__reject)
+__strcspn_c1 (__const char *__s, int __reject)
 {
   register char *__res;
   __asm__ __volatile__
-    ("push	%%ebx\n\t"
-     "cld\n\t"
+    ("1:\n\t"
+     "movb	(%0),%%al\n\t"
+     "leal	1(%0),%0\n\t"
+     "cmpb	%%ah,%%al\n\t"
+     "je	2f\n\t"
+     "testb	%%al,%%al\n\t"
+     "jne	1b\n"
+     "2:"
+     : "=r" (__res)
+     : "a" (__reject), "0" (__s)
+     : "ax", "cc");
+  return (__res - 1) - __s;
+}
+
+#ifdef __PIC__
+__STRING_INLINE size_t
+__strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
+{
+  register __const char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%%ebx,%1\n\t"
+     "movl	%%ecx,%%ebx\n\t"
+     "cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
      "movl	%4,%%edi\n\t"
+     "movl	%%ebx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "jne	1b\n"
+     "2:\n\t"
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=&m" (__mem)
+     : "c" (__reject_len), "0" (__s), "r" (__reject), "1" (__mem)
+     : "ax", "cx", "di", "cc");
+  return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t
+__strcspn_g (__const char *__s, __const char *__reject)
+{
+  register __const char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%%ebx,%1\n\t"
+     "movl	%5,%%edi\n\t"
+     "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
+     "leal	-1(%%ecx),%%ebx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%5,%%edi\n\t"
      "movl	%%ebx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n"
      "2:\n\t"
-     "popl	%%ebx"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__reject)
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=&m" (__mem)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "r" (__reject), "1" (__mem)
      : "ax", "cx", "di", "cc");
   return (__res - 1) - __s;
 }
 #else
 __STRING_INLINE size_t
-strcspn (__const char *__s, __const char *__reject)
+__strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
 {
-  register char *__res;
+  register __const char *__res;
+  __asm__ __volatile__
+    ("cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
+     "movl	%%ebx,%%edi\n\t"
+     "movl	%%edx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "jne	1b\n"
+     "2:"
+     : "=S" (__res)
+     : "d" (__reject_len), "0" (__s), "b" (__reject)
+     : "ax", "cx", "di", "cc");
+  return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t
+__strcspn_g (__const char *__s, __const char *__reject)
+{
+  register __const char *__res;
   __asm__ __volatile__
     ("cld\n\t"
-     "movl	%4,%%edi\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
+     "leal	-1(%%ecx),%%edx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%ebx,%%edi\n\t"
      "movl	%%edx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n"
      "2:"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__reject)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__reject), "D" (__reject)
      : "ax", "cx", "dx", "di", "cc");
   return (__res - 1) - __s;
 }
@@ -661,57 +1058,129 @@ strcspn (__const char *__s, __const char *__reject)
 
 /* Return the length of the initial segment of S which
    consists entirely of characters in ACCEPT.  */
-#ifdef __PIC__
+#define _HAVE_STRING_ARCH_strspn 1
+#define strspn(s, accept) \
+  (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1  \
+		  ? ((accept)[0] == '\0'				      \
+		     ? 0						      \
+		     : ((accept)[1] == '\0'				      \
+			? __strspn_c1 (s, (((accept)[0] << 8 ) & 0xff00))     \
+			: __strspn_cg (s, accept, strlen (accept))))	      \
+		  : __strspn_g (s, accept)))
+
 __STRING_INLINE size_t
-strspn (__const char *__s, __const char *__accept)
+__strspn_c1 (__const char *__s, int __accept)
 {
   register char *__res;
+  /* Please note that __accept never can be '\0'.  */
   __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
+    ("1:\n\t"
+     "movb	(%0),%%al\n\t"
+     "leal	1(%0),%0\n\t"
+     "cmpb	%%ah,%%al\n\t"
+     "je	1b\n"
+     "2:"
+     : "=r" (__res)
+     : "a" (__accept), "0" (__s)
+     : "ax", "cc");
+  return (__res - 1) - __s;
+}
+
+#ifdef __PIC__
+__STRING_INLINE size_t
+__strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
+{
+  register __const char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%%ebx,%1\n\t"
+     "movl	%%ecx,%%ebx\n\t"
+     "cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
+     "movl	%%edx,%%edi\n\t"
+     "movl	%%ebx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "je	1b\n"
+     "2:\n\t"
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=m" (__mem)
+     : "c" (__accept_len), "0" (__s), "d" (__accept), "1" (__mem)
+     : "ax", "cx", "di", "cc");
+  return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t
+__strspn_g (__const char *__s, __const char *__accept)
+{
+  register __const char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%%ebx,%1\n\t"
      "cld\n\t"
-     "movl	%4,%%edi\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
+     "leal	-1(%%ecx),%%ebx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%edx,%%edi\n\t"
      "movl	%%ebx,%%ecx\n\t"
      "repne; scasb\n\t"
      "je	1b\n"
      "2:\n\t"
-     "popl	%%ebx"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=m" (__mem)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "d" (__accept), "1" (__mem),
+       "D" (__accept)
      : "ax", "cx", "di", "cc");
   return (__res - 1) - __s;
 }
 #else
 __STRING_INLINE size_t
-strspn (__const char *__s, __const char *__accept)
+__strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 {
-  register char *__res;
+  register __const char *__res;
+  __asm__ __volatile__
+    ("cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
+     "movl	%%ebx,%%edi\n\t"
+     "movl	%%edx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "je	1b\n"
+     "2:"
+     : "=S" (__res)
+     : "d" (__accept_len), "0" (__s), "b" (__accept), "D" (__accept)
+     : "ax", "cx", "dx", "di", "cc");
+  return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t
+__strspn_g (__const char *__s, __const char *__accept)
+{
+  register __const char *__res;
   __asm__ __volatile__
     ("cld\n\t"
-     "movl	%4,%%edi\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
+     "leal	-1(%%ecx),%%edx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%ebx,%%edi\n\t"
      "movl	%%edx,%%ecx\n\t"
      "repne; scasb\n\t"
      "je	1b\n"
      "2:"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__accept), "D" (__accept)
      : "ax", "cx", "dx", "di", "cc");
   return (__res - 1) - __s;
 }
@@ -719,24 +1188,63 @@ strspn (__const char *__s, __const char *__accept)
 
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
+#define _HAVE_STRING_ARCH_strpbrk 1
+#define strpbrk(s, accept) \
+  (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1  \
+		  ? ((accept)[0] == '\0'				      \
+		     ? NULL						      \
+		     : ((accept)[1] == '\0'				      \
+			? strchr (s, (accept)[0])			      \
+			: __strpbrk_cg (s, accept, strlen (accept))))	      \
+		  : __strpbrk_g (s, accept)))
+
 #ifdef __PIC__
 __STRING_INLINE char *
-strpbrk (__const char *__s, __const char *__accept)
+__strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 {
   register char *__res;
+  int __mem;
   __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
+    ("movl	%%ebx,%1\n\t"
+     "movl	%%ecx,%%ebx\n\t"
+     "cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
+     "movl	%%edx,%%edi\n\t"
+     "movl	%%ebx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "jne	1b\n\t"
+     "decl	%0\n\t"
+     "jmp	3f\n"
+     "2:\n\t"
+     "xorl	%0,%0\n"
+     "3:\n\t"
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=m" (__mem)
+     : "c" (__accept_len), "0" (__s), "d" (__accept), "1" (__mem)
+     : "ax", "cx", "di", "cc");
+  return __res;
+}
+
+__STRING_INLINE char *
+__strpbrk_g (__const char *__s, __const char *__accept)
+{
+  register char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%%ebx,%1\n\t"
+     "movl	%%edx,%%edi\n\t"
      "cld\n\t"
-     "movl	%4,%%edi\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
+     "leal	-1(%%ecx),%%ebx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%edx,%%edi\n\t"
      "movl	%%ebx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n\t"
@@ -745,29 +1253,54 @@ strpbrk (__const char *__s, __const char *__accept)
      "2:\n\t"
      "xorl	%0,%0\n"
      "3:\n\t"
-     "popl	%%ebx"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     "movl	%1,%%ebx"
+     : "=S" (__res), "=m" (__mem)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "d" (__accept), "1" (__mem)
      : "ax", "cx", "di", "cc");
   return __res;
 }
 #else
 __STRING_INLINE char *
-strpbrk (__const char *__s, __const char *__accept)
+__strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 {
   register char *__res;
   __asm__ __volatile__
-    ("cld\n\t"
-     "movl	%4,%%edi\n\t"
+    ("movl	%%ebx,%%edi\n\t"
+     "cld\n"
+     "1:\n\t"
+     "lodsb\n\t"
+     "testb	%%al,%%al\n\t"
+     "je	2f\n\t"
+     "movl	%%ebx,%%edi\n\t"
+     "movl	%%edx,%%ecx\n\t"
+     "repne; scasb\n\t"
+     "jne	1b\n\t"
+     "decl	%0\n\t"
+     "jmp	3f\n"
+     "2:\n\t"
+     "xorl	%0,%0\n"
+     "3:"
+     : "=S" (__res)
+     : "d" (__accept_len), "0" (__s), "b" (__accept)
+     : "ax", "cx", "dx", "di", "cc");
+  return __res;
+}
+
+__STRING_INLINE char *
+__strpbrk_g (__const char *__s, __const char *__accept)
+{
+  register char *__res;
+  __asm__ __volatile__
+    ("movl	%%ebx,%%edi\n\t"
+     "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
+     "leal	-1(%%ecx),%%edx\n"
      "1:\n\t"
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%ebx,%%edi\n\t"
      "movl	%%edx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n\t"
@@ -777,7 +1310,7 @@ strpbrk (__const char *__s, __const char *__accept)
      "xorl	%0,%0\n"
      "3:"
      : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "g" (__accept)
+     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__accept)
      : "ax", "cx", "dx", "di", "cc");
   return __res;
 }
@@ -785,63 +1318,138 @@ strpbrk (__const char *__s, __const char *__accept)
 
 
 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
+#define _HAVE_STRING_ARCH_strstr 1
 #ifdef __PIC__
+/* XXX GCC has problems to spill the registers.  */
+# define strstr(haystack, needle) \
+  (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1  \
+		  ? ((needle)[0] == '\0'				      \
+		     ? haystack						      \
+		     : ((needle)[1] == '\0'				      \
+			? strchr (haystack, (needle)[0])		     \
+			: strstr (haystack, needle)))			      \
+		  : strstr (haystack, needle)))
+
+# if 0
+/* Please note that this function need not handle NEEDLEs with a
+   length shorter than two.  */
 __STRING_INLINE char *
-strstr (__const char *__haystack, __const char *__needle)
+__strstr_cg (__const char *__haystack, __const char __needle[],
+	     size_t __needle_len)
 {
   register char *__res;
+  int __mem;
   __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
-     "cld\n\t" \
-     "movl	%4,%%edi\n\t"
+    ("movl	%%ebx,%1\n\t"
+     "movl	%%ecx,%%ebx\n"
+     "cld\n" \
+     "1:\n\t"
+     "movl	%%edx,%%edi\n\t"
+     "movl	%%esi,%%eax\n\t"
+     "movl	%%ebx,%%ecx\n\t"
+     "repe; cmpsb\n\t"
+     "je	2f\n\t"
+     "cmpb	$0,-1(%%esi)\n\t"
+     "leal	1(%%eax),%%esi\n\t"
+     "jne	1b\n\t"
+     "xorl	%%eax,%%eax\n"
+     "2:\n\t"
+     "movl	%1,%%ebx"
+     : "=a" (__res), "=m" (__mem)
+     : "c" (__needle_len), "S" (__haystack), "d" (__needle), "1" (__mem)
+     : "cx", "di", "si", "cc");
+  return __res;
+}
+
+__STRING_INLINE char *
+__strstr_g (__const char *__haystack, __const char *__needle)
+{
+  register char *__res;
+  int __mem;
+  __asm__ __volatile__
+    ("movl	%2,%%edi\n\t"
+     "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
+     "movl	%%ebx,%1\n\t"
      "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
      "movl	%%ecx,%%ebx\n"
      "1:\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%edx,%%edi\n\t"
      "movl	%%esi,%%eax\n\t"
      "movl	%%ebx,%%ecx\n\t"
      "repe; cmpsb\n\t"
      "je	2f\n\t"		/* also works for empty string, see above */
-     "xchgl	%%eax,%%esi\n\t"
-     "incl	%%esi\n\t"
-     "cmpb	$0,-1(%%eax)\n\t"
+     "cmpb	$0,-1(%%esi)\n\t"
+     "leal	1(%%eax),%%esi\n\t"
      "jne	1b\n\t"
-     "xorl	%%eax,%%eax\n\t"
+     "xorl	%%eax,%%eax\n"
      "2:\n\t"
-     "popl	%%ebx"
-     : "=a" (__res)
-     : "0" (0), "c" (0xffffffff), "S" (__haystack), "g" (__needle)
+     "movl	%1,%%ebx"
+     : "=a" (__res), "=&m" (__mem)
+     : "0" (0), "c" (0xffffffff), "S" (__haystack), "d" (__needle), "1" (__mem)
      : "cx", "di", "si", "cc");
   return __res;
 }
+# endif
 #else
+# define strstr(haystack, needle) \
+  (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1  \
+		  ? ((needle)[0] == '\0'				      \
+		     ? haystack						      \
+		     : ((needle)[1] == '\0'				      \
+			? strchr (haystack, (needle)[0]) 		      \
+			: __strstr_cg (haystack, needle, strlen (needle))))   \
+		  : __strstr_g (haystack, needle)))
+
 __STRING_INLINE char *
-strstr (__const char *__haystack, __const char *__needle)
+__strstr_cg (__const char *__haystack, __const char __needle[],
+	     size_t __needle_len)
 {
   register char *__res;
   __asm__ __volatile__
-    ("cld\n\t" \
-     "movl	%4,%%edi\n\t"
+    ("cld\n" \
+     "1:\n\t"
+     "movl	%%ebx,%%edi\n\t"
+     "movl	%%esi,%%eax\n\t"
+     "movl	%%edx,%%ecx\n\t"
+     "repe; cmpsb\n\t"
+     "je	2f\n\t"
+     "cmpb	$0,-1(%%esi)\n\t"
+     "leal	1(%%eax),%%esi\n\t"
+     "jne	1b\n\t"
+     "xorl	%%eax,%%eax\n"
+     "2:"
+     : "=a" (__res)
+     : "d" (__needle_len), "S" (__haystack), "b" (__needle)
+     : "cx", "dx", "di", "si", "cc");
+  return __res;
+}
+
+__STRING_INLINE char *
+__strstr_g (__const char *__haystack, __const char *__needle)
+{
+  register char *__res;
+  __asm__ __volatile__
+    ("movl	%1,%%edi\n\t"
+     "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
      "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
      "movl	%%ecx,%%edx\n"
      "1:\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%%ebx,%%edi\n\t"
      "movl	%%esi,%%eax\n\t"
      "movl	%%edx,%%ecx\n\t"
      "repe; cmpsb\n\t"
      "je	2f\n\t"		/* also works for empty string, see above */
-     "xchgl	%%eax,%%esi\n\t"
-     "incl	%%esi\n\t"
-     "cmpb	$0,-1(%%eax)\n\t"
+     "cmpb	$0,-1(%%esi)\n\t"
+     "leal	1(%%eax),%%esi\n\t"
      "jne	1b\n\t"
-     "xorl	%%eax,%%eax\n\t"
+     "xorl	%%eax,%%eax\n"
      "2:"
      : "=a" (__res)
-     : "0" (0), "c" (0xffffffff), "S" (__haystack), "g" (__needle)
+     : "0" (0), "c" (0xffffffff), "S" (__haystack), "b" (__needle)
      : "cx", "dx", "di", "si", "cc");
   return __res;
 }
diff --git a/sysdeps/i386/machine-gmon.h b/sysdeps/i386/machine-gmon.h
index 496a57eb84..e1155989d4 100644
--- a/sysdeps/i386/machine-gmon.h
+++ b/sysdeps/i386/machine-gmon.h
@@ -1,4 +1,4 @@
-/* i386-specific implemetation of profiling support.
+/* i386-specific implementation of profiling support.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -36,6 +36,6 @@ void mcount_internal (u_long frompc, u_long selfpc);
 void mcount_internal (u_long frompc, u_long selfpc)
 
 
-/* Define MCOUNT as empty since we have a the implementation in another
+/* Define MCOUNT as empty since we have the implementation in another
    file.  */
 #define MCOUNT
diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c
index 454c7385af..0cb6578df6 100644
--- a/sysdeps/i386/memset.c
+++ b/sysdeps/i386/memset.c
@@ -23,6 +23,8 @@
 
 #ifdef	__GNUC__
 
+#undef memset
+
 void *
 memset (void *dstpp, int c, size_t len)
 {