]> sourceware.org Git - glibc.git/commitdiff
Update. cvs/libc-ud-970721
authorUlrich Drepper <drepper@redhat.com>
Tue, 22 Jul 1997 00:10:33 +0000 (00:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 22 Jul 1997 00:10:33 +0000 (00:10 +0000)
1997-07-22 01:35  Ulrich Drepper  <drepper@cygnus.com>

* Makerules (+make-deps): Use $(CFLAGS) in run of $(+mkdep) so
that optimizing is also selected for dependency generation.

* configure.in: Add machine description for TI c[34]x.

* inet/Makefile (routines): Remove ntohl and ntohs.
* inet/netinet/in.h: Use optimized version of hton? and ntoh?
for little endian machines.
* sysdeps/alpha/ntohl.s: Removed.
* sysdeps/alpha/ntohs.s: Removed.
* sysdeps/generic/ntohl.c: Removed.
* sysdeps/generic/ntohs.c: Removed.
* sysdeps/generic/htonl.c: Add aliases for ntohl.
* sysdeps/vax/htonl.s: Likewise.
* sysdeps/generic/htons.c: Add aliases for ntohs.
* sysdeps/vax/htons.s: Likewise.
* sysdeps/vax/ntohl.s: Removed.
* sysdeps/vax/ntohs.s: Removed.
* sysdeps/generic/bits/htontoh.h: New file.
* sysdeps/i386/htonl.S: New file.
* sysdeps/i386/htons.S: New file.
* sysdeps/i386/i486/htonl.S: New file.

* sysdeps/i386/fpu/bits/mathinline.h: Correct and optimized compare
macros.

* sysdeps/mips/dl-machine.h: Remove mips64 dependent parts.
* sysdeps/mips/mips64/dl-machine.h: New file.

* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't install
syscall-list.h.

1997-07-12  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

* libc.map: Add missing symbol _obstack.

1997-07-14 08:22  H.J. Lu  <hjl@gnu.ai.mit.edu>

* sysdeps/mips/rtld-parms: New.

* sysdeps/unix/sysv/linux/mips/lxstat.h: Moved to
* sysdeps/unix/sysv/linux/mips/lxstat.c: ...this.

* sysdeps/unix/sysv/linux/mips/sgidef.h: Moved to
* sysdeps/unix/sysv/linux/mips/sgidefs.h: ...this.

* sysdeps/generic/dl-sysdep.c (_start): Change to ENTRY_POINT.

1997-07-17 08:39  H.J. Lu  <hjl@gnu.ai.mit.edu>

* sysdeps/mips/dl-machine.h: Remove extra stuff.

1997-07-06 07:18  Geoff Keating  <geoffk@ozemail.com.au>

* sysdeps/powerpc/bits/endian.h: Handle multiple endianess.

* stdlib/grouping.h: Suppress gcc warning about testing
unsigned char for less-than-zero.
* stdio-common/printf_fp.c: Likewise.
* stdio-common/vfprintf.c: Likewise.

* sysdeps/powerpc/add_n.s: New file.
* sysdeps/powerpc/sub_n.s: New file.
* sysdeps/powerpc/lshift.s: Ported XCOFF->ELF (from GMP).
* sysdeps/powerpc/mul_1.s: Ported XCOFF->ELF (from GMP).
* sysdeps/powerpc/addmul_1.s: Ported XCOFF->ELF (from GMP).
* sysdeps/powerpc/submul_1.s: Ported XCOFF->ELF (from GMP).
* sysdeps/powerpc/rshift.s: Ported XCOFF->ELF (from GMP).

* math/libm-test.c (cos_test, sin_test, sincos_test): Use
precomputed pi/6 rather than having gcc calculate it, otherwise
tests give inaccurate result due to inaccurate input.
* math/libm.map: Add __fe_*_env constants to list of exported
symbols.

* sysdeps/libm-ieee754/s_isinf.c: Simplify, make faster.
* sysdeps/libm-ieee754/s_isinff.c: Simplify, make faster.
* sysdeps/libm-ieee754/s_atan2f.c: Correct value of pi to be correct
round-to-nearest value.

* sysdeps/libm-ieee754/e_log.c: Make sure exceptions are raised.
* sysdeps/libm-ieee754/e_log10.c: Likewise.
* sysdeps/libm-ieee754/e_log10f.c: Likewise.
* sysdeps/libm-ieee754/e_logf.c: Likewise.
* sysdeps/libm-ieee754/s_log1p.c: Likewise. Also use correct -Inf.
* sysdeps/libm-ieee754/s_log1pf.c: Likewise. Also use correct -Inf.
* sysdeps/libm-ieee754/s_log2.c: Likewise.
* sysdeps/libm-ieee754/s_log2f.c: Likewise.

1997-07-15 21:54  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

* nis/nss_compat/compat-grp.c: Fix "buffer to small" problems
and memory leaks.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/nss_nis/nis-alias.c: Likewise.
* nis/nss_nis/nis-ethers.c: Likewise.
* nis/nss_nis/nis-grp.c: Likewise.
* nis/nss_nis/nis-hosts.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* nis/nss_nis/nis-proto.c: Likewise.
* nis/nss_nis/nis-pwd.c: Likewise.
* nis/nss_nis/nis-rpc.c: Likewise.
* nis/nss_nis/nis-service.c: Likewise.
* nis/nss_nis/nis-spwd.c: Likewise.
* nis/nss_nisplus-alias.c: Likewise.
* nis/nss_nisplus-ethers.c: Likewise.
* nis/nss_nisplus-grp.c: Likewise.
* nis/nss_nisplus-hosts.c: Likewise.
* nis/nss_nisplus-netgrp.c: Likewise.
* nis/nss_nisplus-network.c: Likewise.
* nis/nss_nisplus-proto.c: Likewise.
* nis/nss_nisplus-pwd.c: Likewise.
* nis/nss_nisplus-rpc.c: Likewise.
* nis/nss_nisplus-service.c: Likewise.
* nis/nss_nisplus-spwd.c: Likewise.

* nis/nss_nisplus-parse.c: If buffer to small, give -1 back.

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

* sysdeps/m68k/dl-machine.h (elf_machine_rela): Mention program
name in warning message.
* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/sparc/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/sparc64/dl-machine.h (elf_machine_rela): Likewise.

* sysdeps/i386/dl-machine.h (elf_machine_rel): Print program name
first.

1997-07-20 19:33  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

* libc.map: Add _null_auth and _seterr_reply.

* sunrpc/clnt_udp.c (clntudp_call): If xargs is NULL, don't encode it.

79 files changed:
ChangeLog
ChangeLog.6
Makerules
config.guess
config.sub
configure
configure.in
inet/Makefile
inet/netinet/in.h
libc.map
math/libm-test.c
math/libm.map
nis/nss_compat/compat-grp.c
nis/nss_compat/compat-pwd.c
nis/nss_compat/compat-spwd.c
nis/nss_nis/nis-alias.c
nis/nss_nis/nis-ethers.c
nis/nss_nis/nis-grp.c
nis/nss_nis/nis-hosts.c
nis/nss_nis/nis-network.c
nis/nss_nis/nis-proto.c
nis/nss_nis/nis-pwd.c
nis/nss_nis/nis-rpc.c
nis/nss_nis/nis-service.c
nis/nss_nis/nis-spwd.c
nis/nss_nisplus/nisplus-alias.c
nis/nss_nisplus/nisplus-ethers.c
nis/nss_nisplus/nisplus-grp.c
nis/nss_nisplus/nisplus-hosts.c
nis/nss_nisplus/nisplus-netgrp.c
nis/nss_nisplus/nisplus-network.c
nis/nss_nisplus/nisplus-parser.c
nis/nss_nisplus/nisplus-proto.c
nis/nss_nisplus/nisplus-pwd.c
nis/nss_nisplus/nisplus-rpc.c
nis/nss_nisplus/nisplus-service.c
nis/nss_nisplus/nisplus-spwd.c
stdio-common/printf_fp.c
stdio-common/vfprintf.c
stdlib/grouping.h
sunrpc/clnt_udp.c
sysdeps/alpha/ntohl.s [deleted file]
sysdeps/alpha/ntohs.s [deleted file]
sysdeps/generic/bits/htontoh.h [moved from sysdeps/generic/ntohs.c with 79% similarity]
sysdeps/generic/dl-sysdep.c
sysdeps/generic/htonl.c
sysdeps/generic/htons.c
sysdeps/i386/bits/htontoh.h [new file with mode: 0644]
sysdeps/i386/dl-machine.h
sysdeps/i386/fpu/bits/mathinline.h
sysdeps/i386/htonl.S [new file with mode: 0644]
sysdeps/i386/htons.S [new file with mode: 0644]
sysdeps/i386/i486/htonl.S [moved from sysdeps/generic/ntohl.c with 69% similarity]
sysdeps/libm-ieee754/e_atan2f.c
sysdeps/libm-ieee754/e_log.c
sysdeps/libm-ieee754/e_log10.c
sysdeps/libm-ieee754/e_log10f.c
sysdeps/libm-ieee754/e_logf.c
sysdeps/libm-ieee754/s_isinf.c
sysdeps/libm-ieee754/s_isinff.c
sysdeps/libm-ieee754/s_log1p.c
sysdeps/libm-ieee754/s_log1pf.c
sysdeps/libm-ieee754/s_log2.c
sysdeps/libm-ieee754/s_log2f.c
sysdeps/m68k/dl-machine.h
sysdeps/mips/dl-machine.h
sysdeps/mips/mips64/dl-machine.h [new file with mode: 0644]
sysdeps/mips/rtld-parms [new file with mode: 0644]
sysdeps/powerpc/bits/endian.h
sysdeps/powerpc/dl-machine.h
sysdeps/sparc/dl-machine.h
sysdeps/sparc64/dl-machine.h
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/mips/lxstat.c [moved from sysdeps/unix/sysv/linux/mips/lxstat.h with 100% similarity]
sysdeps/unix/sysv/linux/mips/sgidefs.h [moved from sysdeps/unix/sysv/linux/mips/sgidef.h with 100% similarity]
sysdeps/vax/htonl.s
sysdeps/vax/htons.s
sysdeps/vax/ntohl.s [deleted file]
sysdeps/vax/ntohs.s [deleted file]

index a446cc5391ee953a47a853dae06ddde149249ac7..0e0750c485a199b6c4ab6e39b6238e947e0116f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,141 @@
+1997-07-22 01:35  Ulrich Drepper  <drepper@cygnus.com>
+
+       * Makerules (+make-deps): Use $(CFLAGS) in run of $(+mkdep) so
+       that optimizing is also selected for dependency generation.
+
+       * configure.in: Add machine description for TI c[34]x.
+
+       * inet/Makefile (routines): Remove ntohl and ntohs.
+       * inet/netinet/in.h: Use optimized version of hton? and ntoh?
+       for little endian machines.
+       * sysdeps/alpha/ntohl.s: Removed.
+       * sysdeps/alpha/ntohs.s: Removed.
+       * sysdeps/generic/ntohl.c: Removed.
+       * sysdeps/generic/ntohs.c: Removed.
+       * sysdeps/generic/htonl.c: Add aliases for ntohl.
+       * sysdeps/vax/htonl.s: Likewise.
+       * sysdeps/generic/htons.c: Add aliases for ntohs.
+       * sysdeps/vax/htons.s: Likewise.
+       * sysdeps/vax/ntohl.s: Removed.
+       * sysdeps/vax/ntohs.s: Removed.
+       * sysdeps/generic/bits/htontoh.h: New file.
+       * sysdeps/i386/htonl.S: New file.
+       * sysdeps/i386/htons.S: New file.
+       * sysdeps/i386/i486/htonl.S: New file.
+
+       * sysdeps/i386/fpu/bits/mathinline.h: Correct and optimized compare
+       macros.
+
+       * sysdeps/mips/dl-machine.h: Remove mips64 dependent parts.
+       * sysdeps/mips/mips64/dl-machine.h: New file.
+
+       * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't install
+       syscall-list.h.
+
+1997-07-12  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * libc.map: Add missing symbol _obstack.
+
+1997-07-14 08:22  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+       * sysdeps/mips/rtld-parms: New.
+
+       * sysdeps/unix/sysv/linux/mips/lxstat.h: Moved to
+       * sysdeps/unix/sysv/linux/mips/lxstat.c: ...this.
+
+       * sysdeps/unix/sysv/linux/mips/sgidef.h: Moved to
+       * sysdeps/unix/sysv/linux/mips/sgidefs.h: ...this.
+
+       * sysdeps/generic/dl-sysdep.c (_start): Change to ENTRY_POINT.
+
+1997-07-17 08:39  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+       * sysdeps/mips/dl-machine.h: Remove extra stuff.
+
+1997-07-06 07:18  Geoff Keating  <geoffk@ozemail.com.au>
+
+       * sysdeps/powerpc/bits/endian.h: Handle multiple endianess.
+
+       * stdlib/grouping.h: Suppress gcc warning about testing
+       unsigned char for less-than-zero.
+       * stdio-common/printf_fp.c: Likewise.
+       * stdio-common/vfprintf.c: Likewise.
+
+       * sysdeps/powerpc/add_n.s: New file.
+       * sysdeps/powerpc/sub_n.s: New file.
+       * sysdeps/powerpc/lshift.s: Ported XCOFF->ELF (from GMP).
+       * sysdeps/powerpc/mul_1.s: Ported XCOFF->ELF (from GMP).
+       * sysdeps/powerpc/addmul_1.s: Ported XCOFF->ELF (from GMP).
+       * sysdeps/powerpc/submul_1.s: Ported XCOFF->ELF (from GMP).
+       * sysdeps/powerpc/rshift.s: Ported XCOFF->ELF (from GMP).
+
+       * math/libm-test.c (cos_test, sin_test, sincos_test): Use
+       precomputed pi/6 rather than having gcc calculate it, otherwise
+       tests give inaccurate result due to inaccurate input.
+       * math/libm.map: Add __fe_*_env constants to list of exported
+       symbols.
+
+       * sysdeps/libm-ieee754/s_isinf.c: Simplify, make faster.
+       * sysdeps/libm-ieee754/s_isinff.c: Simplify, make faster.
+       * sysdeps/libm-ieee754/s_atan2f.c: Correct value of pi to be correct
+       round-to-nearest value.
+
+       * sysdeps/libm-ieee754/e_log.c: Make sure exceptions are raised.
+       * sysdeps/libm-ieee754/e_log10.c: Likewise.
+       * sysdeps/libm-ieee754/e_log10f.c: Likewise.
+       * sysdeps/libm-ieee754/e_logf.c: Likewise.
+       * sysdeps/libm-ieee754/s_log1p.c: Likewise. Also use correct -Inf.
+       * sysdeps/libm-ieee754/s_log1pf.c: Likewise. Also use correct -Inf.
+       * sysdeps/libm-ieee754/s_log2.c: Likewise.
+       * sysdeps/libm-ieee754/s_log2f.c: Likewise.
+
+1997-07-15 21:54  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+       * nis/nss_compat/compat-grp.c: Fix "buffer to small" problems
+       and memory leaks.
+       * nis/nss_compat/compat-pwd.c: Likewise.
+       * nis/nss_compat/compat-spwd.c: Likewise.
+       * nis/nss_nis/nis-alias.c: Likewise.
+       * nis/nss_nis/nis-ethers.c: Likewise.
+       * nis/nss_nis/nis-grp.c: Likewise.
+       * nis/nss_nis/nis-hosts.c: Likewise.
+       * nis/nss_nis/nis-network.c: Likewise.
+       * nis/nss_nis/nis-proto.c: Likewise.
+       * nis/nss_nis/nis-pwd.c: Likewise.
+       * nis/nss_nis/nis-rpc.c: Likewise.
+       * nis/nss_nis/nis-service.c: Likewise.
+       * nis/nss_nis/nis-spwd.c: Likewise.
+       * nis/nss_nisplus-alias.c: Likewise.
+       * nis/nss_nisplus-ethers.c: Likewise.
+       * nis/nss_nisplus-grp.c: Likewise.
+       * nis/nss_nisplus-hosts.c: Likewise.
+       * nis/nss_nisplus-netgrp.c: Likewise.
+       * nis/nss_nisplus-network.c: Likewise.
+       * nis/nss_nisplus-proto.c: Likewise.
+       * nis/nss_nisplus-pwd.c: Likewise.
+       * nis/nss_nisplus-rpc.c: Likewise.
+       * nis/nss_nisplus-service.c: Likewise.
+       * nis/nss_nisplus-spwd.c: Likewise.
+
+       * nis/nss_nisplus-parse.c: If buffer to small, give -1 back.
+
+1997-07-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * sysdeps/m68k/dl-machine.h (elf_machine_rela): Mention program
+       name in warning message.
+       * sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.
+       * sysdeps/sparc/dl-machine.h (elf_machine_rela): Likewise.
+       * sysdeps/sparc64/dl-machine.h (elf_machine_rela): Likewise.
+
+       * sysdeps/i386/dl-machine.h (elf_machine_rel): Print program name
+       first.
+
+1997-07-20 19:33  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+       * libc.map: Add _null_auth and _seterr_reply.
+
+       * sunrpc/clnt_udp.c (clntudp_call): If xargs is NULL, don't encode it.
+
 1997-07-19 22:53  Ulrich Drepper  <drepper@cygnus.com>
 
        * time/africa: Update from tzdata1997g.
index e53adb1f17fb367e60042152e01b5db8f9e566c0..5858bd04930a42957107f3b52dd55a2e6cd154c8 100644 (file)
@@ -217,7 +217,7 @@ Thu Jan 23 04:06:42 1997  Ulrich Drepper  <drepper@cygnus.com>
        (sysdep_headers): Add sys/kernel_termios.h.
        * sysdeps/unix/sysv/linux/kernel_termios.h: Moved to...
        * sysdeps/unix/sysv/linux/sys/kernel_termios.h: ...here.
-       * sysdeps/unix/sysv/linux/sys/tcgetattr.c: Use __kernel_termios and
+       * sysdeps/unix/sysv/linux/tcgetattr.c: Use __kernel_termios and
        __KERNEL_NCCS instead of kernel_termios and KERNEL_NCCS resp.
 
        * sysdeps/unix/sysv/linux/alpha/ioctls.h: New file.
index fb9eebe5a72b2c923aba7ab88b66ffac23f2fea3..ba0116b0ac2f7e14787467d6919d9f6ffe2c2aba 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -313,7 +313,7 @@ S-CPPFLAGS = $(asm-CPPFLAGS)
 define +make-deps
 $(make-target-directory)
 -@rm -f $@
-$(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
+$(+mkdep) $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
 sed \
 -e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
 $(sed-remove-objpfx) > $(@:.d=.T)
index da4358892ba77746e120d3d589821ff7fe7b0e84..a73a8d93c0c0177b3d6b81392bbf4dbf6fed54be 100755 (executable)
@@ -56,7 +56,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+       cat <<EOF >dummy.s
+       .globl main
+       .ent main
+main:
+       .frame \$30,0,\$26,0
+       .prologue 0
+       .long 0x47e03d84
+       cmoveq \$4,0,\$3
+       addl \$3,\$31,\$0
+       ret \$31,(\$26),1
+       .end main
+EOF
+       ${CC-cc} dummy.s -o dummy 2>/dev/null
+       if test "$?" = 0 ; then
+               ./dummy
+               case "$?" in
+                       1)
+                               UNAME_MACHINE="alphaev5"
+                               ;;
+                       2)
+                               UNAME_MACHINE="alphaev56"
+                               ;;
+               esac
+       fi
+       rm -f dummy.s dummy
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
        exit 0 ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
@@ -457,7 +482,32 @@ EOF
        esac
 
        if test "${UNAME_MACHINE}" = "alpha" ; then
-         echo alpha-unknown-linux-gnu ; exit 0
+               sed 's/^        //'  <<EOF >dummy.s
+               .globl main
+               .ent main
+       main:
+               .frame \$30,0,\$26,0
+               .prologue 0
+               .long 0x47e03d84
+               cmoveq \$4,0,\$3
+               addl \$3,\$31,\$0
+               ret \$31,(\$26),1
+               .end main
+EOF
+               ${CC-cc} dummy.s -o dummy 2>/dev/null
+               if test "$?" = 0 ; then
+                       ./dummy
+                       case "$?" in
+                               1)
+                                       UNAME_MACHINE="alphaev5"
+                               ;;      
+                       2)      
+                                       UNAME_MACHINE="alphaev56"
+                               ;;      
+               esac    
+         fi    
+         rm -f dummy.s dummy
+         echo ${UNAME_MACHINE}-unknown-linux-gnu ; exit 0
        elif test "${UNAME_MACHINE}" = "mips" ; then
          cat >dummy.c <<EOF
 main(argc, argv)
index 3caaa0c08841d9add66639f75ecbff2a89d9b9f8..e3105a7fe5bce59d6456ea4bdbf2e308beadd9e9 100755 (executable)
@@ -152,9 +152,9 @@ case $basic_machine in
        tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
                | arme[lb] | pyramid | mn10200 | mn10300 \
                | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
-               | alpha | we32k | ns16k | clipper | i370 | sh \
-               | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
-               | pdp11 | mips64el | mips64orion | mips64orionel \
+               | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+               | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+               | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
                | sparc | sparclet | sparclite | sparc64)
                basic_machine=$basic_machine-unknown
                ;;
@@ -172,11 +172,13 @@ case $basic_machine in
        # Recognize the basic CPU types with company name.
        vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
              | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
-             | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
-             | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
-             | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
-             | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
-             | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+             | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+             | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+             | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
+             | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+             | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+             | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+             | sparc64-* | mips64-* | mipsel-* \
              | mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
                ;;
        # Recognize the various machine names and aliases which stand
index 1380a4904e83765c26272d550bc8e25e3e02ae17..e2f2b78b1cf35bf35b7759738f90b554ace11161 100755 (executable)
--- a/configure
+++ b/configure
@@ -816,6 +816,8 @@ case "$machine" in
 a29k | am29000)        base_machine=a29k machine=a29k ;;
 alpha*)                base_machine=alpha machine=alpha/$machine ;;
 arm*)          base_machine=arm machine=arm/$machine ;;
+c3[012])       base_machine=cx0 machine=cx0/c30 ;;
+c4[04])                base_machine=cx0 machine=cx0/c40 ;;
 hppa*)         base_machine=hppa machine=hppa/$machine ;;
 i[3456]86)     base_machine=i386 machine=i386/$machine ;;
 m680?0)                base_machine=m68k machine=m68k/$machine ;;
@@ -834,7 +836,7 @@ esac
 # This can take a while to compute.
 sysdep_dir=$srcdir/sysdeps
 echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
-echo "configure:838: checking sysdep dirs" >&5
+echo "configure:840: checking sysdep dirs" >&5
 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
 
@@ -1035,7 +1037,7 @@ echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1039: checking for a BSD compatible install" >&5
+echo "configure:1041: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1089,7 +1091,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
   INSTALL='$(..)./install-sh -c'
 fi
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1093: checking whether ln -s works" >&5
+echo "configure:1095: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1114,7 +1116,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1118: checking for $ac_word" >&5
+echo "configure:1120: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1147,7 +1149,7 @@ test -n "$MSGFMT" || MSGFMT=":"
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1151: checking for $ac_word" >&5
+echo "configure:1153: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1176,7 +1178,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1180: checking for $ac_word" >&5
+echo "configure:1182: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1224,7 +1226,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1228: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1230: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1234,11 +1236,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1238 "configure"
+#line 1240 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1261,13 +1263,13 @@ else
  cross_linkable=yes
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1265: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1267: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1271: checking whether we are using GNU C" >&5
+echo "configure:1273: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1276,7 +1278,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1293,7 +1295,7 @@ if test $ac_cv_prog_gcc = yes; then
   yes;
 #endif
 EOF
-  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
     if test -z "$CFLAGS"; then
       CFLAGS="-g -O2"
     fi
@@ -1305,7 +1307,7 @@ else
 fi
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1309: checking build system type" >&5
+echo "configure:1311: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1328,7 +1330,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1332: checking for $ac_word" >&5
+echo "configure:1334: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1359,7 +1361,7 @@ done
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1363: checking how to run the C preprocessor" >&5
+echo "configure:1365: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1374,13 +1376,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1378 "configure"
+#line 1380 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1391,13 +1393,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1395 "configure"
+#line 1397 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1403: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1428,7 +1430,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1432: checking for $ac_word" >&5
+echo "configure:1434: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1459,7 +1461,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1463: checking for $ac_word" >&5
+echo "configure:1465: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1490,7 +1492,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1494: checking for $ac_word" >&5
+echo "configure:1496: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1525,7 +1527,7 @@ fi
 # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1529: checking for $ac_word" >&5
+echo "configure:1531: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1566,7 +1568,7 @@ if test "$BASH" = no; then
   # Extract the first word of "ksh", so it can be a program name with args.
 set dummy ksh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1570: checking for $ac_word" >&5
+echo "configure:1572: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1608,7 +1610,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1612: checking for signed size_t type" >&5
+echo "configure:1614: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1632,12 +1634,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1636: checking for libc-friendly stddef.h" >&5
+echo "configure:1638: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1641 "configure"
+#line 1643 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1652,7 +1654,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1671,7 +1673,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1675: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1677: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1694,7 +1696,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1698: checking for assembler global-symbol directive" >&5
+echo "configure:1700: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1724,7 +1726,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1728: checking for .set assembler directive" >&5
+echo "configure:1730: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1758,7 +1760,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1762: checking for .symver assembler directive" >&5
+echo "configure:1764: checking for .symver assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1777,7 +1779,7 @@ fi
 
 echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1781: checking for ld --version-script" >&5
+echo "configure:1783: checking for ld --version-script" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1796,7 +1798,7 @@ EOF
     if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
                                        -nostartfiles -nostdlib
                                        -Wl,--version-script,conftest.map
-                      1>&5'; { (eval echo configure:1800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+                      1>&5'; { (eval echo configure:1802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -1826,7 +1828,7 @@ fi
 
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1830: checking for .previous assembler directive" >&5
+echo "configure:1832: checking for .previous assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1834,7 +1836,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1850,7 +1852,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1854: checking for .popsection assembler directive" >&5
+echo "configure:1856: checking for .popsection assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1858,7 +1860,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1878,12 +1880,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1882: checking for .init and .fini sections" >&5
+echo "configure:1884: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1887 "configure"
+#line 1889 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1892,7 +1894,7 @@ asm (".section .init");
                                    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1917,19 +1919,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1921: checking for _ prefix on C symbol names" >&5
+echo "configure:1923: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1926 "configure"
+#line 1928 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1956,7 +1958,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1960: checking for assembler .weak directive" >&5
+echo "configure:1962: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1979,7 +1981,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1983: checking for assembler .weakext directive" >&5
+echo "configure:1985: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2016,7 +2018,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2020: checking for ld --no-whole-archive" >&5
+echo "configure:2022: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2027,7 +2029,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
                            -nostdlib -nostartfiles -Wl,--no-whole-archive
-                           -o conftest conftest.c 1>&5'; { (eval echo configure:2031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+                           -o conftest conftest.c 1>&5'; { (eval echo configure:2033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -2038,7 +2040,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:2042: checking for gcc -fno-exceptions" >&5
+echo "configure:2044: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2049,7 +2051,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
                            -nostdlib -nostartfiles -fno-exceptions
-                           -o conftest conftest.c 1>&5'; { (eval echo configure:2053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+                           -o conftest conftest.c 1>&5'; { (eval echo configure:2055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -2101,7 +2103,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2105: checking OS release for uname" >&5
+echo "configure:2107: checking OS release for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2123,7 +2125,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
   uname_release="$libc_cv_uname_release"
 
   echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2127: checking OS version for uname" >&5
+echo "configure:2129: checking OS version for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2145,7 +2147,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2149: checking stdio selection" >&5
+echo "configure:2151: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
index 3f5a7542505289f3168b3bb2a48b4f93eea77789..ba8b4134521f5684729249811477b765f8aeceda 100644 (file)
@@ -149,6 +149,8 @@ case "$machine" in
 a29k | am29000)        base_machine=a29k machine=a29k ;;
 alpha*)                base_machine=alpha machine=alpha/$machine ;;
 arm*)          base_machine=arm machine=arm/$machine ;;
+c3[012])       base_machine=cx0 machine=cx0/c30 ;;
+c4[04])                base_machine=cx0 machine=cx0/c40 ;;
 hppa*)         base_machine=hppa machine=hppa/$machine ;;
 i[3456]86)     base_machine=i386 machine=i386/$machine ;;
 m680?0)                base_machine=m68k machine=m68k/$machine ;;
index 847d9944787e12d62bdaf4d4d6d85d0526bb2a22..47570f131c02682682865994b68a46473e4accd2 100644 (file)
@@ -27,7 +27,7 @@ headers       := netinet/ether.h netinet/in.h netinet/if_ether.h \
 
 distribute := netgroup.h
 
-routines := ntohl ntohs htonl htons            \
+routines := htonl htons                \
            inet_lnaof inet_mkadr       \
            inet_netof inet_ntoa inet_net herrno \
            gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
index 33f88064e149a14c1dd0da1da3e6f46a1b8526d2..ac0d16728706448ab182f9ce65b32393694b4cdc 100644 (file)
@@ -210,9 +210,13 @@ struct ipv6_mreq
    this was a short-sighted decision since on different systems the types
    may have different representations but the values are always the same.  */
 
+extern u_int32_t __ntohl __P ((u_int32_t __netlong));
 extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t __ntohs __P ((u_int16_t __netshort));
 extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t __htonl __P ((u_int32_t __hostlong));
 extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t __htons __P ((u_int16_t __hostshort));
 extern u_int16_t htons __P ((u_int16_t __hostshort));
 
 #include <endian.h>
@@ -220,10 +224,33 @@ extern u_int16_t htons __P ((u_int16_t __hostshort));
 #if __BYTE_ORDER == __BIG_ENDIAN
 /* The host byte order is the same as network byte order,
    so these functions are all just identity.  */
-#define        ntohl(x)        (x)
-#define        ntohs(x)        (x)
-#define        htonl(x)        (x)
-#define        htons(x)        (x)
+# define ntohl(x)      (x)
+# define ntohs(x)      (x)
+# define htonl(x)      (x)
+# define htons(x)      (x)
+#else
+# if __BYTE_ORDER == __LITTLE_ENDIAN && defined __OPTIMIZE__
+#  define ntohl(x)     (__builtin_constant_p (x)                         \
+                        ? __constant_htontohl (x) : __ntohl (x))
+#  define ntohs(x)     (__builtin_constant_p (x)                         \
+                        ? __constant_htontohs (x) : __ntohs (x))
+#  define htonl(x)     (__builtin_constant_p (x)                         \
+                        ? __constant_htontohl (x) : __htonl (x))
+#  define htons(x)     (__builtin_constant_p (x)                         \
+                        ? __constant_htontohl (x) : __htonl (x))
+
+#  define __constant_htontohl(x) \
+       ((((x) & 0xff000000) >> 24) | \
+        (((x) & 0x00ff0000) >>  8) | \
+        (((x) & 0x0000ff00) <<  8) | \
+        (((x) & 0x000000ff) << 24))
+#  define __constant_htontohs(x) \
+       ((((x) & 0x0000ff00) >>  8) | \
+        (((x) & 0x000000ff) << 8))
+
+/* Now get machine dependent optimized versions for the real work.  */
+#  include <bits/htontoh.h>
+# endif
 #endif
 
 #define IN6_IS_ADDR_UNSPECIFIED(a) \
index fec1c49832b6f9dd43e3862dd7f006ba2ff07fc3..b23a8ff5d308a82fb0060bfd3da5e5cd32cb8b54 100644 (file)
--- a/libc.map
+++ b/libc.map
@@ -11,6 +11,7 @@ GLIBC_2.0 {
     _nl_current_LC_COLLATE; __collate_element_hash;
     __collate_element_strings; __collate_symbol_classes;
     __collate_symbol_hash; __collate_symbol_strings;
+    _obstack;
 
     # helper functions
     __errno_location; __libc_init_first; __h_errno_location;
@@ -81,7 +82,7 @@ GLIBC_2.0 {
     _IO_str_underflow; _IO_str_init_static; _IO_str_init_readonly;
     _IO_str_seekoff; _IO_str_pbackfail; _IO_list_all; _IO_file_jumps;
     _IO_peekc_locked;
-    _rpc_dtablesize;
+    _rpc_dtablesize; _null_auth; _seterr_reply;
 
     # all functions and variables in the normal name space
     a*; b*; c*; d*; e*; f*; g*; h*; i*; j*; k*; l*; m*;
index c2103d4a8b1c17a66fd758c7d04f42f9b7cc8c7e..72c09a7b8e336ce46d1d9cf18d01ce6e284bc73d 100644 (file)
 #define PRINT 1
 #define NO_PRINT 0
 
+/* Various constants (we must supply them precalculated for accuracy).  */
+#define M_PI_6  .52359877559829887308L
 
 static int noErrors;
 
@@ -1058,7 +1060,7 @@ cos_test (void)
                   FUNC(cos) (minus_infty),
                   INVALID_EXCEPTION);
 
-  check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI / 3.0),
+  check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6 * 2.0),
             0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
   check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
             0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
@@ -1711,8 +1713,8 @@ sin_test (void)
                   FUNC(sin) (minus_infty),
                   INVALID_EXCEPTION);
 
-  check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI / 6.0), 0.5,
-            CHOOSE (4e-18L, 0, 0));
+  check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6),
+            0.5,CHOOSE (4e-18L, 0, 0));
   check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
 }
 
@@ -1772,11 +1774,11 @@ sincos_test (void)
   check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
             CHOOSE (1e-18L, 1e-16, 1e-7));
 
-  FUNC(sincos) (M_PI / 6.0, &sin_res, &cos_res);
+  FUNC(sincos) (M_PI_6, &sin_res, &cos_res);
   check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5,
             CHOOSE (5e-18L, 0, 0));
 
-  FUNC(sincos) (M_PI / 3.0, &sin_res, &cos_res);
+  FUNC(sincos) (M_PI_6*2.0, &sin_res, &cos_res);
   check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
             CHOOSE (5e-18L, 1e-15, 1e-7));
 
index aff0ccd73fc78d2deeb418e5c5f5ae15836183f4..2a1aa6cfbeccb586abe0816d697972021e4ec6fa 100644 (file)
@@ -98,7 +98,6 @@ GLIBC_2.0 {
     fesetenv; fesetexceptflag; fesetround;
     fetestexcept; feupdateenv;
 
-
     # global variables
     _LIB_VERSION; signgam;
 
@@ -109,6 +108,9 @@ GLIBC_2.0 {
 
     __log1p;
 
+    # symbols used in macros from sysdeps/powerpc/bits/fenv.h
+    __fe_dfl_env; __fe_enabled_env; __fe_nonieee_env; __fe_nomask_env;
+
   local:
     *;
 };
index 59165ea590bfa6a5e21037e995532732e7147218..9726784b2de08d45bcdcdc2c846b7d8239f468bb 100644 (file)
@@ -218,6 +218,10 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 
   do
     {
+      char *save_oldkey;
+      int save_oldlen;
+      bool_t save_nis_first;
+
       if (ent->nis_first)
        {
          if (yp_first (domain, "group.byname", &outkey, &outkeylen,
@@ -226,7 +230,9 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
              ent->nis = 0;
              return NSS_STATUS_UNAVAIL;
            }
-
+         save_oldkey = ent->oldkey;
+         save_oldlen = ent->oldkeylen;
+         save_nis_first = TRUE;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
          ent->nis_first = FALSE;
@@ -241,7 +247,9 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
              return NSS_STATUS_NOTFOUND;
            }
 
-         free (ent->oldkey);
+         save_oldkey = ent->oldkey;
+         save_oldlen = ent->oldkeylen;
+         save_nis_first = FALSE;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
        }
@@ -255,8 +263,21 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
       while (isspace (*p))
        ++p;
 
-      parse_res = _nss_files_parse_grent (p, result, data, buflen);
-
+      if ((parse_res = _nss_files_parse_grent (p, result, data, buflen)) == -1)
+       {
+         free (ent->oldkey);
+         ent->oldkey = save_oldkey;
+         ent->oldkeylen = save_oldlen;
+         ent->nis_first = save_nis_first;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!save_nis_first)
+           free (save_oldkey);
+       }
+      
       if (parse_res &&
          in_blacklist (result->gr_name, strlen (result->gr_name), ent))
        parse_res = 0; /* if result->gr_name in blacklist,search next entry */
@@ -274,8 +295,13 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
 
   do
     {
+      nis_result *save_oldres;
+      bool_t save_nis_first;
+      
       if (ent->nis_first)
         {
+         save_oldres = ent->result;
+         save_nis_first = TRUE;
           ent->result = nis_first_entry(grptable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -288,8 +314,9 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
         {
           nis_result *res;
 
+         save_oldres = ent->result;
+         save_nis_first = FALSE;
           res = nis_next_entry(grptable, &ent->result->cookie);
-          nis_freeresult (ent->result);
           ent->result = res;
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -297,8 +324,21 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
              return niserr2nss (ent->result->status);
             }
         }
-      parse_res = _nss_nisplus_parse_grent (ent->result, 0, result, buffer,
-                                            buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (ent->result, 0, result, 
+                                                buffer, buflen)) == -1)
+       {
+         nis_freeresult (ent->result);
+         ent->result = save_oldres;
+         ent->nis_first = save_nis_first;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!save_nis_first)
+           nis_freeresult (save_oldres);
+       }
+
       if (parse_res &&
           in_blacklist (result->gr_name, strlen (result->gr_name), ent))
         parse_res = 0; /* if result->gr_name in blacklist,search next entry */
@@ -330,7 +370,13 @@ getgrent_next_file_plusgroup (struct group *result, char *buffer,
           nis_freeresult (res);
           return status;
         }
-      parse_res = _nss_nisplus_parse_grent (res, 0, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (res, 0, result, buffer, 
+                                                buflen)) == -1)
+       {
+         __set_errno (ERANGE);
+         nis_freeresult (res);
+         return NSS_STATUS_TRYAGAIN;
+       }
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -350,7 +396,11 @@ getgrent_next_file_plusgroup (struct group *result, char *buffer,
       free (outval);
       while (isspace (*p))
         p++;
-      parse_res = _nss_files_parse_grent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_grent (p, result, data, buflen)) == -1)
+       {
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
     }
 
   if (parse_res)
@@ -368,13 +418,24 @@ getgrent_next_file (struct group *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
+      int parse_res = 0;
       char *p;
 
       do
        {
+         fgetpos (ent->stream, &pos);
          p = fgets (buffer, buflen, ent->stream);
          if (p == NULL)
-           return NSS_STATUS_NOTFOUND;
+           {
+             if (feof (ent->stream))
+               return NSS_STATUS_NOTFOUND;
+             else
+               {
+                 __set_errno (ERANGE);
+                 return NSS_STATUS_TRYAGAIN;
+               }
+           }
 
          /* Terminate the line for any case.  */
          buffer[buflen - 1] = '\0';
@@ -383,11 +444,18 @@ getgrent_next_file (struct group *result, ent_t *ent,
          while (isspace (*p))
            ++p;
        }
-      /* Ignore empty and comment lines.  */
-      while (*p == '\0' || *p == '#' ||
+      while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-            !_nss_files_parse_grent (p, result, data, buflen));
+            !(parse_res = _nss_files_parse_grent (p, result, data, buflen)));
+
+      if (parse_res == -1)
+       {
+         /* The parser ran out of space.  */
+         fsetpos (ent->stream, &pos);
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
 
       if (result->gr_name[0] != '+' && result->gr_name[0] != '-')
        /* This is a real entry.  */
index 0d0f2a6c331ba2f88f3790c43b5725a8ecdd3252..af1267922c769a5ab7237d141725404c32d6c88a 100644 (file)
@@ -272,6 +272,9 @@ internal_endpwent (ent_t *ent)
       ent->stream = NULL;
     }
 
+  if (ent->netgroup)
+    __internal_endnetgrent (&ent->netgrdata);
+  
   ent->nis = ent->first = ent->netgroup = 0;
 
   if (ent->oldkey != NULL)
@@ -303,9 +306,6 @@ _nss_compat_endpwent (void)
 
   __libc_lock_lock (lock);
 
-  if (ext_ent.netgroup)
-    __internal_endnetgrent (&ext_ent.netgrdata);
-
   result = internal_endpwent (&ext_ent);
 
   __libc_lock_unlock (lock);
@@ -339,6 +339,10 @@ getpwent_next_nis_netgr (struct passwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+      int parse_res;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
                                         &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -372,7 +376,13 @@ getpwent_next_nis_netgr (struct passwd *result, ent_t *ent, char *group,
       while (isspace (*p))
        p++;
       free (outval);
-      if (_nss_files_parse_pwent (p, result, data, buflen))
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+       {
+         ent->netgrdata.cursor = saved_cursor;
+         return NSS_STATUS_TRYAGAIN;
+       }
+
+      if (parse_res)
        {
          copy_pwd_changes (result, &ent->pwd, p2, p2len);
          break;
@@ -410,6 +420,9 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
                                         &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -419,13 +432,13 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
          give_pwd_free (&ent->pwd);
          return NSS_STATUS_RETURN;
        }
-
+      
       if (user == NULL || user[0] == '-')
        continue;
-
+      
       if (domain != NULL && strcmp (ypdomain, domain) != 0)
        continue;
-
+      
       p2len = pwd_need_buflen (&ent->pwd);
       if (p2len > buflen)
        {
@@ -444,7 +457,13 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
          nis_freeresult (nisres);
          continue;
        }
-      parse_res = _nss_nisplus_parse_pwent (nisres, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (nisres, result, buffer, 
+                                                buflen)) == -1)
+       {
+         nis_freeresult (nisres);
+         ent->netgrdata.cursor = saved_cursor;
+         return NSS_STATUS_TRYAGAIN;
+       }
       nis_freeresult (nisres);
 
       if (parse_res)
@@ -485,8 +504,14 @@ getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      nis_result *saved_res;
+
       if (ent->first)
        {
+         saved_first = TRUE;
+         saved_res = ent->result;
+
          ent->result = nis_first_entry(pwdtable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
            {
@@ -501,17 +526,32 @@ getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
          nis_result *res;
 
          res = nis_next_entry(pwdtable, &ent->result->cookie);
-         nis_freeresult (ent->result);
+         saved_res = ent->result;
+         saved_first = FALSE;
          ent->result = res;
          if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
            {
              ent->nis = 0;
+             nis_freeresult (saved_res);
              give_pwd_free (&ent->pwd);
              return niserr2nss (ent->result->status);
            }
        }
-      parse_res = _nss_nisplus_parse_pwent (ent->result, result, buffer,
-                                           buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (ent->result, result, buffer,
+                                                buflen)) == -1)
+       {
+         nis_freeresult (ent->result);
+         ent->result = saved_res;
+         ent->first = saved_first;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!saved_first)
+           nis_freeresult (saved_res);
+       }
+      
       if (parse_res &&
          in_blacklist (result->pw_name, strlen (result->pw_name), ent))
        parse_res = 0; /* if result->pw_name in blacklist,search next entry */
@@ -549,6 +589,10 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      char *saved_oldkey;
+      int saved_oldlen;
+      
       if (ent->first)
        {
          if (yp_first (domain, "passwd.byname", &outkey, &outkeylen,
@@ -558,7 +602,10 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
              give_pwd_free (&ent->pwd);
              return NSS_STATUS_UNAVAIL;
            }
-
+         
+         saved_first = TRUE;
+         saved_oldkey = ent->oldkey;
+         saved_oldlen = ent->oldkeylen;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
          ent->first = FALSE;
@@ -574,7 +621,9 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
              return NSS_STATUS_NOTFOUND;
            }
 
-         free (ent->oldkey);
+         saved_first = FALSE;
+         saved_oldkey = ent->oldkey;
+         saved_oldlen = ent->oldkeylen;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
        }
@@ -587,7 +636,20 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
 
       while (isspace (*p))
        ++p;
-      parse_res = _nss_files_parse_pwent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+       {
+         free (ent->oldkey);
+         ent->oldkey = saved_oldkey;
+         ent->oldkeylen = saved_oldlen;
+         ent->first = saved_first;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!saved_first)
+           free (saved_oldkey);
+       }
       if (parse_res &&
          in_blacklist (result->pw_name, strlen (result->pw_name), ent))
        parse_res = 0;
@@ -637,7 +699,13 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
          nis_freeresult (res);
          return status;
        }
-      parse_res = _nss_nisplus_parse_pwent (res, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (res, result, buffer, 
+                                                buflen)) == -1)
+       {
+         nis_freeresult (res);
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -645,10 +713,10 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
       char *domain;
       char *outval;
       int outvallen;
-
+      
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
        return NSS_STATUS_TRYAGAIN;
-
+      
       if (yp_match (domain, "passwd.byname", &result->pw_name[1],
                    strlen (result->pw_name) - 1, &outval, &outvallen)
          != YPERR_SUCCESS)
@@ -658,10 +726,14 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
       free (outval);
       while (isspace (*p))
        p++;
-      parse_res = _nss_files_parse_pwent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+       {
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
     }
 
-  if (parse_res)
+  if (parse_res > 0)
     {
       copy_pwd_changes (result, &pwd, p, plen);
       give_pwd_free (&pwd);
@@ -684,10 +756,13 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
       char *p;
+      int parse_res;
 
       do
        {
+         fgetpos (ent->stream, &pos);
          p = fgets (buffer, buflen, ent->stream);
          if (p == NULL)
            return NSS_STATUS_NOTFOUND;
@@ -702,7 +777,15 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
       while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines.  */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-            !_nss_files_parse_pwent (p, result, data, buflen));
+            !(parse_res = _nss_files_parse_pwent (p, result, data, buflen)));
+
+      if (parse_res == -1)
+       {
+         /* The parser ran out of space.  */
+         fsetpos (ent->stream, &pos);
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
 
       if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
        /* This is a real entry.  */
index 4199baf20241298e7e6fb3cdfe4fb7b9ee20f659..61a703c1eaf7027106bde08a3e1df01e0acb5eb3 100644 (file)
@@ -292,6 +292,10 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+      int parse_res;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
                                         &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -301,10 +305,10 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
          give_spwd_free (&ent->pwd);
          return NSS_STATUS_RETURN;
        }
-
+      
       if (user == NULL || user[0] == '-')
        continue;
-
+      
       if (domain != NULL && strcmp (ypdomain, domain) != 0)
        continue;
 
@@ -325,7 +329,13 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
       while (isspace (*p))
        p++;
       free (outval);
-      if (_nss_files_parse_spent (p, result, data, buflen))
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+       {
+         ent->netgrdata.cursor = saved_cursor;
+         return NSS_STATUS_TRYAGAIN;
+       }
+
+      if (parse_res)
        {
          copy_spwd_changes (result, &ent->pwd, p2, p2len);
          break;
@@ -363,6 +373,9 @@ getspent_next_nisplus_netgr (struct spwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
                                          &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -397,7 +410,12 @@ getspent_next_nisplus_netgr (struct spwd *result, ent_t *ent, char *group,
           nis_freeresult (nisres);
           continue;
         }
-      parse_res = _nss_nisplus_parse_spent (nisres, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (nisres, result, buffer,
+                                                buflen)) == -1)
+       {
+         nis_freeresult (nisres);
+         return NSS_STATUS_TRYAGAIN;
+       }
       nis_freeresult (nisres);
 
       if (parse_res)
@@ -438,8 +456,14 @@ getspent_next_nisplus (struct spwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      nis_result *saved_res;
+
       if (ent->first)
         {
+         saved_first = TRUE;
+         saved_res = ent->result;
+
           ent->result = nis_first_entry(pwdtable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -453,18 +477,33 @@ getspent_next_nisplus (struct spwd *result, ent_t *ent, char *buffer,
         {
           nis_result *res;
 
+         saved_first = FALSE;
+         saved_res = ent->result;
+
           res = nis_next_entry(pwdtable, &ent->result->cookie);
-          nis_freeresult (ent->result);
           ent->result = res;
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
+             nis_freeresult (saved_res);
              ent->nis = 0;
              give_spwd_free (&ent->pwd);
              return niserr2nss (ent->result->status);
             }
         }
-      parse_res = _nss_nisplus_parse_spent (ent->result, result, buffer,
-                                            buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (ent->result, result, buffer,
+                                                buflen)) == -1)
+       {
+         ent->first = saved_first;
+         nis_freeresult (ent->result);
+         ent->result = saved_res;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!saved_first)
+           nis_freeresult (saved_res);
+       }
       if (parse_res &&
           in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
         parse_res = 0; /* if result->pw_name in blacklist,search next entry */
@@ -503,6 +542,10 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      char *saved_oldkey;
+      int saved_oldlen;
+
       if (ent->first)
        {
          if (yp_first (domain, "shadow.byname", &outkey, &outkeylen,
@@ -512,7 +555,9 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
              give_spwd_free (&ent->pwd);
              return NSS_STATUS_UNAVAIL;
            }
-
+         saved_first = TRUE;
+         saved_oldkey = ent->oldkey;
+         saved_oldlen = ent->oldkeylen;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
          ent->first = FALSE;
@@ -528,7 +573,9 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
              return NSS_STATUS_NOTFOUND;
            }
 
-         free (ent->oldkey);
+         saved_first = FALSE;
+         saved_oldkey = ent->oldkey;
+         saved_oldlen = ent->oldkeylen;
          ent->oldkey = outkey;
          ent->oldkeylen = outkeylen;
        }
@@ -541,7 +588,20 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
 
       while (isspace (*p))
        ++p;
-      parse_res = _nss_files_parse_spent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+       {
+         free (ent->oldkey);
+         ent->oldkey = saved_oldkey;
+         ent->oldkeylen = saved_oldlen;
+         ent->first = saved_first;
+         __set_errno (ERANGE);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (!saved_first)
+           free (saved_oldkey);
+       }
       if (parse_res &&
           in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
         parse_res = 0;
@@ -591,7 +651,12 @@ getspent_next_file_plususer (struct spwd *result, char *buffer,
           nis_freeresult (res);
           return status;
         }
-      parse_res = _nss_nisplus_parse_spent (res, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (res, result, buffer, 
+                                                buflen)) == -1)
+       {
+         nis_freeresult (res);
+         return NSS_STATUS_TRYAGAIN;
+       }
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -612,7 +677,8 @@ getspent_next_file_plususer (struct spwd *result, char *buffer,
       free (outval);
       while (isspace (*p))
         p++;
-      parse_res = _nss_files_parse_spent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+       return NSS_STATUS_TRYAGAIN;
     }
 
   if (parse_res)
@@ -638,10 +704,13 @@ getspent_next_file (struct spwd *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
+      int parse_res = 0;
       char *p;
 
       do
        {
+         fgetpos (ent->stream, &pos);
          p = fgets (buffer, buflen, ent->stream);
          if (p == NULL)
            return NSS_STATUS_NOTFOUND;
@@ -656,8 +725,17 @@ getspent_next_file (struct spwd *result, ent_t *ent,
       while (*p == '\0' || *p == '#'   /* Ignore empty and comment lines.  */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-            || !_nss_files_parse_spent (p, result, data, buflen));
+            || !(parse_res = _nss_files_parse_spent (p, result, data,
+                                                     buflen)));
 
+      if (parse_res == -1)
+        {
+          /* The parser ran out of space.  */
+          fsetpos (ent->stream, &pos);
+          __set_errno (ERANGE);
+          return NSS_STATUS_TRYAGAIN;
+        }
+      
       if (result->sp_namp[0] != '+' && result->sp_namp[0] != '-')
        /* This is a real entry.  */
        break;
index 80c49ff5dd05a8a1af0ef1a503c8f5968665eb7f..e187716bb0d2b881c23e58ed81d7be254467aa49 100644 (file)
@@ -184,9 +184,10 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
         ++p;
       free (result);
 
-      parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen);
-      if (parse_res == -1)
+      if ((parse_res = _nss_nis_parse_aliasent (outkey, p, alias, 
+                                               buffer, buflen)) == -1)
        {
+         free (outkey);
          __set_errno (ERANGE);
          return NSS_STATUS_TRYAGAIN;
        }
@@ -258,12 +259,12 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
   free (result);
 
   alias->alias_local = 0;
-  parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen);
-  if (parse_res == -1)
+  if ((parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, 
+                                           buflen)) == -1)
     return NSS_STATUS_TRYAGAIN;
+  
+  if (parse_res)
+    return NSS_STATUS_SUCCESS;
   else
-    if (parse_res == 0)
-      return NSS_STATUS_NOTFOUND;
-    else
-      return NSS_STATUS_SUCCESS;
+    return NSS_STATUS_NOTFOUND;
 }
index 149910bfab5c6c9ffe58064213663b91c7b9e03b..e54262409cac9bc76494a9de34e8d29ad9776a74 100644 (file)
@@ -159,17 +159,16 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen)
       if (next == NULL)
        return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, next->val);
-      next = next->next;
 
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+       return NSS_STATUS_TRYAGAIN;
+      next = next->next;
     }
   while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -228,15 +227,11 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
+  if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
   if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return NSS_STATUS_SUCCESS;
 }
@@ -291,15 +286,11 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
+  if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
   if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return NSS_STATUS_SUCCESS;
 }
index 95774996704cf3bf323825cd02e843868437d2be..7897e2188176f0c2edfce61410c92ee1fe199b7f 100644 (file)
@@ -121,9 +121,11 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_grent (p, grp, data, buflen);
-      if (parse_res < 1 && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+       {
+         free (outkey);
+         return NSS_STATUS_TRYAGAIN;
+       }
 
       free (oldkey);
       oldkey = outkey;
@@ -190,17 +192,13 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen);
+  if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (parse_res < 1)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -241,15 +239,11 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen);
+  if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (parse_res < 1)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
index d26b4f5ccca43159cdcca19c816158bf23f39620..da7cef5ada8b32d857fad03a7f4366642937fa9e 100644 (file)
@@ -199,9 +199,9 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
        ++p;
       free (result);
 
-      parse_res = parse_line (p, host, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = parse_line (p, host, data, buflen)) == -1)
        {
+         free (outkey);
          *h_errnop = NETDB_INTERNAL;;
          return NSS_STATUS_TRYAGAIN;
        }
@@ -287,9 +287,9 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
 
   parse_res = parse_line (p, host, data, buflen);
 
-  if (!parse_res || host->h_addrtype != af)
+  if (parse_res < 1 || host->h_addrtype != af)
     {
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
        {
          *h_errnop = NETDB_INTERNAL;
          return NSS_STATUS_TRYAGAIN;
@@ -377,10 +377,9 @@ _nss_nis_gethostbyaddr_r (char *addr, int addrlen, int type,
   free (result);
 
   parse_res = parse_line (p, host, data, buflen);
-
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
        {
          *h_errnop = NETDB_INTERNAL;
          return NSS_STATUS_TRYAGAIN;
index 284e479401b61b7920f95312e0ee2f8baab81ee8..c17ba81a6257bbfc97a1c9ba8c3b7a71414caa69 100644 (file)
@@ -126,9 +126,9 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_netent (p, net, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_netent (p, net, data, buflen)) == -1)
        {
+         free (outkey);
          *herrnop = NETDB_INTERNAL;
          return NSS_STATUS_TRYAGAIN;
        }
@@ -206,10 +206,10 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net,
 
   parse_res = _nss_files_parse_netent (p, net, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
       *herrnop = NETDB_INTERNAL;
-      if (errno == ERANGE)
+      if (parse_res == -1)
        return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
@@ -286,10 +286,10 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
        parse_res = _nss_files_parse_netent (p, net, data, buflen);
 
 
-       if (!parse_res)
+       if (parse_res < 1)
          {
            *herrnop = NETDB_INTERNAL;
-           if (errno == ERANGE)
+           if (parse_res == -1)
              return NSS_STATUS_TRYAGAIN;
            else
              return NSS_STATUS_NOTFOUND;
index ceed40e03677891eec8d86b5897645e66f5da886..eb09bb4ec78aee7fefb1ab7202fcb871cbf7553e 100644 (file)
@@ -152,17 +152,17 @@ internal_nis_getprotoent_r (struct protoent *proto,
       if (next == NULL)
         return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, next->val);
-      next = next->next;
 
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_protoent (p, proto, data, 
+                                                 buflen)) == -1)
         return NSS_STATUS_TRYAGAIN;
+      next = next->next;
     }
   while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -221,17 +221,13 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
+  if ((parse_res = _nss_files_parse_protoent (p, proto, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -272,15 +268,11 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
+  if ((parse_res = _nss_files_parse_protoent (p, proto, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
index 39c2948b65cf795f51692e66ae346805d6f61a94..f693db17eaf039915765a5e57ecf597d85617479 100644 (file)
@@ -121,16 +121,18 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_pwent (p, pwd, data, buflen)) == -1)
+       {
+         free (outkey);
+         return NSS_STATUS_TRYAGAIN;
+       }
 
       free (oldkey);
       oldkey = outkey;
       oldkeylen = keylen;
       new_start = 0;
     }
-  while (!parse_res);
+  while (parse_res < 1);
 
   return NSS_STATUS_SUCCESS;
 }
@@ -192,9 +194,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
@@ -243,9 +245,9 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
index 073284865eae4a953c597f5c58d71196fac41ecf..cd1f0db9b55ba53268b7317e80876a61407aa13a 100644 (file)
@@ -169,13 +169,12 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
       if (data->next == NULL)
         return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, data->next->val);
-      data->next = data->next->next;
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen)) == -1)
        return NSS_STATUS_TRYAGAIN;
+      data->next = data->next->next;
     }
   while (!parse_res);
 
@@ -286,9 +285,9 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
 
   parse_res = _nss_files_parse_rpcent (p, rpc, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
        return NSS_STATUS_TRYAGAIN;
       else
        return NSS_STATUS_NOTFOUND;
index 054bc33169a1bda150212e204358140d1fd6cb3c..5ec89c86778743be2feac8ecacdeb475f7620b34 100644 (file)
@@ -169,13 +169,13 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
       if (data->next == NULL)
        return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, data->next->val);
-      data->next = data->next->next;
-      while (isspace (*p))
+           while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_servent (p, serv, buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_servent (p, serv, buffer, 
+                                                buflen)) == -1)
         return NSS_STATUS_TRYAGAIN;
+      data->next = data->next->next;
     }
   while (!parse_res);
 
index 21221fd7e589ef0b19c8924e216cc48357948faf..0263f4e313f1810ecb78bef10da91a5b1ee5cfd0 100644 (file)
@@ -121,10 +121,12 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_spent (p, sp, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-
+      if ((parse_res = _nss_files_parse_spent (p, sp, data, buflen)) == -1)
+       {
+         free (outkey);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      
       free (oldkey);
       oldkey = outkey;
       oldkeylen = keylen;
@@ -190,15 +192,11 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_spent (p, sp, data, buflen);
+  if ((parse_res = _nss_files_parse_spent (p, sp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
index 660ba3c34ae61bb9f34fa44ebffa13a92d319dd6..0a16b3890f984fc8f88386caca2897ea27d0afef 100644 (file)
@@ -87,7 +87,7 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
          /* The line is too long for our buffer.  */
        no_more_room:
          __set_errno (ERANGE);
-         return 0;
+         return -1;
        }
       else
        {
@@ -214,8 +214,10 @@ internal_nisplus_getaliasent_r (struct aliasent *alias,
       if (next_entry >= result->objects.objects_len)
        return NSS_STATUS_NOTFOUND;
 
-      parse_res = _nss_nisplus_parse_aliasent (result, next_entry, alias,
-                                              buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_aliasent (result, next_entry, alias,
+                                                   buffer, buflen)) == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       ++next_entry;
     } while (!parse_res);
 
@@ -247,9 +249,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
     if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
       return NSS_STATUS_UNAVAIL;
 
-  if (name == NULL || strlen(name) > 8)
-    return NSS_STATUS_NOTFOUND;
-  else
+  if (name != NULL || strlen(name) <= 8)
     {
       nis_result *result;
       char buf[strlen (name) + 30 + tablename_len];
@@ -261,15 +261,12 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
        return niserr2nss (result->status);
 
-      parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
-                                              buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
+                                                   buffer, buflen)) == -1)
+       return NSS_STATUS_TRYAGAIN;
 
       if (parse_res)
        return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
index 7c07833ef47da2646f9af4b44e4adf4b32cc465c..d7c372093285798d85d586501ccab6554e4eebe7 100644 (file)
@@ -74,7 +74,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
   if (NISENTRYLEN (0, 0, result) +1 > room_left)
     {
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result));
   room_left -= (NISENTRYLEN (0, 0, result) +1);
@@ -152,8 +152,11 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_result;
+      
       if (result == NULL)
        {
+         saved_result = NULL;
          result = nis_first_entry(tablename_val);
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
            return niserr2nss (result->status);
@@ -163,13 +166,28 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer,
          nis_result *res2;
 
          res2 = nis_next_entry(tablename_val, &result->cookie);
-         nis_freeresult (result);
+         saved_result = result;
          result = res2;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_result);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_etherent (result, ether, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_etherent (result, ether, buffer, 
+                                                   buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_result;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_result != NULL)
+           nis_freeresult (saved_result);
+       }
+      
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -200,9 +218,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
     if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
       return NSS_STATUS_UNAVAIL;
 
-  if (name == NULL)
-    return NSS_STATUS_NOTFOUND;
-  else
+  if (name != NULL)
     {
       nis_result *result;
       char buf[strlen (name) + 40 + tablename_len];
@@ -212,18 +228,23 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-        return niserr2nss (result->status);
-
-      parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen);
-
+       {
+         enum nss_status status = niserr2nss (result->status);
+         nis_freeresult (result);
+         return status;
+       }
+      
+      if ((parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
+                                                   buflen)) == -1)
+       {
+         nis_freeresult (result);
+         return NSS_STATUS_TRYAGAIN;
+       }
+         
       if (parse_res)
         return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -255,16 +276,22 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr,
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-       return niserr2nss (result->status);
-
-      parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen);
+       {
+         enum nss_status status = niserr2nss (result->status);
+         nis_freeresult (result);
+         return status;
+       }
 
+      if ((parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, 
+                                                   buflen)) == -1)
+       {
+         nis_freeresult (result);
+         return NSS_STATUS_TRYAGAIN;
+       }
+      
       if (parse_res)
        return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
+
index f759f61ca0ad6e271ca5f4a005f1e5d7ba658661..08e9e040fe3f8640f3b7e5e7d0ea0fa3012214e4 100644 (file)
@@ -117,8 +117,10 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen)
       if (next_entry >= result->objects.objects_len)
        return NSS_STATUS_NOTFOUND;
 
-      parse_res = _nss_nisplus_parse_grent (result, next_entry, gr,
-                                           buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (result, next_entry, gr,
+                                                buffer, buflen)) == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       ++next_entry;
     }
   while (!parse_res);
@@ -170,16 +172,14 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
        }
 
       parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -212,12 +212,12 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
 
     nis_freeresult (result);
 
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
index d4dda5964e7ce44071565113fcf46c5db385b39a..10f939e3414d9c2386d8e174da4927ed18a46ba5 100644 (file)
@@ -66,8 +66,9 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 
   if (room_left < NISENTRYLEN (0, 2, result) + 1)
     {
+    no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   data = first_unused;
@@ -96,10 +97,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   room_left-=host->h_length;
 
   if (NISENTRYLEN (0, 0, result) + 1 > room_left)
-    {
-      __set_errno (ERANGE);
-      return 0;
-    }
+    goto no_more_room;
+  
   p = stpncpy (first_unused, NISENTRYVAL (0, 0, result),
               NISENTRYLEN (0, 0, result));
   *p = '\0';
@@ -114,10 +113,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
       if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
        {
          if (NISENTRYLEN (i, 1, result) + 2 > room_left)
-           {
-             __set_errno (ERANGE);
-             return 0;
-           }
+           goto no_more_room;
+         
          *p++ = ' ';
          p = stpncpy (p, NISENTRYVAL (i, 1, result),
                       NISENTRYLEN (i, 1, result));
@@ -133,10 +130,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
   host->h_addr_list = (char **) first_unused;
   if (room_left < 2 * sizeof (char *))
-    {
-      __set_errno (ERANGE);
-      return 0;
-    }
+    goto no_more_room;
+  
   room_left -= (2 * sizeof (char *));
   host->h_addr_list[0] = data;
   host->h_addr_list[1] = NULL;
@@ -154,10 +149,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
        break;
 
       if (room_left < sizeof (char *))
-       {
-         __set_errno (ERANGE);
-         return 0;
-       }
+       goto no_more_room;
 
       room_left -= sizeof (char *);
       host->h_aliases[i] = line;
@@ -174,9 +166,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
       else
        host->h_aliases[i+1] = NULL;
     }
-
   return 1;
-
 }
 
 static enum nss_status
@@ -240,8 +230,11 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
        {
+         saved_res = NULL;
          if (tablename_val == NULL)
            if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
              return NSS_STATUS_UNAVAIL;
@@ -249,9 +242,7 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
          result = nis_first_entry(tablename_val);
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
             {
-              int retval;
-
-              retval = niserr2nss (result->status);
+              enum nss_status retval = niserr2nss (result->status);          
               if (retval == NSS_STATUS_TRYAGAIN)
                 {
                   *herrnop = NETDB_INTERNAL;
@@ -259,20 +250,21 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
                 }
               return retval;
             }
-
+         
        }
       else
        {
          nis_result *res2;
-
+         
+         saved_res = result;
          res2 = nis_next_entry(tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res2;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
             {
-              int retval;
+              enum nss_status retval= niserr2nss (result->status);
 
-              retval = niserr2nss (result->status);
+             nis_freeresult (result);
+             result = saved_res;
               if (retval == NSS_STATUS_TRYAGAIN)
                 {
                   *herrnop = NETDB_INTERNAL;
@@ -281,20 +273,24 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
               return retval;
             }
        }
-
+      
       parse_res = _nss_nisplus_parse_hostent (result, AF_INET6,
                                              host, buffer, buflen);
-      if (!parse_res && errno != ERANGE)
+      if (parse_res < 1 && errno != ERANGE)
        parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host,
                                                buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if (parse_res < 1 && errno == ERANGE)
         {
+         nis_freeresult (result);
+         result = saved_res;
           *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
-
+      if (saved_res != NULL)
+       nis_freeresult (saved_res);
+      
     } while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -353,10 +349,10 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
       else
        sprintf(buf, "[cname=%s],%s", NISENTRYVAL(0, 0, result),
                tablename_val);
-
+      
       nis_freeresult (result);
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
-
+      
       retval = niserr2nss (result->status);
       if (retval != NSS_STATUS_SUCCESS)
         {
@@ -373,12 +369,12 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
        _nss_nisplus_parse_hostent (result, af, host, buffer, buflen);
 
       nis_freeresult (result);
-
-      if (parse_res)
+      
+      if (parse_res > 0)
        return NSS_STATUS_SUCCESS;
 
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
        return NSS_STATUS_TRYAGAIN;
       else
        return NSS_STATUS_NOTFOUND;
@@ -438,14 +434,13 @@ _nss_nisplus_gethostbyaddr_r (const char *addr, int addrlen, int type,
 
       parse_res = _nss_nisplus_parse_hostent (result, type, host,
                                              buffer, buflen);
-
       nis_freeresult (result);
-
-      if (parse_res)
+      
+      if (parse_res > 0)
        return NSS_STATUS_SUCCESS;
-
+      
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
        return NSS_STATUS_TRYAGAIN;
       else
        return NSS_STATUS_NOTFOUND;
index 670d0bb4ed0b47930ebbc2e2140cb8d2fb3087b0..9c38539de835094123e30ea6f5110b5ef0785d06 100644 (file)
@@ -80,7 +80,7 @@ _nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
       NISENTRYLEN (position, 4, data) + 6 > buflen)
     {
       __set_errno (ERANGE);
-      status = NSS_STATUS_UNAVAIL;
+      status = NSS_STATUS_TRYAGAIN;
     }
   else
     {
index 183722633f0f756d7bca2803b68d9ef8c9b5be94..57362dba78eb11d4bbb28f3479814783f90e9bab 100644 (file)
@@ -66,7 +66,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL(0, 0, result),
@@ -85,10 +85,8 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
       if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
-            {
-              __set_errno (ERANGE);
-              return 0;
-            }
+           goto no_more_room;
+         
          *p++ = ' ';
           p = stpncpy (p, NISENTRYVAL (i, 1, result),
                        NISENTRYLEN (i, 1, result));
@@ -120,10 +118,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
         break;
 
       if (room_left < sizeof (char *))
-        {
-          __set_errno (ERANGE);
-          return 0;
-        }
+       goto no_more_room;
 
       room_left -= sizeof (char *);
       network->n_aliases[i] = line;
@@ -208,8 +203,12 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
        {
+         saved_res = NULL;
+
          if (tablename_val == NULL)
            if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
              return NSS_STATUS_UNAVAIL;
@@ -218,8 +217,10 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
            {
              int retval;
-
+             
              retval = niserr2nss (result->status);
+             nis_freeresult (result);
+             result = NULL;
              if (retval == NSS_STATUS_TRYAGAIN)
                {
                  *herrnop = NETDB_INTERNAL;
@@ -235,13 +236,15 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
          nis_result *res;
 
          res = nis_next_entry(tablename_val, &result->cookie);
-         nis_freeresult (result);
+         saved_res = result;
          result = res;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
            {
              int retval;
 
              retval = niserr2nss (result->status);
+             nis_freeresult (result);
+             result = saved_res;
              if (retval == NSS_STATUS_TRYAGAIN)
                {
                  *herrnop = NETDB_INTERNAL;
@@ -251,15 +254,15 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
            }
        }
 
-      parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_nisplus_parse_netent (result, network, buffer, 
+                                                 buflen)) == -1)
         {
           *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
-
+      
     } while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -298,7 +301,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
     {
       nis_result *result;
       char buf[strlen (name) + 255 + tablename_len];
-
+      
       /* Search at first in the alias list, and use the correct name
         for the next search */
       sprintf(buf, "[name=%s],%s", name, tablename_val);
@@ -336,11 +339,11 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
 
       nis_freeresult (result);
 
-      if (parse_res)
+      if (parse_res > 0)
        return NSS_STATUS_SUCCESS;
 
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
        return NSS_STATUS_TRYAGAIN;
       else
        return NSS_STATUS_NOTFOUND;
@@ -385,11 +388,11 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
 
     nis_freeresult (result);
 
-    if (parse_res)
+    if (parse_res > 0)
       return NSS_STATUS_SUCCESS;
-
+    
     *herrnop = NETDB_INTERNAL;
-    if (!parse_res && errno == ERANGE)
+    if (parse_res == -1)
       return NSS_STATUS_TRYAGAIN;
     else
       return NSS_STATUS_NOTFOUND;
index bb6bba1e3eb009028cf6c41cd97b5dbd755e08bc..3d0ff32e576f7943221421aa9cc27d8f09d7bd87 100644 (file)
@@ -55,7 +55,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL(0, 0, result),
@@ -152,7 +152,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL (entry, 0, result),
@@ -258,7 +258,7 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
index d98317a8a18715424b7519f7d8add043f2bf9965..707a0e52963154e6bea3ab810dbe384854325390 100644 (file)
@@ -63,7 +63,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -196,8 +196,11 @@ internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
        {
+         saved_res = NULL;
          if (tablename_val == NULL)
            if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
              return NSS_STATUS_UNAVAIL;
@@ -209,16 +212,30 @@ internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer,
       else
        {
          nis_result *res;
-
+         
+         saved_res = result;
          res = nis_next_entry (tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res;
 
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_res);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, 
+                                                   buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_res;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_res)
+           nis_freeresult (saved_res);
+       }
     }
   while (!parse_res);
 
@@ -290,13 +307,12 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -327,12 +343,13 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
     parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen);
 
     nis_freeresult (result);
-    if (parse_res)
-      return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
+    if (parse_res == -1)
       return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    
+    if (parse_res)
+      return NSS_STATUS_SUCCESS;
+    
+    return NSS_STATUS_NOTFOUND;
   }
 }
index 459a1a43804f0ce25c65c41fe388bf1fa004bb57..2c1fb19cab51bc63f4e42ba46b95d9c2d4322e1c 100644 (file)
@@ -96,8 +96,11 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen)
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+      
       if (result == NULL)
        {
+         saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -110,14 +113,28 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen)
        {
          nis_result *res;
 
+         saved_res = result;
          res = nis_next_entry(tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_res);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, 
+                                                buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_res;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_res)
+           nis_freeresult (saved_res);
+       }
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -170,13 +187,13 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
        return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -207,12 +224,13 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
     parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen);
 
     nis_freeresult (result);
+
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+    
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
index 47610a4dca4261080f0ba93865be169991911018..b70c2ebbca89bbcfeed0fe2efc38fdde7460c3a7 100644 (file)
@@ -64,7 +64,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -198,8 +198,11 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
        {
+         saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -212,14 +215,28 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer,
        {
          nis_result *res;
 
+         saved_res = result;
          res = nis_next_entry (tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_res);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, 
+                                                 buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_res;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_res)
+           nis_freeresult (saved_res);
+       }
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -290,13 +307,13 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -329,12 +346,12 @@ _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc,
 
     nis_freeresult (result);
 
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
index b97034e9b8a50b9b7675ca46d1f1df2c869ec5cf..37042d9d13600e6fd683070014ff38830382921e 100644 (file)
@@ -63,7 +63,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -204,8 +204,11 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+      
       if (result == NULL)
        {
+         saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -218,14 +221,28 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
        {
          nis_result *res;
 
+         saved_res = result;
          res = nis_next_entry (tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_res);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_servent (result, serv, buffer,
+                                                  buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_res;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_res)
+           nis_freeresult (saved_res);
+       }
     }
   while (!parse_res);
 
@@ -300,16 +317,15 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
        }
 
       parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -347,15 +363,14 @@ _nss_nisplus_getservbynumber_r (const int number, const char *protocol,
        }
 
       parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
index 81bde4e6898e3c790160459ac3e1c1b681e733db..c7f1e2a5677f32b175c9cc502bb52e79daa49b5b 100644 (file)
@@ -93,8 +93,12 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
        {
+         saved_res = NULL;
+
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -107,14 +111,28 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
        {
          nis_result *res;
 
+         saved_res = result;
          res = nis_next_entry (tablename_val, &result->cookie);
-         nis_freeresult (result);
          result = res;
          if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-           return niserr2nss (result->status);
+           {
+             nis_freeresult (saved_res);
+             return niserr2nss (result->status);
+           }
        }
 
-      parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (result, sp, buffer,
+                                                buflen)) == -1)
+       {
+         nis_freeresult (result);
+         result = saved_res;
+         return NSS_STATUS_TRYAGAIN;
+       }
+      else
+       {
+         if (saved_res)
+           nis_freeresult (saved_res);
+       }
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -164,15 +182,14 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
        }
 
       parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+       return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
        return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-       return NSS_STATUS_TRYAGAIN;
-      else
-       return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
index 34fe918237f0876bf38820ae9f7ac8c86b318426..d1004356b40476bb43e600210cb5515b80f2cf25 100644 (file)
@@ -982,7 +982,11 @@ __guess_grouping (unsigned int intdig_max, const char *grouping,
       ++groups;
       intdig_max -= *grouping++;
 
-      if (*grouping == CHAR_MAX || *grouping < 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+         || *grouping < 0
+#endif
+         )
        /* No more grouping should be done.  */
        break;
       else if (*grouping == 0)
@@ -1023,7 +1027,11 @@ group_number (char *buf, char *bufend, unsigned int intdig_no,
       while (--len > 0);
       *p-- = thousands_sep;
 
-      if (*grouping == CHAR_MAX || *grouping < 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+         || *grouping < 0
+#endif
+         )
        /* No more grouping should be done.  */
        break;
       else if (*grouping == 0)
index db6f3e4842e9913d5d9a2bd7674e1d9f0c75885a..1cd8d2178a5bef44d5c1cfc7c0ce4fb0c150b428 100644 (file)
@@ -1514,7 +1514,11 @@ group_number (CHAR_T *w, CHAR_T *rear_ptr, const CHAR_T *grouping,
          if (*grouping == '\0')
            /* The previous grouping repeats ad infinitum.  */
            --grouping;
-         else if (*grouping == CHAR_MAX || *grouping < 0)
+         else if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+                  || *grouping < 0
+#endif
+                  )
            {
              /* No further grouping to be done.
                 Copy the rest of the number.  */
index 8b097b68c5f45395334f42384f44cb686f47dc3a..deb7a15cfb3c025c9f597adc37bba3ac0c3f815d 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal header for proving correct grouping in strings of numbers.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -81,7 +81,11 @@ correctly_grouped_prefix (const STRING_TYPE *begin, const STRING_TYPE *end,
              /* Skip the thousands separator.  */
              --cp;
 
-             if (*gp == CHAR_MAX || *gp < 0)
+             if (*gp == CHAR_MAX
+#if CHAR_MIN < 0
+                 || *gp < 0
+#endif
+                 )
                {
                  /* No more thousands separators are allowed to follow.  */
                  while (cp >= begin && (wchar_t) *cp != thousands)
index e19e7e820b47ccc288aa0c57ec6869451183091f..5faf46caee41048c4ee3b6c98abaaab578c9c66c 100644 (file)
@@ -262,6 +262,8 @@ clntudp_call (cl, proc, xargs, argsp, xresults, resultsp, utimeout)
   time_waited.tv_usec = 0;
 call_again:
   xdrs = &(cu->cu_outxdrs);
+  if (xargs == NULL)
+    goto get_reply;
   xdrs->x_op = XDR_ENCODE;
   XDR_SETPOS (xdrs, cu->cu_xdrpos);
   /*
@@ -290,6 +292,7 @@ send_again:
     {
       return (cu->cu_error.re_status = RPC_TIMEDOUT);
     }
+ get_reply:
   /*
    * sub-optimal code appears here because we have
    * some clock time to spare while the packets are in flight.
diff --git a/sysdeps/alpha/ntohl.s b/sysdeps/alpha/ntohl.s
deleted file mode 100644 (file)
index 6a99a01..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is a dummy to avoid including the generic version.  htonl and
-ntohl are identical and htonl.S defines appropriate aliases.  */
diff --git a/sysdeps/alpha/ntohs.s b/sysdeps/alpha/ntohs.s
deleted file mode 100644 (file)
index 69992a8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is a dummy to avoid including the generic version.  htons and
-ntohs are identical and htons.S defines appropriate aliases.  */
similarity index 79%
rename from sysdeps/generic/ntohs.c
rename to sysdeps/generic/bits/htontoh.h
index f4f37eec932323ccca2d9d42cbb8174a087ce78a..fa4efed867bb43212a334e4e1ee535bf0e1b3e85 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* 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
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <netinet/in.h>
-
-#undef ntohs
-
-u_int16_t
-ntohs (x)
-     u_int16_t x;
-{
-#if BYTE_ORDER == LITTLE_ENDIAN
-  x = (x << 8) | (x >> 8);
+#ifndef _NETINET_IN_H
+# error "Don't include this file directly, use <netinet/in.h>"
 #endif
 
-  return x;
-}
+/* We cannot give generic optimized versions here.  */
index c5e85274b024beebe49c8e05aaac6436eaed4e33..e18f0b89a4079ebe5627ed8b6ccf6786c3b03f86 100644 (file)
@@ -32,7 +32,7 @@ extern char **_dl_argv;
 extern char **_environ;
 extern size_t _dl_pagesize;
 extern void _end;
-extern void _start (void);
+extern void ENTRY_POINT (void);
 
 int __libc_enable_secure;
 int __libc_multiple_libcs;     /* Defining this here avoids the inclusion
index f1e077ae1a0533624f27e9de2808e065c8c30c28..d460d40f89da4f249a2d3698aa6e22c19f309cd7 100644 (file)
@@ -21,7 +21,7 @@
 #undef htonl
 
 u_int32_t
-htonl (x)
+__htonl (x)
      u_int32_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -30,3 +30,6 @@ htonl (x)
 
   return x;
 }
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
index 3aaf28551c8954dddb871f0a43e0b8bb939cd0dc..a0a0e81adf47ea1b365dc77fa3704e8d49744971 100644 (file)
@@ -21,7 +21,7 @@
 #undef htons
 
 u_int16_t
-htons (x)
+__htons (x)
      u_int16_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -30,3 +30,6 @@ htons (x)
 
   return x;
 }
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
diff --git a/sysdeps/i386/bits/htontoh.h b/sysdeps/i386/bits/htontoh.h
new file mode 100644 (file)
index 0000000..590b509
--- /dev/null
@@ -0,0 +1,79 @@
+/* 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 _NETINET_IN_H
+# error "Don't include this file directly, use <netinet/in.h>"
+#endif
+
+#if defined __GNUC__ && __GNUC__ >= 2
+/* We can use inline assembler instructions to optimize the code.  */
+
+/* To swap the bytes in a word the i486 processors and up provide the
+   `bswap' opcode.  On i386 we have to use three instructions.  */
+# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
+
+extern __inline u_int32_t
+__ntohl (u_int32_t netlong)
+{
+  register u_int32_t hostlong;
+
+  __asm__ ("rorw $8, %w0; rorl $16, %0; rorw $8, %w0"
+          : "=r" (hostlong)
+          : "0" (netlong));
+
+  return hostlong;
+}
+
+# else
+
+extern __inline u_int32_t
+__ntohl (u_int32_t netlong)
+{
+  register u_int32_t hostlong;
+
+  __asm__ ("bswap %0" : "=r" (hostlong) : "0" (netlong));
+
+  return hostlong;
+}
+
+# endif
+
+/* For a short word we have a simple solution.  */
+extern __inline u_int16_t
+__ntohs (u_int16_t netshort)
+{
+  register u_int16_t hostshort;
+
+  __asm__ ("rorw $8, %w0" : "=r" (hostshort) : "0" (netshort));
+}
+
+
+/* The other direction can be handled with the same functions.  */
+extern __inline u_int32_t
+__htonl (u_int32_t hostlong)
+{
+  return __ntohl (hostlong);
+}
+
+extern __inline u_int16_t
+__htons (u_int16_t hostshort)
+{
+  return __ntohs (hostshort);
+}
+
+#endif /* GNU CC */
index a83356fce1620355cc12b13c347c17309b0dbe5d..0388cbe5103ce5e0fd97f6caab123e55881e4c6c 100644 (file)
@@ -276,9 +276,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 
              strtab = ((void *) map->l_addr
                        + map->l_info[DT_STRTAB]->d_un.d_ptr);
-             _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
-                               "' in `",
-                               _dl_argv[0] ?: "<program name unknown>",
+             _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+                               ": Symbol `", strtab + refsym->st_name,
                                "' has different size in shared object, "
                                "consider re-linking\n", NULL);
            }
index 42dae92a2ad364f435ecb89621d8235ef612427c..4228959d23886fb38a7f560adb0ce3c4e7deb75a 100644 (file)
 # define isgreater(x, y) \
      ({ int result;                                                          \
        __asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;"              \
-                "andl $0xff, %0"                                             \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+                "andl $0x01, %0"                                             \
+                : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
        result; })
 
 # define isgreaterequal(x, y) \
      ({ int result;                                                          \
        __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;"             \
-                "andl $0xff, %0"                                             \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+                "andl $0x01, %0"                                             \
+                : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
        result; })
 
 # define isless(x, y) \
      ({ int result;                                                          \
        __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;"      \
-                "setz %%al; andl $0xff, %0"                                  \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+                "setz %%al; andl $0x01, %0"                                  \
+                : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
        result; })
 
 # define islessequal(x, y) \
      ({ int result;                                                          \
        __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;"      \
-                "setz %%al; andl $0xff, %0"                                  \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+                "setz %%al; andl $0x01, %0"                                  \
+                : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
        result; })
 
 # define islessgreater(x, y) \
      ({ int result;                                                          \
        __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;"             \
-                "andl $0xff, %0"                                             \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+                "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 $0xff, %0"           \
-                : "=a" (result) : "t" (x), "u" (y) : "cc");                  \
+       __asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0x01, %0"           \
+                : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
        result; })
 #endif
 
diff --git a/sysdeps/i386/htonl.S b/sysdeps/i386/htonl.S
new file mode 100644 (file)
index 0000000..73dd1e9
--- /dev/null
@@ -0,0 +1,39 @@
+/* Change byte order in word.  For Intel 80386.
+   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.  */
+
+#include <sysdep.h>
+#include "asm-syntax.h"
+
+/*
+   INPUT PARAMETERS:
+   word                (sp + 4)
+*/
+
+       .text
+ENTRY (__htonl)
+       movl    4(%esp), %eax
+       rorw    $8, %ax
+       rorl    $16, %eax
+       rorw    $8, %ax
+       ret
+END (__htonl)
+
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
diff --git a/sysdeps/i386/htons.S b/sysdeps/i386/htons.S
new file mode 100644 (file)
index 0000000..5d0f59c
--- /dev/null
@@ -0,0 +1,38 @@
+/* Change byte order in word.  For Intel 80x86, x >= 3.
+   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.  */
+
+#include <sysdep.h>
+#include "asm-syntax.h"
+
+/*
+   INPUT PARAMETERS:
+   word                (sp + 4)
+*/
+
+       .text
+ENTRY (__htons)
+       movl    4(%esp), %eax
+       andl    $0xffff, %eax
+       rorw    $8, %ax
+       ret
+END (__htons)
+
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
similarity index 69%
rename from sysdeps/generic/ntohl.c
rename to sysdeps/i386/i486/htonl.S
index 0cb83c5aa4089a60f42111d07559a1a279064f86..cf3a94fc76dfa127ee90320eefe49bce0a7e7776 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Change byte order in word.  For Intel 80x86, 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
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <netinet/in.h>
+#include <sysdep.h>
+#include "asm-syntax.h"
 
-#undef ntohl
+/*
+   INPUT PARAMETERS:
+   word                (sp + 4)
+*/
 
-u_int32_t
-ntohl (x)
-     u_int32_t x;
-{
-#if BYTE_ORDER == LITTLE_ENDIAN
-  x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
-#endif
+       .text
+ENTRY (__htonl)
+       movl    4(%esp), %eax
+       bswap   %eax
+       ret
+END (__htonl)
 
-  return x;
-}
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
index 437975f79f00eacf98fc0f8822edc791a06847be..8b3398c0a3c29747cc711cc92e2585e5277e3b92 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -21,16 +21,16 @@ static char rcsid[] = "$NetBSD: e_atan2f.c,v 1.4 1995/05/10 20:44:53 jtc Exp $";
 #include "math_private.h"
 
 #ifdef __STDC__
-static const float 
+static const float
 #else
-static float 
+static float
 #endif
 tiny  = 1.0e-30,
 zero  = 0.0,
-pi_o_4  = 7.8539818525e-01, /* 0x3f490fdb */
-pi_o_2  = 1.5707963705e+00, /* 0x3fc90fdb */
-pi      = 3.1415925026e+00, /* 0x40490fda */
-pi_lo   = 1.5099578832e-07; /* 0x34222168 */
+pi_o_4  = 7.8539818525e-01,  /* 0x3f490fdb */
+pi_o_2  = 1.5707963705e+00,  /* 0x3fc90fdb */
+pi      = 3.1415927410e+00,  /* 0x40490fdb */
+pi_lo   = -8.7422776573e-07; /* 0xb3bbbd2e */
 
 #ifdef __STDC__
        float __ieee754_atan2f(float y, float x)
@@ -38,7 +38,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
        float __ieee754_atan2f(y,x)
        float  y,x;
 #endif
-{  
+{
        float z;
        int32_t k,m,hx,hy,ix,iy;
 
@@ -55,7 +55,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
     /* when y = 0 */
        if(iy==0) {
            switch(m) {
-               case 0: 
+               case 0:
                case 1: return y;       /* atan(+-0,+anything)=+-0 */
                case 2: return  pi+tiny;/* atan(+0,-anything) = pi */
                case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
@@ -63,7 +63,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
        }
     /* when x = 0 */
        if(ix==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;
-           
+
     /* when x is INF */
        if(ix==0x7f800000) {
            if(iy==0x7f800000) {
index f5846946863c3cea7c91f4b2fb2794c1fbebdaab..e4e6eab6c5b4203c2faff8b01a51defc5d53c490 100644 (file)
@@ -106,8 +106,8 @@ static double zero   =  0.0;
        k=0;
        if (hx < 0x00100000) {                  /* x < 2**-1022  */
            if (((hx&0x7fffffff)|lx)==0)
-               return -two54/zero;             /* log(+-0)=-inf */
-           if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+               return -two54/(x-x);            /* log(+-0)=-inf */
+           if (hx<0) return (x-x)/(x-x);       /* log(-#) = NaN */
            k -= 54; x *= two54; /* subnormal number, scale up x */
            GET_HIGH_WORD(hx,x);
        }
index 5d004ac4e2d8f92bc895cafdf5bf3cab5c857947..e8a3278eaf93bf8cabf35808d804806a356aa08f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -16,26 +16,26 @@ static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
 
 /* __ieee754_log10(x)
  * Return the base 10 logarithm of x
- * 
+ *
  * Method :
  *     Let log10_2hi = leading 40 bits of log10(2) and
  *         log10_2lo = log10(2) - log10_2hi,
  *         ivln10   = 1/log(10) rounded.
  *     Then
- *             n = ilogb(x), 
+ *             n = ilogb(x),
  *             if(n<0)  n = n+1;
  *             x = scalbn(x,-n);
  *             log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x))
  *
  * Note 1:
- *     To guarantee log10(10**n)=n, where 10**n is normal, the rounding 
+ *     To guarantee log10(10**n)=n, where 10**n is normal, the rounding
  *     mode must set to Round-to-Nearest.
  * Note 2:
  *     [1/log(10)] rounded to 53 bits has error  .198   ulps;
  *     log10 is monotonic at all binary break points.
  *
  * Special cases:
- *     log10(x) is NaN with signal if x < 0; 
+ *     log10(x) is NaN with signal if x < 0;
  *     log10(+INF) is +INF with no signal; log10(0) is -INF with signal;
  *     log10(NaN) is that NaN with no signal;
  *     log10(10**N) = N  for N=0,1,...,22.
@@ -80,10 +80,10 @@ static double zero   =  0.0;
        EXTRACT_WORDS(hx,lx,x);
 
         k=0;
-        if (hx < 0x00100000) {                  /* x < 2**-1022  */
+        if (hx < 0x00100000) {                 /* x < 2**-1022  */
             if (((hx&0x7fffffff)|lx)==0)
-                return -two54/zero;             /* log(+-0)=-inf */
-            if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+                return -two54/(x-x);           /* log(+-0)=-inf */
+            if (hx<0) return (x-x)/(x-x);      /* log(-#) = NaN */
             k -= 54; x *= two54; /* subnormal number, scale up x */
            GET_HIGH_WORD(hx,x);
         }
index 2082a763bb521f80a5734e411174d504ac58b9bb..cea3d9156b4e662a374d72f7fe1044231333a45d 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -49,10 +49,10 @@ static float zero   =  0.0;
        GET_FLOAT_WORD(hx,x);
 
         k=0;
-        if (hx < 0x00800000) {                  /* x < 2**-126  */
+        if (hx < 0x00800000) {                 /* x < 2**-126  */
             if ((hx&0x7fffffff)==0)
-                return -two25/zero;             /* log(+-0)=-inf */
-            if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+                return -two25/(x-x);           /* log(+-0)=-inf */
+            if (hx<0) return (x-x)/(x-x);      /* log(-#) = NaN */
             k -= 25; x *= two25; /* subnormal number, scale up x */
            GET_FLOAT_WORD(hx,x);
         }
index 1481fd01cb2c05ad77c90e8626f61b2c98e84f45..0f1af93ba82b45002553737b5124e97fe0676150 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -56,12 +56,12 @@ static float zero   =  0.0;
 
        k=0;
        if (ix < 0x00800000) {                  /* x < 2**-126  */
-           if ((ix&0x7fffffff)==0) 
-               return -two25/zero;             /* log(+-0)=-inf */
-           if (ix<0) return (x-x)/zero;        /* log(-#) = NaN */
+           if ((ix&0x7fffffff)==0)
+               return -two25/(x-x);            /* log(+-0)=-inf */
+           if (ix<0) return (x-x)/(x-x);       /* log(-#) = NaN */
            k -= 25; x *= two25; /* subnormal number, scale up x */
            GET_FLOAT_WORD(ix,x);
-       } 
+       }
        if (ix >= 0x7f800000) return x+x;
        k += (ix>>23)-127;
        ix &= 0x007fffff;
@@ -76,14 +76,14 @@ static float zero   =  0.0;
            if(k==0) return f-R; else {dk=(float)k;
                     return dk*ln2_hi-((R-dk*ln2_lo)-f);}
        }
-       s = f/((float)2.0+f); 
+       s = f/((float)2.0+f);
        dk = (float)k;
        z = s*s;
        i = ix-(0x6147a<<3);
        w = z*z;
        j = (0x6b851<<3)-ix;
-       t1= w*(Lg2+w*(Lg4+w*Lg6)); 
-       t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); 
+       t1= w*(Lg2+w*(Lg4+w*Lg6));
+       t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
        i |= j;
        R = t2+t1;
        if(i>0) {
index d3c2cb55b724326739138b9407f4ab2caccf3eb3..6f76ce1fba91df38981788d4ef7c04bd8b9e2527 100644 (file)
@@ -23,12 +23,11 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
        double x;
 #endif
 {
-       u_int32_t hx;
-       int32_t lx;
+       int32_t hx,lx;
        EXTRACT_WORDS(hx,lx,x);
        lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
        lx |= -lx;
-       return ~(lx >> 31) & (1 - ((hx >> 30) & 2));
+       return ~(lx >> 31) & (hx >> 30);
 }
 weak_alias (__isinf, isinf)
 #ifdef NO_LONG_DOUBLE
index 9acc0df6ec94b28fcb20c21002e50663101f0168..18a0b5e03b97d5d73ded13e7af073a1491fba403 100644 (file)
@@ -27,6 +27,6 @@ static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
        t = ix & 0x7fffffff;
        t ^= 0x7f800000;
        t |= -t;
-       return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30));
+       return ~(t >> 31) & (ix >> 30);
 }
 weak_alias (__isinff, isinff)
index cc380a1091d7ddd0fbe0fc004a20d5e053832d17..086c0dce6c118e2364aa883d0997d32493d43a97 100644 (file)
@@ -120,7 +120,7 @@ static double zero = 0.0;
        k = 1;
        if (hx < 0x3FDA827A) {                  /* x < 0.41422  */
            if(ax>=0x3ff00000) {                /* x <= -1.0 */
-               if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */
+               if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */
                else return (x-x)/(x-x);        /* log1p(x<-1)=NaN */
            }
            if(ax<0x3e200000) {                 /* |x| < 2**-29 */
index ee0a83958dc224881901e7d1e992e19a6217294d..5b1237b0d074d58e9146c279cb582ae12d83c2af 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -58,7 +58,7 @@ static float zero = 0.0;
        k = 1;
        if (hx < 0x3ed413d7) {                  /* x < 0.41422  */
            if(ax>=0x3f800000) {                /* x <= -1.0 */
-               if(x==(float)-1.0) return -two25/zero; /* log1p(-1)=+inf */
+               if(x==(float)-1.0) return -two25/(x-x); /* log1p(-1)=+inf */
                else return (x-x)/(x-x);        /* log1p(x<-1)=NaN */
            }
            if(ax<0x31000000) {                 /* |x| < 2**-29 */
@@ -70,11 +70,11 @@ static float zero = 0.0;
            }
            if(hx>0||hx<=((int32_t)0xbe95f61f)) {
                k=0;f=x;hu=1;}  /* -0.2929<x<0.41422 */
-       } 
+       }
        if (hx >= 0x7f800000) return x+x;
        if(k!=0) {
            if(hx<0x5a000000) {
-               u  = (float)1.0+x; 
+               u  = (float)1.0+x;
                GET_FLOAT_WORD(hu,u);
                k  = (hu>>23)-127;
                /* correction term */
@@ -90,7 +90,7 @@ static float zero = 0.0;
            if(hu<0x3504f7) {
                SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */
            } else {
-               k += 1; 
+               k += 1;
                SET_FLOAT_WORD(u,hu|0x3f000000);        /* normalize u/2 */
                hu = (0x00800000-hu)>>2;
            }
@@ -98,13 +98,13 @@ static float zero = 0.0;
        }
        hfsq=(float)0.5*f*f;
        if(hu==0) {     /* |f| < 2**-20 */
-           if(f==zero) if(k==0) return zero;  
+           if(f==zero) if(k==0) return zero;
                        else {c += k*ln2_lo; return k*ln2_hi+c;}
            R = hfsq*((float)1.0-(float)0.66666666666666666*f);
            if(k==0) return f-R; else
                     return k*ln2_hi-((R-(k*ln2_lo+c))-f);
        }
-       s = f/((float)2.0+f); 
+       s = f/((float)2.0+f);
        z = s*s;
        R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
        if(k==0) return f-(hfsq-s*(hfsq+R)); else
index 46b53cfefffaedbf3cb7c3ad0906deb0da5a6673..93c20b3db15c4d9da270566326cfad5079d36d06 100644 (file)
@@ -93,8 +93,8 @@ static double zero   =  0.0;
        k=0;
        if (hx < 0x00100000) {                  /* x < 2**-1022  */
            if (((hx&0x7fffffff)|lx)==0)
-               return -two54/zero;             /* log(+-0)=-inf */
-           if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+               return -two54/(x-x);            /* log(+-0)=-inf */
+           if (hx<0) return (x-x)/(x-x);       /* log(-#) = NaN */
            k -= 54; x *= two54; /* subnormal number, scale up x */
            GET_HIGH_WORD(hx,x);
        }
index 6415c37f5303f797cd8f76bfa8fe450d41dc9c3c..da9dfb8324bee0a9d21f7ad353fba5be467bf3f9 100644 (file)
@@ -53,8 +53,8 @@ static float zero   =  0.0;
        k=0;
        if (ix < 0x00800000) {                  /* x < 2**-126  */
            if ((ix&0x7fffffff)==0)
-               return -two25/zero;             /* log(+-0)=-inf */
-           if (ix<0) return (x-x)/zero;        /* log(-#) = NaN */
+               return -two25/(x-x);            /* log(+-0)=-inf */
+           if (ix<0) return (x-x)/(x-x);       /* log(-#) = NaN */
            k -= 25; x *= two25; /* subnormal number, scale up x */
            GET_FLOAT_WORD(ix,x);
        }
index e50f7736142df11f6f74b820da6c14b1531ddf79..c0a17c73c23286ffea83d76e409c63e4add500e7 100644 (file)
@@ -234,11 +234,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
          if (sym->st_size > refsym->st_size
              || (_dl_verbose && sym->st_size < refsym->st_size))
            {
+             extern char **_dl_argv;
              const char *strtab;
 
              strtab = ((void *) map->l_addr
                        + map->l_info[DT_STRTAB]->d_un.d_ptr);
-             _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+             _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+                               ": Symbol `", strtab + refsym->st_name,
                                "' has different size in shared object, "
                                "consider re-linking\n", NULL);
            }
index cc7198b60e827272b2ffd2aa478a26ab7334d315..7456ae0b7a4f7a4c06767d050af1572a2640cc57 100644 (file)
@@ -125,32 +125,11 @@ elf_machine_got (void)
 }
 
 
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  */
-static inline ElfW(Addr)
-elf_machine_dynamic (void)
-{
-  register ElfW(Addr) gp asm ("$28");
-  return * (ElfW(Addr) *) (gp - 0x7ff0);
-}
-
 /* Return the run-time load address of the shared object.  */
 static inline ElfW(Addr)
 elf_machine_load_address (void)
 {
   ElfW(Addr) addr;
-#ifdef __mips64
-  asm ("       .set noreorder\n"
-       "       dla %0, here\n"
-       "       bltzal $0, here\n"
-       "       nop\n"
-       "here:  dsubu %0, $31, %0\n"
-       "       .set reorder\n"
-       :       "=r" (addr)
-       :       /* No inputs */
-       :       "$31");
-#else
   asm ("       .set noreorder\n"
        "       la %0, here\n"
        "       bltzal $0, here\n"
@@ -160,7 +139,6 @@ elf_machine_load_address (void)
        :       "=r" (addr)
        :       /* No inputs */
        :       "$31");
-#endif
   return addr;
 }
 
@@ -364,100 +342,6 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
      t8  index for this function symbol in .dynsym
    to usual c arguments.  */
 
-#ifdef __mips64
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE                                       \
-/* The flag _dl_mips_gnu_objects is set if all dynamic objects are           \
-   generated by the gnu linker. */                                           \
-int _dl_mips_gnu_objects = 1;                                                \
-                                                                             \
-/* This is called from assembly stubs below which the compiler can't see.  */ \
-static ElfW(Addr)                                                            \
-__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))        \
-                  __attribute__ ((unused));                                  \
-                                                                             \
-static ElfW(Addr)                                                            \
-__dl_runtime_resolve (ElfW(Word) sym_index,                                  \
-                     ElfW(Word) return_address,                              \
-                     ElfW(Addr) old_gpreg,                                   \
-                     ElfW(Addr) stub_pc)                                     \
-{                                                                            \
-  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);     \
-  const ElfW(Sym) *const symtab                                                      \
-    = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);     \
-  const char *strtab                                                         \
-    = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);               \
-  const ElfW(Addr) *got                                                              \
-    = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);    \
-  const ElfW(Word) local_gotno                                               \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;       \
-  const ElfW(Word) gotsym                                                    \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;            \
-  const ElfW(Sym) *definer;                                                  \
-  ElfW(Addr) loadbase;                                                       \
-  ElfW(Addr) funcaddr;                                                       \
-  struct link_map **scope;                                                   \
-                                                                             \
-  /* Look up the symbol's run-time value.  */                                \
-  scope = _dl_object_relocation_scope (l);                                   \
-  definer = &symtab[sym_index];                                                      \
-                                                                             \
-  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,         \
-                               scope, l->l_name, ELF_MACHINE_RELOC_NOPLT);   \
-                                                                             \
-  *_dl_global_scope_end = NULL;                                                      \
-                                                                             \
-  /* Apply the relocation with that value.  */                               \
-  funcaddr = loadbase + definer->st_value;                                   \
-  *(got + local_gotno + sym_index - gotsym) = funcaddr;                              \
-                                                                             \
-  return funcaddr;                                                           \
-}                                                                            \
-                                                                             \
-asm ("\n                                                                     \
-       .text\n                                                               \
-       .align  3\n                                                           \
-       .globl  _dl_runtime_resolve\n                                         \
-       .type   _dl_runtime_resolve,@function\n                               \
-       .ent    _dl_runtime_resolve\n                                         \
-_dl_runtime_resolve:\n                                                       \
-       .set noreorder\n                                                      \
-       # Save old GP to $3.\n                                                \
-       move    $3,$28\n                                                      \
-       # Modify t9 ($25) so as to point .cpload instruction.\n               \
-       daddu   $25,2*8\n                                                     \
-       # Compute GP.\n                                                       \
-       .cpload $25\n                                                         \
-       .set reorder\n                                                        \
-       # Save slot call pc.\n                                                \
-        move   $2, $31\n                                                     \
-       # Save arguments and sp value in stack.\n                             \
-       dsubu   $29, 10*8\n                                                   \
-       .cprestore 8*8\n                                                      \
-       sd      $15, 9*8($29)\n                                               \
-       sd      $4, 3*8($29)\n                                                \
-       sd      $5, 4*8($29)\n                                                \
-       sd      $6, 5*8($29)\n                                                \
-       sd      $7, 6*8($29)\n                                                \
-       sd      $16, 7*8($29)\n                                               \
-       move    $16, $29\n                                                    \
-       move    $4, $24\n                                                     \
-       move    $5, $15\n                                                     \
-       move    $6, $3\n                                                      \
-       move    $7, $2\n                                                      \
-       jal     __dl_runtime_resolve\n                                        \
-       move    $29, $16\n                                                    \
-       ld      $31, 9*8($29)\n                                               \
-       ld      $4, 3*8($29)\n                                                \
-       ld      $5, 4*8($29)\n                                                \
-       ld      $6, 5*8($29)\n                                                \
-       ld      $7, 6*8($29)\n                                                \
-       ld      $16, 7*8($29)\n                                               \
-       daddu   $29, 10*8\n                                                   \
-       move    $25, $2\n                                                     \
-       jr      $25\n                                                         \
-       .end    _dl_runtime_resolve\n                                         \
-");
-#else
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE                                       \
 /* The flag _dl_mips_gnu_objects is set if all dynamic objects are           \
    generated by the gnu linker. */                                           \
@@ -550,7 +434,6 @@ _dl_runtime_resolve:\n                                                            \
        jr      $25\n                                                         \
        .end    _dl_runtime_resolve\n                                         \
 ");
-#endif
 
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
@@ -573,78 +456,6 @@ _dl_runtime_resolve:\n                                                           \
    2) That under Linux the entry is named __start
       and not just plain _start.  */
 
-#ifdef __mips64
-#define RTLD_START asm ("\
-       .text\n\
-       .align  3\n"\
-_RTLD_PROLOGUE (ENTRY_POINT)\
-"      .globl _dl_start_user\n\
-       .set noreorder\n\
-       bltzal $0, 0f\n\
-       nop\n\
-0:     .cpload $31\n\
-       .set reorder\n\
-       # i386 ABI book says that the first entry of GOT holds\n\
-       # the address of the dynamic structure. Though MIPS ABI\n\
-       # doesn't say nothing about this, I emulate this here.\n\
-       dla $4, _DYNAMIC\n\
-       sd $4, -0x7ff0($28)\n\
-       move $4, $29\n\
-       jal _dl_start\n\
-       # Get the value of label '_dl_start_user' in t9 ($25).\n\
-       dla $25, _dl_start_user\n\
-_dl_start_user:\n\
-       .set noreorder\n\
-       .cpload $25\n\
-       .set reorder\n\
-       move $16, $28\n\
-       # Save the user entry point address in saved register.\n\
-       move $17, $2\n\
-       # See if we were run as a command with the executable file\n\
-       # name as an extra leading argument.\n\
-       ld $2, _dl_skip_args\n\
-       beq $2, $0, 1f\n\
-       # Load the original argument count.\n\
-       ld $4, 0($29)\n\
-       # Subtract _dl_skip_args from it.\n\
-       dsubu $4, $2\n\
-       # Adjust the stack pointer to skip _dl_skip_args words.\n\
-       dsll $2,2\n\
-       daddu $29, $2\n\
-       # Save back the modified argument count.\n\
-       sd $4, 0($29)\n\
-       # Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\
-1:     dla $2, _dl_default_scope\n\
-       ld $4, 2*8($2)\n\
-       # Call _dl_init_next to return the address of an initializer\n\
-       # function to run.\n\
-       jal _dl_init_next\n\
-       move $28, $16\n\
-       # Check for zero return,  when out of initializers.\n\
-       beq $2, $0, 2f\n\
-       # Call the shared object initializer function.\n\
-       move $25, $2\n\
-       ld $4, 0($29)\n\
-       ld $5, 1*8($29)\n\
-       ld $6, 2*8($29)\n\
-       ld $7, 3*8($29)\n\
-       jalr $25\n\
-       move $28, $16\n\
-       # Loop to call _dl_init_next for the next initializer.\n\
-       b 1b\n\
-       # Pass our finalizer function to the user in ra.\n\
-2:     dla $31, _dl_fini\n\
-       # Jump to the user entry point.\n\
-       move $25, $17\n\
-       ld $4, 0($29)\n\
-       ld $5, 1*8($29)\n\
-       ld $6, 2*8$29)\n\
-       ld $7, 3*8($29)\n\
-       jr $25\n"\
-_RTLD_EPILOGUE(ENTRY_POINT) \
-);
-
-#else
 #define RTLD_START asm ("\
        .text\n"\
 _RTLD_PROLOGUE(ENTRY_POINT)\
@@ -718,8 +529,7 @@ _dl_start_user:\n\
        lw $7, 12($29)\n\
        jr $25\n"\
 _RTLD_EPILOGUE(ENTRY_POINT)\
-");
-#endif
+);
 
 /* The MIPS never uses Elfxx_Rela relocations.  */
 #define ELF_MACHINE_NO_RELA 1
diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h
new file mode 100644 (file)
index 0000000..3277b10
--- /dev/null
@@ -0,0 +1,594 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
+
+   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 dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "MIPS"
+
+#include <assert.h>
+#include <entry.h>
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for MIPS.
+#endif
+
+#ifndef _RTLD_PROLOGUE
+#ifdef __STDC__
+#define _RTLD_PROLOGUE(entry) "\n\t.globl " #entry \
+                             "\n\t.ent " #entry \
+                             "\n\t" #entry ":\n\t"
+#else
+#define _RTLD_PROLOGUE(entry) "\n\t.globl entry\n\t.ent entry\n\t entry:\n\t"
+#endif
+#endif
+
+#ifndef _RTLD_EPILOGUE
+#ifdef __STDC__
+#define _RTLD_EPILOGUE(entry) "\t.end " #entry "\n"
+#else
+#define _RTLD_EPILOGUE(entry) "\t.end entry\n"
+#endif
+#endif
+
+/* I have no idea what I am doing. */
+#define ELF_MACHINE_RELOC_NOPLT                        -1
+#define elf_machine_lookup_noplt_p(type)       (1)
+#define elf_machine_lookup_noexec_p(type)      (0)
+
+/* Translate a processor specific dynamic tag to the index
+   in l_info array.  */
+#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
+
+#if 0
+/* We may need 64k alignment. */
+#define ELF_MACHINE_ALIGN_MASK 0xffff
+#endif
+
+/*
+ * MIPS libraries are usually linked to a non-zero base address.  We
+ * subtrace the base address from the address where we map the object
+ * to.  This results in more efficient address space usage.
+ */
+#if 0
+#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \
+                         (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0)
+#else
+#define MAP_BASE_ADDR(l) 0x5ffe0000
+#endif
+
+/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
+   with the run-time address of the r_debug structure  */
+#define ELF_MACHINE_DEBUG_SETUP(l,r) \
+do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
+       *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
+       (ElfW(Addr)) (r); \
+   } while (0)
+
+/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+static inline int __attribute__ ((unused))
+elf_machine_matches_host (ElfW(Half) e_machine)
+{
+  switch (e_machine)
+    {
+    case EM_MIPS:
+    case EM_MIPS_RS4_BE:
+      return 1;
+    default:
+      return 0;
+    }
+}
+
+/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
++   first element of the GOT.  This must be inlined in a function which
++   uses global data.  */
++static inline ElfW(Addr)
++elf_machine_dynamic (void)
++{
++  register ElfW(Addr) gp asm ("$28");
++  return * (ElfW(Addr) *) (gp - 0x7ff0);
++}
++
+static inline ElfW(Addr) *
+elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
+{
+  /* FIXME: the offset of gp from GOT may be system-dependent. */
+  return (ElfW(Addr) *) (gpreg - 0x7ff0);
+}
+
+/* Return the run-time address of the _GLOBAL_OFFSET_TABLE_.
+   Must be inlined in a function which uses global data.  */
+static inline ElfW(Addr) *
+elf_machine_got (void)
+{
+  ElfW(Addr) gp;
+
+  __asm__ __volatile__("move %0, $28\n\t" : "=r" (gp));
+  return elf_mips_got_from_gpreg (gp);
+}
+
+
+/* Return the run-time load address of the shared object.  */
+static inline ElfW(Addr)
+elf_machine_load_address (void)
+{
+  ElfW(Addr) addr;
+  asm ("       .set noreorder\n"
+       "       dla %0, here\n"
+       "       bltzal $0, here\n"
+       "       nop\n"
+       "here:  dsubu %0, $31, %0\n"
+       "       .set reorder\n"
+       :       "=r" (addr)
+       :       /* No inputs */
+       :       "$31");
+  return addr;
+}
+
+/* The MSB of got[1] of a gnu object is set to identify gnu objects. */
+#define ELF_MIPS_GNU_GOT1_MASK 0x80000000
+
+/* Relocate GOT. */
+static inline void
+elf_machine_got_rel (struct link_map *map, int lazy)
+{
+  ElfW(Addr) *got;
+  ElfW(Sym) *sym;
+  int i, n;
+  struct link_map **scope;
+  const char *strtab
+    = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
+
+#define RESOLVE_GOTSYM(sym) \
+    ({ \
+      const ElfW(Sym) *ref = sym; \
+      ElfW(Addr) sym_loadaddr; \
+      sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope, \
+                                       map->l_name, ELF_MACHINE_RELOC_NOPLT);\
+      (ref)? sym_loadaddr + ref->st_value: 0; \
+    })
+
+  got = (ElfW(Addr) *) ((void *) map->l_addr
+                       + map->l_info[DT_PLTGOT]->d_un.d_ptr);
+
+  /* got[0] is reserved. got[1] is also reserved for the dynamic object
+     generated by gnu ld. Skip these reserved entries from relocation.  */
+  i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2: 1;
+  n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
+  /* Add the run-time display to all local got entries. */
+  while (i < n)
+    got[i++] += map->l_addr;
+
+  /* Set scope.  */
+  scope = _dl_object_relocation_scope (map);
+
+  /* Handle global got entries. */
+  got += n;
+  sym = (ElfW(Sym) *) ((void *) map->l_addr
+                      + map->l_info[DT_SYMTAB]->d_un.d_ptr);
+  sym += map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
+  i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val
+       - map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val);
+
+  while (i--)
+    {
+      if (sym->st_shndx == SHN_UNDEF)
+       {
+         if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC)
+           {
+             if (sym->st_value && lazy)
+               *got = sym->st_value + map->l_addr;
+             else
+               *got = RESOLVE_GOTSYM (sym);
+           }
+         else /* if (*got == 0 || *got == QS) */
+           *got = RESOLVE_GOTSYM (sym);
+       }
+      else if (sym->st_shndx == SHN_COMMON)
+       *got = RESOLVE_GOTSYM (sym);
+      else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
+              && *got != sym->st_value
+              && lazy)
+       *got += map->l_addr;
+      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
+       {
+         if (sym->st_other == 0)
+           *got += map->l_addr;
+       }
+      else
+       *got = RESOLVE_GOTSYM (sym);
+
+      got++;
+      sym++;
+    }
+
+#undef RESOLVE_GOTSYM
+  *_dl_global_scope_end = NULL;
+
+  return;
+}
+
+/* Set up the loaded object described by L so its stub function
+   will jump to the on-demand fixup code in dl-runtime.c.  */
+
+static inline int
+elf_machine_runtime_setup (struct link_map *l, int lazy)
+{
+  ElfW(Addr) *got;
+  extern void _dl_runtime_resolve (ElfW(Word));
+  extern int _dl_mips_gnu_objects;
+
+#ifdef RTLD_BOOTSTRAP
+    {
+      return lazy;
+    }
+#endif
+  if (lazy)
+    {
+      /* The GOT entries for functions have not yet been filled in.
+        Their initial contents will arrange when called to put an
+        offset into the .dynsym section in t8, the return address
+        in t7 and then jump to _GLOBAL_OFFSET_TABLE[0].  */
+      got = (ElfW(Addr) *) ((void *) l->l_addr
+                           + l->l_info[DT_PLTGOT]->d_un.d_ptr);
+
+      /* This function will get called to fix up the GOT entry indicated by
+        the register t8, and then jump to the resolved address.  */
+      got[0] = (ElfW(Addr)) &_dl_runtime_resolve;
+
+      /* Store l to _GLOBAL_OFFSET_TABLE[1] for gnu object. The MSB
+        of got[1] of a gnu object is set to identify gnu objects.
+        Where we can store l for non gnu objects? XXX  */
+      if ((got[1] & ELF_MIPS_GNU_GOT1_MASK) != 0)
+       got[1] = (ElfW(Addr)) ((unsigned) l | ELF_MIPS_GNU_GOT1_MASK);
+      else
+       _dl_mips_gnu_objects = 0;
+    }
+
+  /* Relocate global offset table.  */
+  elf_machine_got_rel (l, lazy);
+
+  return lazy;
+}
+
+/* Get link_map for this object.  */
+static inline struct link_map *
+elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
+{
+  extern int _dl_mips_gnu_objects;
+
+  /* got[1] is reserved to keep its link map address for the shared
+     object generated by gnu linker. If all are such object, we can
+     find link map from current GPREG simply. If not so, get link map
+     for callers object containing STUB_PC.  */
+
+  if (_dl_mips_gnu_objects)
+    {
+      ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
+      ElfW(Word) g1;
+
+      g1 = ((ElfW(Word) *) got)[1];
+
+      if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
+       return (struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
+    }
+
+    {
+      struct link_map *l = _dl_loaded;
+      struct link_map *ret = 0;
+      ElfW(Addr) candidate = 0;
+
+      while (l)
+       {
+         ElfW(Addr) base = 0;
+         const ElfW(Phdr) *p = l->l_phdr;
+         ElfW(Half) this, nent = l->l_phnum;
+
+         /* Get the base. */
+         for (this = 0; this < nent; this++)
+           if (p[this].p_type == PT_LOAD)
+             {
+               base = p[this].p_vaddr + l->l_addr;
+               break;
+             }
+         if (! base)
+           {
+             l = l->l_next;
+             continue;
+           }
+
+         /* Find closest link base addr. */
+         if ((base < stub_pc) && (candidate < base))
+           {
+             candidate = base;
+             ret = l;
+           }
+         l = l->l_next;
+       }
+      if (candidate && ret && (candidate < stub_pc))
+       return ret;
+      else if (!candidate)
+       return _dl_loaded;
+    }
+
+  _dl_signal_error (0, NULL, "cannot find runtime link map");
+  return NULL;
+}
+
+/* Mips has no PLT but define elf_machine_relplt to be elf_machine_rel. */
+#define elf_machine_relplt elf_machine_rel
+
+/* Define mips specific runtime resolver. The function __dl_runtime_resolve
+   is called from assembler function _dl_runtime_resolve which converts
+   special argument registers t7 ($15) and t8 ($24):
+     t7  address to return to the caller of the function
+     t8  index for this function symbol in .dynsym
+   to usual c arguments.  */
+
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE                                       \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are           \
+   generated by the gnu linker. */                                           \
+int _dl_mips_gnu_objects = 1;                                                \
+                                                                             \
+/* This is called from assembly stubs below which the compiler can't see.  */ \
+static ElfW(Addr)                                                            \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))        \
+                  __attribute__ ((unused));                                  \
+                                                                             \
+static ElfW(Addr)                                                            \
+__dl_runtime_resolve (ElfW(Word) sym_index,                                  \
+                     ElfW(Word) return_address,                              \
+                     ElfW(Addr) old_gpreg,                                   \
+                     ElfW(Addr) stub_pc)                                     \
+{                                                                            \
+  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);     \
+  const ElfW(Sym) *const symtab                                                      \
+    = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);     \
+  const char *strtab                                                         \
+    = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);               \
+  const ElfW(Addr) *got                                                              \
+    = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);    \
+  const ElfW(Word) local_gotno                                               \
+    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;       \
+  const ElfW(Word) gotsym                                                    \
+    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;            \
+  const ElfW(Sym) *definer;                                                  \
+  ElfW(Addr) loadbase;                                                       \
+  ElfW(Addr) funcaddr;                                                       \
+  struct link_map **scope;                                                   \
+                                                                             \
+  /* Look up the symbol's run-time value.  */                                \
+  scope = _dl_object_relocation_scope (l);                                   \
+  definer = &symtab[sym_index];                                                      \
+                                                                             \
+  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,         \
+                               scope, l->l_name, ELF_MACHINE_RELOC_NOPLT);   \
+                                                                             \
+  *_dl_global_scope_end = NULL;                                                      \
+                                                                             \
+  /* Apply the relocation with that value.  */                               \
+  funcaddr = loadbase + definer->st_value;                                   \
+  *(got + local_gotno + sym_index - gotsym) = funcaddr;                              \
+                                                                             \
+  return funcaddr;                                                           \
+}                                                                            \
+                                                                             \
+asm ("\n                                                                     \
+       .text\n                                                               \
+       .align  3\n                                                           \
+       .globl  _dl_runtime_resolve\n                                         \
+       .type   _dl_runtime_resolve,@function\n                               \
+       .ent    _dl_runtime_resolve\n                                         \
+_dl_runtime_resolve:\n                                                       \
+       .set noreorder\n                                                      \
+       # Save old GP to $3.\n                                                \
+       move    $3,$28\n                                                      \
+       # Modify t9 ($25) so as to point .cpload instruction.\n               \
+       daddu   $25,2*8\n                                                     \
+       # Compute GP.\n                                                       \
+       .cpload $25\n                                                         \
+       .set reorder\n                                                        \
+       # Save slot call pc.\n                                                \
+        move   $2, $31\n                                                     \
+       # Save arguments and sp value in stack.\n                             \
+       dsubu   $29, 10*8\n                                                   \
+       .cprestore 8*8\n                                                      \
+       sd      $15, 9*8($29)\n                                               \
+       sd      $4, 3*8($29)\n                                                \
+       sd      $5, 4*8($29)\n                                                \
+       sd      $6, 5*8($29)\n                                                \
+       sd      $7, 6*8($29)\n                                                \
+       sd      $16, 7*8($29)\n                                               \
+       move    $16, $29\n                                                    \
+       move    $4, $24\n                                                     \
+       move    $5, $15\n                                                     \
+       move    $6, $3\n                                                      \
+       move    $7, $2\n                                                      \
+       jal     __dl_runtime_resolve\n                                        \
+       move    $29, $16\n                                                    \
+       ld      $31, 9*8($29)\n                                               \
+       ld      $4, 3*8($29)\n                                                \
+       ld      $5, 4*8($29)\n                                                \
+       ld      $6, 5*8($29)\n                                                \
+       ld      $7, 6*8($29)\n                                                \
+       ld      $16, 7*8($29)\n                                               \
+       daddu   $29, 10*8\n                                                   \
+       move    $25, $2\n                                                     \
+       jr      $25\n                                                         \
+       .end    _dl_runtime_resolve\n                                         \
+");
+
+/* Mask identifying addresses reserved for the user program,
+   where the dynamic linker should not map anything.  */
+#define ELF_MACHINE_USER_ADDRESS_MASK  0x80000000UL
+
+
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.
+   Note how we have to be careful about two things:
+
+   1) That we allocate a minimal stack of 24 bytes for
+      every function call, the MIPS ABI states that even
+      if all arguments are passed in registers the procedure
+      called can use the 16 byte area pointed to by $sp
+      when it is called to store away the arguments passed
+      to it.
+
+   2) That under Linux the entry is named __start
+      and not just plain _start.  */
+
+#define RTLD_START asm ("\
+       .text\n\
+       .align  3\n"\
+_RTLD_PROLOGUE (ENTRY_POINT)\
+"      .globl _dl_start_user\n\
+       .set noreorder\n\
+       bltzal $0, 0f\n\
+       nop\n\
+0:     .cpload $31\n\
+       .set reorder\n\
+       # i386 ABI book says that the first entry of GOT holds\n\
+       # the address of the dynamic structure. Though MIPS ABI\n\
+       # doesn't say nothing about this, I emulate this here.\n\
+       dla $4, _DYNAMIC\n\
+       sd $4, -0x7ff0($28)\n\
+       move $4, $29\n\
+       jal _dl_start\n\
+       # Get the value of label '_dl_start_user' in t9 ($25).\n\
+       dla $25, _dl_start_user\n\
+_dl_start_user:\n\
+       .set noreorder\n\
+       .cpload $25\n\
+       .set reorder\n\
+       move $16, $28\n\
+       # Save the user entry point address in saved register.\n\
+       move $17, $2\n\
+       # See if we were run as a command with the executable file\n\
+       # name as an extra leading argument.\n\
+       ld $2, _dl_skip_args\n\
+       beq $2, $0, 1f\n\
+       # Load the original argument count.\n\
+       ld $4, 0($29)\n\
+       # Subtract _dl_skip_args from it.\n\
+       dsubu $4, $2\n\
+       # Adjust the stack pointer to skip _dl_skip_args words.\n\
+       dsll $2,2\n\
+       daddu $29, $2\n\
+       # Save back the modified argument count.\n\
+       sd $4, 0($29)\n\
+       # Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\
+1:     dla $2, _dl_default_scope\n\
+       ld $4, 2*8($2)\n\
+       # Call _dl_init_next to return the address of an initializer\n\
+       # function to run.\n\
+       jal _dl_init_next\n\
+       move $28, $16\n\
+       # Check for zero return,  when out of initializers.\n\
+       beq $2, $0, 2f\n\
+       # Call the shared object initializer function.\n\
+       move $25, $2\n\
+       ld $4, 0($29)\n\
+       ld $5, 1*8($29)\n\
+       ld $6, 2*8($29)\n\
+       ld $7, 3*8($29)\n\
+       jalr $25\n\
+       move $28, $16\n\
+       # Loop to call _dl_init_next for the next initializer.\n\
+       b 1b\n\
+       # Pass our finalizer function to the user in ra.\n\
+2:     dla $31, _dl_fini\n\
+       # Jump to the user entry point.\n\
+       move $25, $17\n\
+       ld $4, 0($29)\n\
+       ld $5, 1*8($29)\n\
+       ld $6, 2*8$29)\n\
+       ld $7, 3*8($29)\n\
+       jr $25\n"\
+_RTLD_EPILOGUE(ENTRY_POINT) \
+);
+
+
+/* The MIPS never uses Elfxx_Rela relocations.  */
+#define ELF_MACHINE_NO_RELA 1
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+static inline void
+elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
+                const ElfW(Sym) *sym, const struct r_found_version *version)
+{
+  ElfW(Addr) *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+  ElfW(Addr) loadbase;
+  ElfW(Addr) undo __attribute__ ((unused));
+
+  switch (ELFW(R_TYPE) (reloc->r_info))
+    {
+    case R_MIPS_REL32:
+      {
+       ElfW(Addr) undo = 0;
+
+       if (ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
+           && (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
+               || ELFW(ST_TYPE) (sym->st_info) == STT_NOTYPE))
+         {
+           *reloc_addr += map->l_addr;
+           break;
+         }
+#ifndef RTLD_BOOTSTRAP
+       /* This is defined in rtld.c, but nowhere in the static libc.a;
+          make the reference weak so static programs can still link.  This
+          declaration cannot be done when compiling rtld.c (i.e.  #ifdef
+          RTLD_BOOTSTRAP) because rtld.c contains the common defn for
+          _dl_rtld_map, which is incompatible with a weak decl in the same
+          file.  */
+       weak_extern (_dl_rtld_map);
+       if (map == &_dl_rtld_map)
+         /* Undo the relocation done here during bootstrapping.  Now we will
+            relocate it anew, possibly using a binding found in the user
+            program or a loaded library rather than the dynamic linker's
+            built-in definitions used while loading those libraries.  */
+         undo = map->l_addr + sym->st_value;
+#endif
+         loadbase = RESOLVE (&sym, version, 0);
+         *reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo;
+       }
+      break;
+    case R_MIPS_NONE:          /* Alright, Wilbur.  */
+      break;
+    default:
+      assert (! "unexpected dynamic reloc type");
+      break;
+    }
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map, const ElfW(Rel) *reloc)
+{
+  /* Do nothing.  */
+}
+
+#endif /* RESOLVE */
diff --git a/sysdeps/mips/rtld-parms b/sysdeps/mips/rtld-parms
new file mode 100644 (file)
index 0000000..72f09e7
--- /dev/null
@@ -0,0 +1,15 @@
+ifndef rtld-wordsize
+rtld-wordsize = 32
+endif
+ifndef rtld-oformat
+rtld-oformat = elf$(rtld-wordsize)-bigmips
+endif
+ifndef rtld-arch
+rtld-arch = mips
+endif
+ifndef rtld-entry
+rtld-entry = __start
+endif
+ifndef rtld-base
+rtld-base = 0x0fb60000 + SIZEOF_HEADERS
+endif
index e0e90cfd7a4c136d82b81943c722bc8aa4f2d46f..d3ff74f12f2e96b3113b26410fa40a76d59f0ff2 100644 (file)
@@ -1,3 +1,32 @@
-/* PowerPC is big-endian.  */
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#define __BYTE_ORDER __BIG_ENDIAN
+   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.  */
+
+/* PowerPC can be little or big endian.  Hopefully gcc will know...  */
+
+#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  error Please fix sysdeps/powerpc/bits/endian.h (compiling bi-endian?).
+# endif
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+#  error Please fix sysdeps/powerpc/bits/endian.h.
+# endif
+#endif
index 6ddbea584b851859c89902c16338fc29218b4381..12bcf43e4d389a9aad74fbfc0bc21382aa6da935 100644 (file)
@@ -598,11 +598,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       if (sym->st_size > refsym->st_size
          || (_dl_verbose && sym->st_size < refsym->st_size))
        {
+         extern char **_dl_argv;
          const char *strtab;
 
          strtab = ((void *) map->l_addr
                    + map->l_info[DT_STRTAB]->d_un.d_ptr);
-         _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+         _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+                           ": Symbol `", strtab + refsym->st_name,
                            "' has different size in shared object, "
                            "consider re-linking\n", NULL);
        }
index 20def2c5b7259920d341d5edf397458450183374..1d193ae91c38a4207df4d0b52241c074a9b7ee55 100644 (file)
@@ -133,11 +133,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
          if (sym->st_size > refsym->st_size
              || (_dl_verbose && sym->st_size < refsym->st_size))
            {
+             extern char **_dl_argv;
              const char *strtab;
 
              strtab = ((void *) map->l_addr
                        + map->l_info[DT_STRTAB]->d_un.d_ptr);
-             _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+             _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+                               ": Symbol `", strtab + refsym->st_name,
                                "' has different size in shared object, "
                                "consider re-linking\n", NULL);
            }
index 21c3d6b9bd4771329ec340327209ba4417d4ec78..ad216b79dca6df260fe310cfccabf7e65c9fb2bc 100644 (file)
@@ -110,11 +110,13 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
          if (sym->st_size > refsym->st_size
              || (_dl_verbose && sym->st_size < refsym->st_size))
            {
+             extern char **_dl_argv;
              const char *strtab;
 
              strtab = ((void *) map->l_addr
                        + map->l_info[DT_STRTAB]->d_un.d_ptr);
-             _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+             _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+                               ": Symbol `", strtab + refsym->st_name,
                                "' has different size in shared object, "
                                "consider re-linking\n", NULL);
            }
index 2004a48b42572a75f4ebb5bccc8f7c71705b1bc6..1c5da4b9bf03944ae1b9531ad46458dd1c0e4917 100644 (file)
@@ -9,7 +9,7 @@ sysdep_routines += sysctl clone llseek
 
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
                  sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \
-                 sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.h \
+                 sys/user.h sys/sysmacros.h sys/procfs.h \
                  sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \
                  sys/quota.h
 
index af5b96c22fdc1f8128b0f65c78613573ec43dcb5..93e13ea9a10cdc17d5a276a1478a309d18040d52 100644 (file)
 
 #include "DEFS.h"
 
-ENTRY(htonl, 0)
+ENTRY(__htonl, 0)
        rotl    $-8,4(ap),r0
        insv    r0,$16,$8,r0
        movb    7(ap),r0
        ret
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
index c500e8450630acc911ffb86cfaff702a07b6ec64..16964c286197d711e88114f2636e468712d3729c 100644 (file)
@@ -28,3 +28,6 @@ ENTRY(htons, 0)
        movb    5(ap),r0
        movzwl  r0,r0
        ret
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
diff --git a/sysdeps/vax/ntohl.s b/sysdeps/vax/ntohl.s
deleted file mode 100644 (file)
index 0fcaa2f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-       .asciz "@(#)ntohl.s     5.5 (Berkeley) 6/27/88"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohl(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohl, 0)
-       rotl    $-8,4(ap),r0
-       insv    r0,$16,$8,r0
-       movb    7(ap),r0
-       ret
diff --git a/sysdeps/vax/ntohs.s b/sysdeps/vax/ntohs.s
deleted file mode 100644 (file)
index 626a37b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-       .asciz "@(#)ntohs.s     5.5 (Berkeley) 6/27/88"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohs(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohs, 0)
-       rotl    $8,4(ap),r0
-       movb    5(ap),r0
-       movzwl  r0,r0
-       ret
This page took 0.230331 seconds and 5 git commands to generate.