diff options
95 files changed, 4261 insertions, 531 deletions
@@ -1,3 +1,127 @@ +2000-10-14 Ulrich Drepper <drepper@redhat.com> + + * math/libm-test.inc (frexp_test): Add L suffix also to parameters. + (hypot_test): Likewise. + + * sysdeps/generic/printf_fphex.c: Compute width of decimal point + string correctly. Handle padding correctly. + + * sysdeps/ia64/fpu/printf_fphex.c: Use sizeof in _itowa parameters + correctly. + * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. + * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. + +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * FAQ.in: Add --start-group and --end-group. + +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * malloc/memusage.c: Conditionalize stack usage calculation on + stack direction. + +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * config.h.in: Add ASM_LINE_SEP. + * configure.in: Add test for comment and line separators. + * include/libc-symbols.h: Define and use ASM_LINE_SEP, and add tabs to + placate some hppa assemblers. + * sysdeps/hppa/sysdep.h: Likewise. + * sysdeps/gnu/siglist.c: Insert \n and \t into inline asm. + * sysdeps/unix/sysv/linux/errlist.c: Likewise. + +2000-10-12 David Huggins-Daines <dhd@linuxcare.com> + + * sysdeps/unix/sysv/linux/Makefile: Include <bits/initspin> in + $(sysdep_headers). + * sysdeps/unix/sysv/linux/bits/initspin.h: Dummy version for + non-threaded platforms. + +2000-10-12 David Huggins-Daines <dhd@linuxcare.com> + + * configure.in: Add definitions for hppa. + * elf/elf.h: Add PLABEL32 relocation for hppa ELF32, comments + for IPLT and EPLT relocations. + * shlib-versions: Version symbol definitions for hppa-linux. + * sysdeps/unix/sysv/linux/configure.in: Define $arch_minimum_kernel + for hppa. + +2000-10-12 David Huggins-Daines <dhd@linuxcare.com> + + * sysdeps/hppa/Makefile: New file. + * sysdeps/hppa/Versions: New file. + + * sysdeps/hppa/setjmp.S: New file. + * sysdeps/hppa/__longjmp.S: New file. + * sysdeps/hppa/bits/setjmp.h: New file. + * sysdeps/hppa/frame.h: New file. + + * sysdeps/hppa/add_n.s: Don't use %r19 (linkage table pointer). + * sysdeps/hppa/sub_n.s: Likewise. + * sysdeps/hppa/lshift.s: Likewise. + * sysdeps/hppa/rshift.s: Likewise. + * sysdeps/hppa/udiv_qrnnd.s: Likewise. + * sysdeps/hppa/hppa1.1/addmul_1.s: Likewise. + * sysdeps/hppa/hppa1.1/submul_1.s: Likewise. + * sysdeps/hppa/hppa1.1/mul_1.s: Likewise. + * sysdeps/hppa/hppa1.1/udiv_qrnnd.s: Likewise. + + * sysdeps/hppa/dl-machine.h: New file. + * sysdeps/hppa/dl-fptr.c: New file (note that this is almost + identical to the IA-64 one). + * sysdeps/hppa/dl-lookupcfg.h: Likewise. + * sysdeps/hppa/dl-symaddr.c: Likewise. + + * sysdeps/hppa/elf/initfini.c: New file. + * sysdeps/hppa/elf/start.S: New file. + + * sysdeps/hppa/fpu/bits/fenv.h: New file. + * sysdeps/hppa/fpu/fclrexcpt.c: New file. + * sysdeps/hppa/fpu/fedisblxcpt.c: New file. + * sysdeps/hppa/fpu/feenablxcpt.c: New file. + * sysdeps/hppa/fpu/fegetenv.c: New file. + * sysdeps/hppa/fpu/fegetexcept.c: New file. + * sysdeps/hppa/fpu/fegetround.c: New file. + * sysdeps/hppa/fpu/feholdexcpt.c: New file. + * sysdeps/hppa/fpu/fesetenv.c: New file. + * sysdeps/hppa/fpu/fesetround.c: New file. + * sysdeps/hppa/fpu/feupdateenv.c: New file. + * sysdeps/hppa/fpu/fegetexcptflg.c: New file. + * sysdeps/hppa/fpu/fraiseexcpt.c: New file. + * sysdeps/hppa/fpu/fsetexcptflg.c: New file. + * sysdeps/hppa/fpu/ftestexcept.c: New file. + + * sysdeps/unix/sysv/linux/hppa/Makefile: New file. + * sysdeps/unix/sysv/linux/hppa/Versions: New file. + * sysdeps/unix/sysv/linux/hppa/syscalls.list: New file. + * sysdeps/unix/sysv/linux/hppa/sysdep.c: New file. + * sysdeps/unix/sysv/linux/hppa/sysdep.h: New file. + + * sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: New file. + * sysdeps/unix/sysv/linux/hppa/bits/ioctls.h: New file. + * sysdeps/unix/sysv/linux/hppa/bits/mman.h: New file. + * sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: New file. + * sysdeps/unix/sysv/linux/hppa/bits/signum.h: New file. + * sysdeps/unix/sysv/linux/hppa/brk.c: New file. + * sysdeps/unix/sysv/linux/hppa/clone.S: New file. + * sysdeps/unix/sysv/linux/hppa/socket.S: New file. + * sysdeps/unix/sysv/linux/hppa/syscall.S: New file. + * sysdeps/unix/sysv/linux/hppa/setrlimit.c: New file. + * sysdeps/unix/sysv/linux/hppa/getrlimit.c: New file. + * sysdeps/unix/sysv/linux/hppa/getrlimit64.c: New file. + * sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h: New file. + * sysdeps/unix/sysv/linux/hppa/kernel_stat.h: New file. + * sysdeps/unix/sysv/linux/hppa/mmap.c: New file. + * sysdeps/unix/sysv/linux/hppa/profil-counter.h: New file. + * sysdeps/unix/sysv/linux/hppa/procfs.h: New file. + * sysdeps/unix/sysv/linux/hppa/ucontext.h: New file. + * sysdeps/unix/sysv/linux/hppa/umount.c: New file. + +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * sysdeps/hppa/hppa1.1/Implies: New file. + * sysdeps/hppa/memusage.h: New file. + 2000-10-28 Jes Sorensen <jes@linuxcare.com> * sysdeps/unix/sysv/linux/ia64/Versions: Export ioperm, iopl, inb, @@ -811,8 +811,8 @@ can create a static binary that will use only the services dns and files (change /etc/nsswitch.conf for this). You need to link explicitly against all these services. For example: - gcc -static test-netdb.c -o test-netdb.c \ - -lc -lnss_files -lnss_dns -lresolv + gcc -static test-netdb.c -o test-netdb \ + -Wl,--start-group -lc -lnss_files -lnss_dns -lresolv -Wl,--end-group The problem with this approach is that you've got to link every static program that uses NSS routines with all those libraries. diff --git a/config.h.in b/config.h.in index b28aa47..1f41798 100644 --- a/config.h.in +++ b/config.h.in @@ -18,6 +18,10 @@ /* Define if weak symbols are available via the `.weakext' directive. */ #undef HAVE_ASM_WEAKEXT_DIRECTIVE +/* Define to the assembler line separator character for multiple + assembler instructions per line. Default is `;' */ +#undef ASM_LINE_SEP + /* Define if not using ELF, but `.init' and `.fini' sections are available. */ #undef HAVE_INITFINI @@ -949,7 +949,8 @@ 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 ;; +hppa*64*) base_machine=hppa machine=hppa/hppa64 ;; +hppa*) base_machine=hppa machine=hppa/hppa1.1 ;; i[3456]86) base_machine=i386 machine=i386/$machine ;; ia64) base_machine=ia64 machine=ia64 ;; m680?0) base_machine=m68k machine=m68k/$machine ;; @@ -986,7 +987,7 @@ fi # This can take a while to compute. sysdep_dir=$srcdir/sysdeps echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6 -echo "configure:990: checking sysdep dirs" >&5 +echo "configure:991: 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'`" @@ -1192,7 +1193,7 @@ echo "$ac_t""$default_sysnames" 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:1196: checking for a BSD compatible install" >&5 +echo "configure:1197: 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 @@ -1249,7 +1250,7 @@ if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then INSTALL='\$(..)./scripts/install-sh -c' fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1253: checking whether ln -s works" >&5 +echo "configure:1254: 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 @@ -1278,7 +1279,7 @@ fi # Extract the first word of "pwd", so it can be a program name with args. set dummy pwd; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1282: checking for $ac_word" >&5 +echo "configure:1283: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PWD_P'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1317,7 +1318,7 @@ fi # These programs are version sensitive. echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1321: checking build system type" >&5 +echo "configure:1322: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1345,7 +1346,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:1349: checking for $ac_word" >&5 +echo "configure:1350: 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 @@ -1379,7 +1380,7 @@ if test -z "$CC"; then else # Found it, now check the version. echo $ac_n "checking version of $CC""... $ac_c" 1>&6 -echo "configure:1383: checking version of $CC" >&5 +echo "configure:1384: checking version of $CC" >&5 ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1399,7 +1400,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:1403: checking for $ac_word" >&5 +echo "configure:1404: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1433,7 +1434,7 @@ if test -z "$MAKE"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKE""... $ac_c" 1>&6 -echo "configure:1437: checking version of $MAKE" >&5 +echo "configure:1438: checking version of $MAKE" >&5 ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1454,7 +1455,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:1458: checking for $ac_word" >&5 +echo "configure:1459: 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 @@ -1488,7 +1489,7 @@ if test -z "$MSGFMT"; then else # Found it, now check the version. echo $ac_n "checking version of $MSGFMT""... $ac_c" 1>&6 -echo "configure:1492: checking version of $MSGFMT" >&5 +echo "configure:1493: checking version of $MSGFMT" >&5 ac_prog_version=`$MSGFMT --version 2>&1 | sed -n 's/^.*GNU gettext.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1508,7 +1509,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:1512: checking for $ac_word" >&5 +echo "configure:1513: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1542,7 +1543,7 @@ if test -z "$MAKEINFO"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKEINFO""... $ac_c" 1>&6 -echo "configure:1546: checking version of $MAKEINFO" >&5 +echo "configure:1547: checking version of $MAKEINFO" >&5 ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1562,7 +1563,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:1566: checking for $ac_word" >&5 +echo "configure:1567: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1596,7 +1597,7 @@ if test -z "$SED"; then else # Found it, now check the version. echo $ac_n "checking version of $SED""... $ac_c" 1>&6 -echo "configure:1600: checking version of $SED" >&5 +echo "configure:1601: checking version of $SED" >&5 ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1629,7 +1630,7 @@ CCVERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'` echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1633: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1634: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1643,12 +1644,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1647 "configure" +#line 1648 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 @@ -1679,7 +1680,7 @@ 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:1683: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_cross'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1691,7 +1692,7 @@ 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:1695: checking whether we are using GNU C" >&5 +echo "configure:1696: 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 @@ -1700,7 +1701,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1704: \"$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:1705: \"$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 @@ -1713,7 +1714,7 @@ if test $ac_cv_prog_gcc != yes; then fi echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1717: checking build system type" >&5 +echo "configure:1718: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1736,7 +1737,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:1740: checking for $ac_word" >&5 +echo "configure:1741: 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 @@ -1768,7 +1769,7 @@ done fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1772: checking how to run the C preprocessor" >&5 +echo "configure:1773: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1783,13 +1784,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 1787 "configure" +#line 1788 "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:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1800,13 +1801,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1804 "configure" +#line 1805 "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:1810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1817,13 +1818,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1821 "configure" +#line 1822 "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:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1866,7 +1867,7 @@ if test $RANLIB = ranlib; then # 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:1870: checking for $ac_word" >&5 +echo "configure:1871: 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 @@ -1898,7 +1899,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:1902: checking for $ac_word" >&5 +echo "configure:1903: 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 @@ -1935,7 +1936,7 @@ fi # Determine whether we are using GNU binutils. echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6 -echo "configure:1939: checking whether $AS is GNU as" >&5 +echo "configure:1940: checking whether $AS is GNU as" >&5 if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1954,7 +1955,7 @@ rm -f a.out gnu_as=$libc_cv_prog_as_gnu echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6 -echo "configure:1958: checking whether $LD is GNU ld" >&5 +echo "configure:1959: checking whether $LD is GNU ld" >&5 if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1974,7 +1975,7 @@ gnu_ld=$libc_cv_prog_ld_gnu # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1978: checking for $ac_word" >&5 +echo "configure:1979: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2015,7 +2016,7 @@ fi # check if ranlib is necessary echo $ac_n "checking whether ranlib is necessary""... $ac_c" 1>&6 -echo "configure:2019: checking whether ranlib is necessary" >&5 +echo "configure:2020: checking whether ranlib is necessary" >&5 if eval "test \"`echo '$''{'libc_cv_ranlib_necessary'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2049,7 +2050,7 @@ fi # - two terminals occur directly after each other # - the path contains an element with a dot in it echo $ac_n "checking LD_LIBRARY_PATH variable""... $ac_c" 1>&6 -echo "configure:2053: checking LD_LIBRARY_PATH variable" >&5 +echo "configure:2054: checking LD_LIBRARY_PATH variable" >&5 case ${LD_LIBRARY_PATH} in [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) ld_library_path_setting="contains current directory" @@ -2069,7 +2070,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:2073: checking for $ac_word" >&5 +echo "configure:2074: 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 @@ -2115,7 +2116,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:2119: checking for $ac_word" >&5 +echo "configure:2120: 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 @@ -2165,7 +2166,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:2169: checking for $ac_word" >&5 +echo "configure:2170: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2197,7 +2198,7 @@ done # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2201: checking for $ac_word" >&5 +echo "configure:2202: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2237,7 +2238,7 @@ fi # Extract the first word of "install-info", so it can be a program name with args. set dummy install-info; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2241: checking for $ac_word" >&5 +echo "configure:2242: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_INSTALL_INFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2272,7 +2273,7 @@ fi if test "$INSTALL_INFO" != "no"; then echo $ac_n "checking for old Debian install-info""... $ac_c" 1>&6 -echo "configure:2276: checking for old Debian install-info" >&5 +echo "configure:2277: checking for old Debian install-info" >&5 if eval "test \"`echo '$''{'libc_cv_old_debian_install_info'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2305,7 +2306,7 @@ fi echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6 -echo "configure:2309: checking for signed size_t type" >&5 +echo "configure:2310: 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 @@ -2329,12 +2330,12 @@ EOF fi echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6 -echo "configure:2333: checking for libc-friendly stddef.h" >&5 +echo "configure:2334: 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 2338 "configure" +#line 2339 "configure" #include "confdefs.h" #define __need_size_t #define __need_wchar_t @@ -2349,7 +2350,7 @@ size_t size; wchar_t wchar; if (&size == NULL || &wchar == NULL) abort (); ; return 0; } EOF -if { (eval echo configure:2353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_friendly_stddef=yes else @@ -2368,7 +2369,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:2372: checking whether we need to use -P to assemble .S files" >&5 +echo "configure:2373: 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 @@ -2391,7 +2392,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives." fi echo $ac_n "checking whether .text pseudo-op must be used""... $ac_c" 1>&6 -echo "configure:2395: checking whether .text pseudo-op must be used" >&5 +echo "configure:2396: checking whether .text pseudo-op must be used" >&5 if eval "test \"`echo '$''{'libc_cv_dot_text'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2412,7 +2413,7 @@ else fi echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6 -echo "configure:2416: checking for assembler global-symbol directive" >&5 +echo "configure:2417: 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 @@ -2442,7 +2443,7 @@ EOF fi echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6 -echo "configure:2446: checking for .set assembler directive" >&5 +echo "configure:2447: 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 @@ -2476,7 +2477,7 @@ EOF fi echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6 -echo "configure:2480: checking for .symver assembler directive" >&5 +echo "configure:2481: 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 @@ -2495,7 +2496,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:2499: checking for ld --version-script" >&5 +echo "configure:2500: 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 @@ -2518,7 +2519,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:2522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; + 1>&5'; { (eval echo configure:2523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_version_script_option=yes else @@ -2557,7 +2558,7 @@ if test $shared != no && test $VERSIONING = no; then fi if test $elf = yes; then echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6 -echo "configure:2561: checking for .previous assembler directive" >&5 +echo "configure:2562: 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 @@ -2565,7 +2566,7 @@ else .section foo_section .previous EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2570: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_previous_directive=yes else libc_cv_asm_previous_directive=no @@ -2581,7 +2582,7 @@ EOF else echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 -echo "configure:2585: checking for .popsection assembler directive" >&5 +echo "configure:2586: 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 @@ -2589,7 +2590,7 @@ else .pushsection foo_section .popsection EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2594: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_popsection_directive=yes else libc_cv_asm_popsection_directive=no @@ -2606,7 +2607,7 @@ EOF fi fi echo $ac_n "checking for .protected and .hidden assembler directive""... $ac_c" 1>&6 -echo "configure:2610: checking for .protected and .hidden assembler directive" >&5 +echo "configure:2611: checking for .protected and .hidden assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_protected_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2616,7 +2617,7 @@ foo: .hidden bar bar: EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_protected_directive=yes else libc_cv_asm_protected_directive=no @@ -2628,14 +2629,14 @@ echo "$ac_t""$libc_cv_asm_protected_directive" 1>&6 echo $ac_n "checking for -z nodelete option""... $ac_c" 1>&6 -echo "configure:2632: checking for -z nodelete option" >&5 +echo "configure:2633: checking for -z nodelete option" >&5 if eval "test \"`echo '$''{'libc_cv_z_nodelete'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF int _start (void) { return 42; } EOF - if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_z_nodelete=yes else @@ -2648,14 +2649,14 @@ echo "$ac_t""$libc_cv_z_nodelete" 1>&6 echo $ac_n "checking for -z nodlopen option""... $ac_c" 1>&6 -echo "configure:2652: checking for -z nodlopen option" >&5 +echo "configure:2653: checking for -z nodlopen option" >&5 if eval "test \"`echo '$''{'libc_cv_z_nodlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF int _start (void) { return 42; } EOF - if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_z_nodlopen=yes else @@ -2670,12 +2671,12 @@ fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2674: checking for .init and .fini sections" >&5 +echo "configure:2675: 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 2679 "configure" +#line 2680 "configure" #include "confdefs.h" int main() { @@ -2684,7 +2685,7 @@ asm (".section .init"); asm ("${libc_cv_dot_text}"); ; return 0; } EOF -if { (eval echo configure:2688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2707,7 +2708,7 @@ fi if test $elf = yes -a $gnu_ld = yes; then echo $ac_n "checking whether cc puts quotes around section names""... $ac_c" 1>&6 -echo "configure:2711: checking whether cc puts quotes around section names" >&5 +echo "configure:2712: checking whether cc puts quotes around section names" >&5 if eval "test \"`echo '$''{'libc_cv_have_section_quotes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2744,19 +2745,19 @@ if test $elf = yes; then else if test $ac_cv_prog_cc_works = yes; then echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2748: checking for _ prefix on C symbol names" >&5 +echo "configure:2749: 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 2753 "configure" +#line 2754 "configure" #include "confdefs.h" asm ("_glibc_foobar:"); int main() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -2771,17 +2772,17 @@ fi echo "$ac_t""$libc_cv_asm_underscores" 1>&6 else echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2775: checking for _ prefix on C symbol names" >&5 +echo "configure:2776: 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 2780 "configure" +#line 2781 "configure" #include "confdefs.h" void underscore_test(void) { return; } EOF -if { (eval echo configure:2785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _underscore_test conftest* >/dev/null; then rm -f conftest* libc_cv_asm_underscores=yes @@ -2813,7 +2814,7 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:2817: checking for assembler .weak directive" >&5 +echo "configure:2818: 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 @@ -2836,7 +2837,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:2840: checking for assembler .weakext directive" >&5 +echo "configure:2841: 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 @@ -2873,8 +2874,39 @@ EOF fi +case "${host_cpu}-${host_os}" in + hppa*linux*) + echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6 +echo "configure:2881: checking for assembler line separator" >&5 +if eval "test \"`echo '$''{'libc_cv_asm_line_sep'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.s <<EOF + nop ; is_old_puffin +EOF + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + libc_cv_asm_line_sep='!' + else + if test -z "$enable_hacker_mode"; then + echo "*** You need a newer assembler to compile glibc" + rm -f conftest* + exit 1 + fi + libc_cv_asm_line_sep=';' + fi + rm -f conftest* +fi + +echo "$ac_t""$libc_cv_asm_line_sep" 1>&6 + cat >> confdefs.h <<EOF +#define ASM_LINE_SEP $libc_cv_asm_line_sep +EOF + + ;; +esac + echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6 -echo "configure:2878: checking for ld --no-whole-archive" >&5 +echo "configure:2910: 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 @@ -2885,7 +2917,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:2889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2921: \"$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 @@ -2899,7 +2931,7 @@ if test $libc_cv_ld_no_whole_archive = yes; then fi echo $ac_n "checking for gcc -fexceptions""... $ac_c" 1>&6 -echo "configure:2903: checking for gcc -fexceptions" >&5 +echo "configure:2935: checking for gcc -fexceptions" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_exceptions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2910,7 +2942,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fexceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:2914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_exceptions=yes else libc_cv_gcc_exceptions=no @@ -2925,14 +2957,14 @@ fi if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:2929: checking for function ..ng prefix" >&5 +echo "configure:2961: checking for function ..ng prefix" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF foo () { } EOF -if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -2959,19 +2991,19 @@ if test "$host_cpu" = powerpc ; then # Check for a bug present in at least versions 2.8.x of GCC # and versions 1.0.x of EGCS. echo $ac_n "checking whether clobbering cr0 causes problems""... $ac_c" 1>&6 -echo "configure:2963: checking whether clobbering cr0 causes problems" >&5 +echo "configure:2995: checking whether clobbering cr0 causes problems" >&5 if eval "test \"`echo '$''{'libc_cv_c_asmcr0_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2968 "configure" +#line 3000 "configure" #include "confdefs.h" int tester(int x) { asm ("" : : : "cc"); return x & 123; } int main() { ; return 0; } EOF -if { (eval echo configure:2975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_c_asmcr0_bug='no' else @@ -2993,12 +3025,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:2997: checking for DWARF2 unwind info support" >&5 +echo "configure:3029: checking for DWARF2 unwind info support" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3002 "configure" +#line 3034 "configure" static char __EH_FRAME_BEGIN__; _start () { @@ -3025,7 +3057,7 @@ __bzero () {} EOF if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=static else libc_cv_gcc_dwarf2_unwind_info=no @@ -3033,7 +3065,7 @@ fi if test $libc_cv_gcc_dwarf2_unwind_info = no; then if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=yes else libc_cv_gcc_dwarf2_unwind_info=no @@ -3063,12 +3095,12 @@ EOF esac echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6 -echo "configure:3067: checking for __builtin_expect" >&5 +echo "configure:3099: checking for __builtin_expect" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_builtin_expect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3072 "configure" +#line 3104 "configure" int foo (int a) { a = __builtin_expect (a, 10); @@ -3076,7 +3108,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3080: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3112: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_builtin_expect=yes else libc_cv_gcc_builtin_expect=no @@ -3093,12 +3125,12 @@ EOF fi echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6 -echo "configure:3097: checking for local label subtraction" >&5 +echo "configure:3129: checking for local label subtraction" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_subtract_local_labels'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 3102 "configure" +#line 3134 "configure" int foo (int a) { static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; @@ -3111,7 +3143,7 @@ int foo (int a) } EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_subtract_local_labels=yes else libc_cv_gcc_subtract_local_labels=no @@ -3128,7 +3160,7 @@ EOF fi echo $ac_n "checking for libgd""... $ac_c" 1>&6 -echo "configure:3132: checking for libgd" >&5 +echo "configure:3164: checking for libgd" >&5 old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $libgd_include" old_LDFLAGS="$LDFLAGS" @@ -3136,14 +3168,14 @@ LDFLAGS="$LDFLAGS $libgd_ldflags" old_LIBS="$LIBS" LIBS="$LIBS -lgd -lpng -lz -lm" cat > conftest.$ac_ext <<EOF -#line 3140 "configure" +#line 3172 "configure" #include "confdefs.h" #include <gd.h> int main() { gdImagePng (0, 0) ; return 0; } EOF -if { (eval echo configure:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBGD=yes else @@ -3160,7 +3192,7 @@ echo "$ac_t""$LIBGD" 1>&6 echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:3164: checking size of long double" >&5 +echo "configure:3196: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3168,7 +3200,7 @@ else ac_cv_sizeof_long_double=0 else cat > conftest.$ac_ext <<EOF -#line 3172 "configure" +#line 3204 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -3179,7 +3211,7 @@ main() exit(0); } EOF -if { (eval echo configure:3183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -3247,7 +3279,7 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:3251: checking OS release for uname" >&5 +echo "configure:3283: 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 @@ -3269,7 +3301,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:3273: checking OS version for uname" >&5 +echo "configure:3305: 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 @@ -3291,7 +3323,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:3295: checking stdio selection" >&5 +echo "configure:3327: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -3305,7 +3337,7 @@ echo "$ac_t""$stdio" 1>&6 # Test for old glibc 2.0.x headers so that they can be removed properly # Search only in includedir. echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6 -echo "configure:3309: checking for old glibc 2.0.x headers" >&5 +echo "configure:3341: checking for old glibc 2.0.x headers" >&5 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h" then old_glibc_headers=yes @@ -3360,7 +3392,7 @@ if test $shared = default; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:3364: checking whether -fPIC is default" >&5 +echo "configure:3396: checking whether -fPIC is default" >&5 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/configure.in b/configure.in index b95e947..44d1df2 100644 --- a/configure.in +++ b/configure.in @@ -255,7 +255,8 @@ 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 ;; +hppa*64*) base_machine=hppa machine=hppa/hppa64 ;; +hppa*) base_machine=hppa machine=hppa/hppa1.1 ;; i[3456]86) base_machine=i386 machine=i386/$machine ;; ia64) base_machine=ia64 machine=ia64 ;; m680?0) base_machine=m68k machine=m68k/$machine ;; @@ -1049,6 +1050,30 @@ elif test $libc_cv_asm_weakext_directive = yes; then AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE) fi +dnl The standard hppa assembler uses `;' to start comments and `!' +dnl as a line separator. +case "${host_cpu}-${host_os}" in + hppa*linux*) + AC_CACHE_CHECK(for assembler line separator, + libc_cv_asm_line_sep, [dnl + cat > conftest.s <<EOF + nop ; is_old_puffin +EOF + if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then + libc_cv_asm_line_sep='!' + else + if test -z "$enable_hacker_mode"; then + echo "*** You need a newer assembler to compile glibc" + rm -f conftest* + exit 1 + fi + libc_cv_asm_line_sep=';' + fi + rm -f conftest*]) + AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep) + ;; +esac + AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl cat > conftest.c <<\EOF _start () {} @@ -1520,6 +1520,7 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ #define R_PARISC_FPTR64 64 /* 64 bits function address. */ +#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ @@ -1560,8 +1561,8 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LORESERVE 128 #define R_PARISC_COPY 128 /* Copy relocation. */ -#define R_PARISC_IPLT 129 -#define R_PARISC_EPLT 130 +#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ +#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ #define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ #define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ #define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 71a944e..4acf848 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -76,6 +76,10 @@ # endif #endif +#ifndef ASM_LINE_SEP +# define ASM_LINE_SEP ; +#endif + #ifndef __ASSEMBLER__ /* GCC understands weak symbols and aliases; use its interface where possible, instead of embedded assembly language. */ @@ -117,11 +121,11 @@ # ifdef HAVE_ASM_SET_DIRECTIVE # define strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) # else # define strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) # endif @@ -135,7 +139,7 @@ # else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ # define weak_alias(original, alias) \ - .weak C_SYMBOL_NAME (alias); \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) # define weak_extern(symbol) \ @@ -175,14 +179,16 @@ /* We want the .gnu.warning.SYMBOL section to be unallocated. */ # ifdef HAVE_ASM_PREVIOUS_DIRECTIVE # define __make_section_unallocated(section_string) \ - asm(".section " section_string "; .previous"); + asm (".section " section_string "\n\t.previous"); # elif defined HAVE_ASM_POPSECTION_DIRECTIVE # define __make_section_unallocated(section_string) \ - asm(".pushsection " section_string "; .popsection"); + asm (".pushsection " section_string "\n\t.popsection"); # else # define __make_section_unallocated(section_string) # endif +/* Tacking on "\n\t#" to the section name makes gcc put it's bogus + section attributes on what looks like a comment to the assembler. */ # ifdef HAVE_SECTION_QUOTES # define link_warning(symbol, msg) \ __make_section_unallocated (".gnu.warning." #symbol) \ @@ -196,8 +202,8 @@ # endif # else # define link_warning(symbol, msg) \ - asm(".stabs \"" msg "\",30,0,0,0\n" \ - ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); + asm (".stabs \"" msg "\",30,0,0,0\n\t" \ + ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); # endif #else /* We will never be heard; they will all die horribly. */ @@ -260,9 +266,9 @@ # else /* Not ELF: a.out. */ # define text_set_element(set, symbol) \ - asm(".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) + asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) # define data_set_element(set, symbol) \ - asm(".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) + asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol) # define bss_set_element(set, symbol) ?error Must use initialized data. # define symbol_set_define(set) void *const (set)[1]; # define symbol_set_declare(set) extern void *const (set)[1]; diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index dc0a248..f863f66 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,34 @@ +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * sysdeps/pthread/bits/initspin.h: New file. + * spinlock.h: Move LOCK_INITIALIZER definition to <bits/initspin.h>. + (__pthread_init_lock): Initialize lock with LT_SPINLOCK_INIT. + (__pthread_alt_init_lock): Likewise. + (__pthread_alt_trylock): Release lock with LT_SPINLOCK_INIT. + +2000-10-12 David Huggins-Daines <dhd@linuxcare.com> + + * oldsemaphore.c (__old_sem_init): Release lock with + LT_SPINLOCK_INIT, not zero. + * spinlock.c (__pthread_unlock): Likewise. + (__pthread_alt_lock): Likewise. + (__pthread_alt_timedlock): Likewise. + (__pthread_alt_unlock): Likewise. + * sysdeps/pthread/bits/libc-lock.h: Initialize locks with + LT_SPINLOCK_INIT if it is non-zero. Likewise for init-once flags. + * sysdeps/pthread/pthread.h: Include bits/initspin.h. Use + LT_SPINLOCK_INIT do initialize spinlocks not 0. + +2000-10-12 David Huggins-Daines <dhd@linuxcare.com> + + * shlib-versions: Add version definitions for hppa-linux. + +2000-10-12 Alan Modra <alan@linuxcare.com.au> + + * sysdeps/hppa/pspinlock.c: New file. + * sysdeps/hppa/pt-machine.h: New file. + * sysdeps/unix/sysv/linux/hppa/bits/initspin.h: New file. + 2000-10-05 Jakub Jelinek <jakub@redhat.com> * mutex.c (__pthread_mutex_destroy): Correct test of diff --git a/linuxthreads/oldsemaphore.c b/linuxthreads/oldsemaphore.c index 52957d9..b9eb20f 100644 --- a/linuxthreads/oldsemaphore.c +++ b/linuxthreads/oldsemaphore.c @@ -65,7 +65,7 @@ int __old_sem_init(old_sem_t *sem, int pshared, unsigned int value) errno = ENOSYS; return -1; } - sem->sem_spinlock = 0; + sem->sem_spinlock = LT_SPINLOCK_INIT; sem->sem_status = ((long)value << 1) + 1; return 0; } diff --git a/linuxthreads/shlib-versions b/linuxthreads/shlib-versions index 763639a..5344c6b 100644 --- a/linuxthreads/shlib-versions +++ b/linuxthreads/shlib-versions @@ -3,4 +3,5 @@ mips.*-.*-linux.* libpthread=0 GLIBC_2.0 GLIBC_2.2 sparc64-.*-linux.* libpthread=0 GLIBC_2.2 sh.*-.*-linux.* libpthread=0 GLIBC_2.2 ia64.*-.*-linux.* libpthread=0 GLIBC_2.2 +hppa.*-.*-linux.* libpthread=0 GLIBC_2.2 .*-.*-linux.* libpthread=0 diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c index 102b1be..5846c45 100644 --- a/linuxthreads/spinlock.c +++ b/linuxthreads/spinlock.c @@ -155,7 +155,7 @@ int __pthread_unlock(struct _pthread_fastlock * lock) #if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP { WRITE_MEMORY_BARRIER(); - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; return 0; } #endif @@ -394,7 +394,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock, } WRITE_MEMORY_BARRIER(); - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; if (suspend_needed) suspend (self); @@ -468,7 +468,7 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock, } WRITE_MEMORY_BARRIER(); - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; goto suspend; } #endif @@ -649,7 +649,7 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock) #if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP { WRITE_MEMORY_BARRIER(); - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } #endif } diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h index 2d3e9bf..9fbeff1 100644 --- a/linuxthreads/spinlock.h +++ b/linuxthreads/spinlock.h @@ -12,6 +12,8 @@ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU Library General Public License for more details. */ +#include <bits/initspin.h> + /* There are 2 compare and swap synchronization primitives with different semantics: @@ -97,7 +99,7 @@ extern int __pthread_unlock(struct _pthread_fastlock *lock); static inline void __pthread_init_lock(struct _pthread_fastlock * lock) { lock->__status = 0; - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } static inline int __pthread_trylock (struct _pthread_fastlock * lock) @@ -139,7 +141,7 @@ extern void __pthread_alt_unlock(struct _pthread_fastlock *lock); static inline void __pthread_alt_init_lock(struct _pthread_fastlock * lock) { lock->__status = 0; - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) @@ -163,7 +165,7 @@ static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) WRITE_MEMORY_BARRIER(); res = 0; } - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } return res; } @@ -178,11 +180,6 @@ static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) #endif } -/* Initializers for both lock variants */ - -#define LOCK_INITIALIZER {0, 0} -#define ALT_LOCK_INITIALIZER {0, 0} - /* Operations on pthread_atomic, which is defined in internals.h */ static inline long atomic_increment(struct pthread_atomic *pa) @@ -208,8 +205,6 @@ static inline long atomic_decrement(struct pthread_atomic *pa) return oldval; } -#define ATOMIC_INITIALIZER { 0, 0 } - static inline void __pthread_set_own_extricate_if (pthread_descr self, pthread_extricate_if *peif) diff --git a/linuxthreads/sysdeps/hppa/pspinlock.c b/linuxthreads/sysdeps/hppa/pspinlock.c new file mode 100644 index 0000000..1b1511f --- /dev/null +++ b/linuxthreads/sysdeps/hppa/pspinlock.c @@ -0,0 +1,81 @@ +/* POSIX spinlock implementation. hppa version. + Copyright (C) 2000 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 <errno.h> +#include <pthread.h> + + +int +__pthread_spin_lock (pthread_spinlock_t *lock) +{ + unsigned int val; + + do + asm volatile ("ldcw %1,%0" + : "=r" (val), "=m" (*lock) + : "m" (*lock)); + while (!val); + + return 0; +} +weak_alias (__pthread_spin_lock, pthread_spin_lock) + + +int +__pthread_spin_trylock (pthread_spinlock_t *lock) +{ + unsigned int val; + + asm volatile ("ldcw %1,%0" + : "=r" (val), "=m" (*lock) + : "m" (*lock)); + + return val ? 0 : EBUSY; +} +weak_alias (__pthread_spin_trylock, pthread_spin_trylock) + + +int +__pthread_spin_unlock (pthread_spinlock_t *lock) +{ + *lock = 1; + return 0; +} +weak_alias (__pthread_spin_unlock, pthread_spin_unlock) + + +int +__pthread_spin_init (pthread_spinlock_t *lock, int pshared) +{ + /* We can ignore the `pshared' parameter. Since we are busy-waiting + all processes which can access the memory location `lock' points + to can use the spinlock. */ + *lock = 1; + return 0; +} +weak_alias (__pthread_spin_init, pthread_spin_init) + + +int +__pthread_spin_destroy (pthread_spinlock_t *lock) +{ + /* Nothing to do. */ + return 0; +} +weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/linuxthreads/sysdeps/hppa/pt-machine.h b/linuxthreads/sysdeps/hppa/pt-machine.h new file mode 100644 index 0000000..bc0d2d6 --- /dev/null +++ b/linuxthreads/sysdeps/hppa/pt-machine.h @@ -0,0 +1,54 @@ +/* Machine-dependent pthreads configuration and inline functions. + hppa version. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson <rth@tamu.edu>. + + 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 <bits/initspin.h> + +#ifndef PT_EI +# define PT_EI extern inline +#endif + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME stack_pointer +register char * stack_pointer __asm__ ("%r30"); + + +/* The hppa only has one atomic read and modify memory operation, + load and clear, so hppa spinlocks must use zero to signify that + someone is holding the lock. */ + +#define xstr(s) str(s) +#define str(s) #s +/* Spinlock implementation; required. */ +PT_EI int +testandset (int *spinlock) +{ + int ret; + + __asm__ __volatile__( + "ldcw 0(%2),%0" + : "=r"(ret), "=m"(*spinlock) + : "r"(spinlock)); + + return ret == 0; +} +#undef str +#undef xstr diff --git a/linuxthreads/sysdeps/pthread/bits/initspin.h b/linuxthreads/sysdeps/pthread/bits/initspin.h new file mode 100644 index 0000000..050983c --- /dev/null +++ b/linuxthreads/sysdeps/pthread/bits/initspin.h @@ -0,0 +1,28 @@ +/* Generic definitions for spinlock initializers. + Copyright (C) 2000 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. */ + +/* Initial value of a spinlock. Most platforms should use zero, + unless they only implement a "test and clear" operation instead of + the usual "test and set". */ +#define LT_SPINLOCK_INIT 0 + +/* Macros for lock initializers, using the above definition. */ +#define LOCK_INITIALIZER { 0, LT_SPINLOCK_INIT } +#define ALT_LOCK_INITIALIZER { 0, LT_SPINLOCK_INIT } +#define ATOMIC_INITIALIZER { 0, LT_SPINLOCK_INIT } diff --git a/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/linuxthreads/sysdeps/pthread/bits/libc-lock.h index d0e9a8d..41bca4d 100644 --- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -48,12 +48,21 @@ typedef pthread_key_t __libc_key_t; /* Define an initialized lock variable NAME with storage class CLASS. - For the C library we take a deeper look at the initializer. For this - implementation all fields are initialized to zero. Therefore we - don't initialize the variable which allows putting it into the BSS - section. */ -#define __libc_lock_define_initialized(CLASS,NAME) \ + For the C library we take a deeper look at the initializer. For + this implementation all fields are initialized to zero. Therefore + we don't initialize the variable which allows putting it into the + BSS section. (Except on PA-RISC and other odd architectures, where + initialized locks must be set to one due to the lack of normal + atomic operations.) */ + +#if LT_SPINLOCK_INIT == 0 +# define __libc_lock_define_initialized(CLASS,NAME) \ CLASS __libc_lock_t NAME; +#else +# define __libc_lock_define_initialized(CLASS,NAME) \ + CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; +#endif + #define __libc_rwlock_define_initialized(CLASS,NAME) \ CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; @@ -143,9 +152,9 @@ typedef pthread_key_t __libc_key_t; do { \ if (__pthread_once != NULL) \ __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ - else if ((ONCE_CONTROL) == 0) { \ + else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ INIT_FUNCTION (); \ - (ONCE_CONTROL) = 1; \ + (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \ } \ } while (0) diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h index f2a742e..45be6cf 100644 --- a/linuxthreads/sysdeps/pthread/pthread.h +++ b/linuxthreads/sysdeps/pthread/pthread.h @@ -23,6 +23,7 @@ #define __need_sigset_t #include <signal.h> #include <bits/pthreadtypes.h> +#include <bits/initspin.h> __BEGIN_DECLS @@ -30,26 +31,26 @@ __BEGIN_DECLS /* Initializers. */ #define PTHREAD_MUTEX_INITIALIZER \ - {0, 0, 0, PTHREAD_MUTEX_TIMED_NP, {0, 0}} + {0, 0, 0, PTHREAD_MUTEX_TIMED_NP, LOCK_INITIALIZER} #ifdef __USE_GNU # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, {0, 0}} + {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, LOCK_INITIALIZER} # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, {0, 0}} + {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, LOCK_INITIALIZER} # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ - {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, {0, 0}} + {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, LOCK_INITIALIZER} #endif -#define PTHREAD_COND_INITIALIZER {{0, 0}, 0} +#define PTHREAD_COND_INITIALIZER {LOCK_INITIALIZER, 0} #ifdef __USE_UNIX98 # define PTHREAD_RWLOCK_INITIALIZER \ - { {0, 0}, 0, NULL, NULL, NULL, \ + { LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE } #endif #ifdef __USE_GNU # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ - { {0, 0}, 0, NULL, NULL, NULL, \ + { LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_PROCESS_PRIVATE } #endif diff --git a/linuxthreads/sysdeps/unix/sysv/linux/hppa/bits/initspin.h b/linuxthreads/sysdeps/unix/sysv/linux/hppa/bits/initspin.h new file mode 100644 index 0000000..bb8d326 --- /dev/null +++ b/linuxthreads/sysdeps/unix/sysv/linux/hppa/bits/initspin.h @@ -0,0 +1,27 @@ +/* PA-RISC specific definitions for spinlock initializers. + Copyright (C) 2000 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. */ + +/* Initial value of a spinlock. PA-RISC only implements atomic load + and clear so this must be non-zero. */ +#define LT_SPINLOCK_INIT 1 + +/* Macros for lock initializers, using the above definition. */ +#define LOCK_INITIALIZER { 0, LT_SPINLOCK_INIT } +#define ALT_LOCK_INITIALIZER { 0, LT_SPINLOCK_INIT } +#define ATOMIC_INITIALIZER { 0, LT_SPINLOCK_INIT } diff --git a/malloc/memusage.c b/malloc/memusage.c index 6296d99..34e3347 100644 --- a/malloc/memusage.c +++ b/malloc/memusage.c @@ -117,7 +117,11 @@ update_data (struct header *result, size_t len, size_t old_len) peak_heap = current_heap; /* Compute current stack usage and compare it with the maximum value. */ +#ifdef STACK_GROWS_UPWARD + current_stack = GETSP () - start_sp; +#else current_stack = start_sp - GETSP (); +#endif if (current_stack > peak_stack) peak_stack = current_stack; diff --git a/math/libm-test.inc b/math/libm-test.inc index f4df889..1b9e08b 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -2693,8 +2693,8 @@ frexp_test (void) TEST_fI_f1 (frexp, 0.0, 0.0, 0.0); TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0); - TEST_fI_f1 (frexp, 12.8, 0.8L, 4); - TEST_fI_f1 (frexp, -27.34, -0.854375L, 5); + TEST_fI_f1 (frexp, 12.8L, 0.8L, 4); + TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5); END (frexp); } @@ -2762,11 +2762,11 @@ hypot_test (void) TEST_ff_f (hypot, -12.4, -0.7, 12.41974234837422060118L); /* hypot (x,0) == fabs (x) */ - TEST_ff_f (hypot, 0.7, 0, 0.7L); - TEST_ff_f (hypot, -0.7, 0, 0.7L); - TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L); + TEST_ff_f (hypot, 0.7L, 0, 0.7L); + TEST_ff_f (hypot, -0.7L, 0, 0.7L); + TEST_ff_f (hypot, -5.7e7L, 0, 5.7e7L); - TEST_ff_f (hypot, 0.7, 1.2, 1.3892443989449804508L); + TEST_ff_f (hypot, 0.7L, 1.2L, 1.3892443989449804508L); END (hypot); } diff --git a/shlib-versions b/shlib-versions index ceed6bf..24e934d 100644 --- a/shlib-versions +++ b/shlib-versions @@ -22,6 +22,7 @@ alpha.*-.*-linux.* libm=6.1 mips.*-.*-linux.* libm=6 GLIBC_2.0 GLIBC_2.2 ia64-.*-linux.* libm=6.1 GLIBC_2.2 sh.*-.*-linux.* libm=6 GLIBC_2.2 +hppa.*-.*-.* libm=6 GLIBC_2.2 .*-.*-linux.* libm=6 .*-.*-gnu-gnu.* libm=6 @@ -32,6 +33,7 @@ mips.*-.*-linux.* libc=6 GLIBC_2.0 GLIBC_2.2 ia64-.*-linux.* libc=6.1 GLIBC_2.2 sh.*-.*-linux.* libc=6 GLIBC_2.2 sparc64-.*-linux.* libc=6 GLIBC_2.2 +hppa.*-.*-.* libc=6 GLIBC_2.2 .*-.*-linux.* libc=6 # libmachuser.so.1 corresponds to mach/*.defs as of Utah's UK22 release. @@ -56,6 +58,7 @@ arm.*-.*-linux.* ld=ld-linux.so.2 sh.*-.*-linux.* ld=ld-linux.so.2 GLIBC_2.2 ia64-.*-linux.* ld=ld-linux-ia64.so.2 GLIBC_2.2 mips.*-.*-linux.* ld=ld.so.1 GLIBC_2.0 GLIBC_2.2 +hppa.*-.*-.* ld=ld.so.1 GLIBC_2.2 # We use the ELF ABI standard name for the default. .*-.*-.* ld=ld.so.1 @@ -107,6 +110,7 @@ alpha.*-.*-linux.* libBrokenLocale=1.1 ia64-.*-.* libBrokenLocale=1 GLIBC_2.2 sh.*-.*-.* libBrokenLocale=1 GLIBC_2.2 sparc64-.*-.* libBrokenLocale=1 GLIBC_2.2 +hppa-.*-.* libBrokenLocale=1 GLIBC_2.2 .*-.*-.* libBrokenLocale=1 # The real-time library from POSIX.1b. diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c index d4cba3f..9a80ba8 100644 --- a/sysdeps/generic/printf_fphex.c +++ b/sysdeps/generic/printf_fphex.c @@ -427,11 +427,15 @@ __printf_fphex (FILE *fp, /* Now we have all information to compute the size. */ width -= ((negative || info->showsign || info->space) /* Sign. */ - + 2 + 1 + 1 + precision + 1 + 1 + + 2 + 1 + 0 + precision + 1 + 1 /* 0x h . hhh P ExpoSign. */ + ((expbuf + sizeof expbuf) - expstr)); /* Exponent. */ + /* Count the decimal point. */ + if (precision > 0 || info->alt) + width -= wide ? 1 : strlen (decimal); + /* A special case when the mantissa or the precision is zero and the `#' is not given. In this case we must not print the decimal point. */ if (precision == 0 && !info->alt) @@ -463,9 +467,10 @@ __printf_fphex (FILE *fp, if (precision > 0) { + ssize_t tofill = precision - (numend - numstr); PRINT (numstr, wnumstr, MIN (numend - numstr, precision)); - if (precision > numend - numstr) - PADN ('0', precision - (numend - numstr)); + if (tofill > 0) + PADN ('0', tofill); } if (info->left && info->pad == '0' && width > 0) diff --git a/sysdeps/gnu/siglist.c b/sysdeps/gnu/siglist.c index 0cb30df..adc7ecc 100644 --- a/sysdeps/gnu/siglist.c +++ b/sysdeps/gnu/siglist.c @@ -33,7 +33,7 @@ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -asm (".data; .globl __old_sys_siglist; __old_sys_siglist:"); +asm (".data\n\t.globl __old_sys_siglist\n__old_sys_siglist:"); #endif const char *const __new_sys_siglist[NSIG] = @@ -44,10 +44,10 @@ const char *const __new_sys_siglist[NSIG] = }; #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -asm (".type __old_sys_siglist,@object;.size __old_sys_siglist," +asm (".type __old_sys_siglist,@object\n\t.size __old_sys_siglist," OLD_SIGLIST_SIZE_STR "*" PTR_SIZE_STR); -asm (".data; .globl __old_sys_sigabbrev; __old_sys_sigabbrev:"); +asm (".data\n\t.globl __old_sys_sigabbrev\n__old_sys_sigabbrev:"); #endif const char *const __new_sys_sigabbrev[NSIG] = @@ -58,7 +58,7 @@ const char *const __new_sys_sigabbrev[NSIG] = }; #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -asm (".type __old_sys_sigabbrev,@object;.size __old_sys_sigabbrev," +asm (".type __old_sys_sigabbrev,@object\n\t.size __old_sys_sigabbrev," OLD_SIGLIST_SIZE_STR "*" PTR_SIZE_STR); extern const char *const *__old_sys_siglist; diff --git a/sysdeps/hppa/Makefile b/sysdeps/hppa/Makefile new file mode 100644 index 0000000..f6ad843 --- /dev/null +++ b/sysdeps/hppa/Makefile @@ -0,0 +1,26 @@ +# Copyright (C) 2000 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# Contributed by David Huggins-Daines (dhd@debian.org) + +# 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. + +# We need this for all shared objects since the build process uses ld -r +CFLAGS-.os += -ffunction-sections + +ifeq ($(subdir),elf) +dl-routines += dl-symaddr dl-fptr +rtld-routines += dl-symaddr dl-fptr +endif diff --git a/sysdeps/hppa/Versions b/sysdeps/hppa/Versions new file mode 100644 index 0000000..0c447d9 --- /dev/null +++ b/sysdeps/hppa/Versions @@ -0,0 +1,6 @@ +ld { + GLIBC_2.2 { + # hppa specific functions in the dynamic linker, but used by libc.so. + _dl_symbol_address; _dl_unmap; _dl_lookup_address; + } +} diff --git a/sysdeps/hppa/__longjmp.S b/sysdeps/hppa/__longjmp.S new file mode 100644 index 0000000..418a0b4 --- /dev/null +++ b/sysdeps/hppa/__longjmp.S @@ -0,0 +1,72 @@ +/* longjmp for PA-RISC. + Copyright (C) 1997, 1998 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> +#define _SETJMP_H +#define _ASM +#include <bits/setjmp.h> + +/* __longjmp(jmpbuf, val) */ + + .text + .align 4 + .globl __longjmp + .export __longjmp, code + .proc + .callinfo +__longjmp: + /* set return value */ + copy %r25, %r28 + + ldw 0(%r26), %r3 + ldw 8(%r26), %r4 + ldw 12(%r26), %r5 + ldw 16(%r26), %r6 + ldw 20(%r26), %r7 + ldw 24(%r26), %r8 + ldw 28(%r26), %r9 + ldw 32(%r26), %r10 + ldw 36(%r26), %r11 + ldw 40(%r26), %r12 + ldw 44(%r26), %r13 + ldw 48(%r26), %r14 + ldw 52(%r26), %r15 + ldw 56(%r26), %r16 + ldw 60(%r26), %r17 + ldw 64(%r26), %r18 + ldw 68(%r26), %r19 + ldw 72(%r26), %r27 + ldw 76(%r26), %r30 + + ldw 80(%r26), %rp + + ldo 88(%r26),%r20 + fldds,ma 8(%r20), %fr12 + fldds,ma 8(%r20), %fr13 + fldds,ma 8(%r20), %fr14 + fldds,ma 8(%r20), %fr15 + fldds,ma 8(%r20), %fr16 + fldds,ma 8(%r20), %fr17 + fldds,ma 8(%r20), %fr18 + fldds,ma 8(%r20), %fr19 + fldds,ma 8(%r20), %fr20 + fldds 0(%r20), %fr21 + + bv,n %r0(%r2) + .procend diff --git a/sysdeps/hppa/add_n.s b/sysdeps/hppa/add_n.s index b4a1428..87b7cd7 100644 --- a/sysdeps/hppa/add_n.s +++ b/sysdeps/hppa/add_n.s @@ -1,56 +1,56 @@ -; HP-PA __mpn_add_n -- Add two limb vectors of the same length > 0 and store -; sum in a third limb vector. +;! HP-PA __mpn_add_n -- Add two limb vectors of the same length > 0 and store +;! sum in a third limb vector. -; Copyright (C) 1992, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr gr26 -; s1_ptr gr25 -; s2_ptr gr24 -; size gr23 +;! INPUT PARAMETERS +;! res_ptr gr26 +;! s1_ptr gr25 +;! s2_ptr gr24 +;! size gr23 -; One might want to unroll this as for other processors, but it turns -; out that the data cache contention after a store makes such -; unrolling useless. We can't come under 5 cycles/limb anyway. +;! One might want to unroll this as for other processors, but it turns +;! out that the data cache contention after a store makes such +;! unrolling useless. We can't come under 5 cycles/limb anyway. - .code + .text .export __mpn_add_n -__mpn_add_n +__mpn_add_n: .proc .callinfo frame=0,no_calls .entry - ldws,ma 4(0,%r25),%r20 - ldws,ma 4(0,%r24),%r19 + ldws,ma 4(0,%r25),%r21 + ldws,ma 4(0,%r24),%r20 - addib,= -1,%r23,L$end ; check for (SIZE == 1) - add %r20,%r19,%r28 ; add first limbs ignoring cy + addib,= -1,%r23,L$end ;! check for (SIZE == 1) + add %r21,%r20,%r28 ;! add first limbs ignoring cy -L$loop ldws,ma 4(0,%r25),%r20 - ldws,ma 4(0,%r24),%r19 +L$loop: ldws,ma 4(0,%r25),%r21 + ldws,ma 4(0,%r24),%r20 stws,ma %r28,4(0,%r26) addib,<> -1,%r23,L$loop - addc %r20,%r19,%r28 + addc %r21,%r20,%r28 -L$end stws %r28,0(0,%r26) +L$end: stws %r28,0(0,%r26) bv 0(%r2) addc %r0,%r0,%r28 diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h new file mode 100644 index 0000000..f72cdb5 --- /dev/null +++ b/sysdeps/hppa/bits/setjmp.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2000 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. */ + +/* Define the machine-dependent type `jmp_buf'. HPPA version. */ + +#ifndef _SETJMP_H +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." +#endif + +/* The previous bits/setjmp.h had __jmp_buf defined as a structure. + We use an array of 'double' instead, to make writing the assembler + easier, and to ensure proper alignment. Naturally, user code should + not depend on either representation. */ + +#if defined __USE_MISC || defined _ASM +#define JB_SP (76/4) +#endif + +#ifndef _ASM +typedef double __jmp_buf[21]; +#endif + +/* Test if longjmp to JMPBUF would unwind the frame containing a local + variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(_jmpbuf, _address) \ + ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP])) diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c new file mode 100644 index 0000000..8a2c1c2 --- /dev/null +++ b/sysdeps/hppa/dl-fptr.c @@ -0,0 +1,212 @@ +/* Make dynamic PLABELs for function pointers. HPPA version. + Copyright (C) 1999, 2000 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 <unistd.h> +#include <string.h> +#include <sys/param.h> +#include <sys/mman.h> +#include <link.h> +#include <errno.h> +#include <ldsodefs.h> +#include <elf/dynamic-link.h> +#include <dl-machine.h> +#ifdef _LIBC_REENTRANT +# include <pt-machine.h> + +/* Remember, we use 0 to mean that a lock is taken on PA-RISC. */ +static int __hppa_fptr_lock = 1; +#endif + +/* Because ld.so is now versioned, these functions can be in their own + file; no relocations need to be done to call them. Of course, if + ld.so is not versioned... */ +#if 0 +#ifndef DO_VERSIONING +# error "This will not work with versioning turned off, sorry." +#endif +#endif + +#ifdef MAP_ANON +/* The fd is not examined when using MAP_ANON. */ +#define ANONFD -1 +#else +extern int _dl_zerofd; +#define ANONFD _dl_zerofd +#endif + +struct hppa_fptr __boot_ldso_fptr[HPPA_BOOT_FPTR_SIZE]; +struct hppa_fptr *__fptr_root = NULL; +struct hppa_fptr *__fptr_next = __boot_ldso_fptr; +static struct hppa_fptr *__fptr_free = NULL; +int __fptr_count = HPPA_BOOT_FPTR_SIZE; + +Elf32_Addr +__hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value, + struct hppa_fptr **root, struct hppa_fptr *mem) +{ + struct hppa_fptr **loc; + struct hppa_fptr *f; + +#ifdef _LIBC_REENTRANT + /* Make sure we are alone. We don't need a lock during bootstrap. */ + if (mem == NULL) + while (testandset (&__hppa_fptr_lock)); +#endif + + /* Search the sorted linked list for an existing entry for this + symbol. */ + loc = root; + f = *loc; + while (f != NULL && f->func <= value) + { + if (f->func == value) + goto found; + loc = &f->next; + f = *loc; + } + + /* Not found. Create a new one. */ + if (mem != NULL) + f = mem; + else if (__fptr_free != NULL) + { + f = __fptr_free; + __fptr_free = f->next; + } + else + { + if (__fptr_count == 0) + { +#ifndef MAP_ANON +# define MAP_ANON 0 + if (_dl_zerofd == -1) + { + _dl_zerofd = _dl_sysdep_open_zero_fill (); + if (_dl_zerofd == -1) + { + __close (fd); + _dl_signal_error (errno, NULL, + "cannot open zero fill device"); + } + } +#endif + + __fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, ANONFD, 0); + if (__fptr_next == MAP_FAILED) + _dl_signal_error(errno, NULL, "cannot map page for fptr"); + __fptr_count = _dl_pagesize / sizeof (struct hppa_fptr); + } + f = __fptr_next++; + __fptr_count--; + } + + f->func = value; + /* GOT has already been relocated in elf_get_dynamic_info - don't + try to relocate it again. */ + f->gp = sym_map->l_info[DT_PLTGOT]->d_un.d_ptr; + f->next = *loc; + *loc = f; + +found: +#ifdef _LIBC_REENTRANT + /* Release the lock. Again, remember, zero means the lock is taken! */ + if (mem == NULL) + __hppa_fptr_lock = 1; +#endif + + /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */ + return (Elf32_Addr) f | 2; +} + +void +_dl_unmap (struct link_map *map) +{ + struct hppa_fptr **floc; + struct hppa_fptr *f; + struct hppa_fptr **lloc; + struct hppa_fptr *l; + + __munmap ((void *) map->l_map_start, map->l_map_end - map->l_map_start); + +#ifdef _LIBC_REENTRANT + /* Make sure we are alone. */ + while (testandset (&__hppa_fptr_lock)); +#endif + + /* Search the sorted linked list for the first entry for this object. */ + floc = &__fptr_root; + f = *floc; + while (f != NULL && f->func < map->l_map_start) + { + floc = &f->next; + f = *floc; + } + + /* We found one. */ + if (f != NULL && f->func < map->l_map_end) + { + /* Get the last entry. */ + lloc = floc; + l = f; + while (l && l->func < map->l_map_end) + { + lloc = &l->next; + l = *lloc; + } + + /* Updated FPTR. */ + *floc = l; + + /* Prepend them to the free list. */ + *lloc = __fptr_free; + __fptr_free = f; + } + +#ifdef _LIBC_REENTRANT + /* Release the lock. */ + __hppa_fptr_lock = 1; +#endif +} + +Elf32_Addr +_dl_lookup_address (const void *address) +{ + Elf32_Addr addr = (Elf32_Addr) address; + struct hppa_fptr *f; + +#ifdef _LIBC_REENTRANT + /* Make sure we are alone. */ + while (testandset (&__hppa_fptr_lock)); +#endif + + for (f = __fptr_root; f != NULL; f = f->next) + if (f == address) + { + addr = f->func; + break; + } + +#ifdef _LIBC_REENTRANT + /* Release the lock. */ + __hppa_fptr_lock = 1; +#endif + + return addr; +} diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h new file mode 100644 index 0000000..4f5f899 --- /dev/null +++ b/sysdeps/hppa/dl-lookupcfg.h @@ -0,0 +1,36 @@ +/* Configuration of lookup functions. + Copyright (C) 2000 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. */ + +/* Like IA-64, PA-RISC needs more information from the symbol lookup + function than just the address. */ +#define DL_LOOKUP_RETURNS_MAP +#define ELF_FUNCTION_PTR_IS_SPECIAL +#define DL_UNMAP_IS_SPECIAL + +void *_dl_symbol_address (const struct link_map *map, const ElfW(Sym) *ref); + +#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref) + +Elf32_Addr _dl_lookup_address (const void *address); + +#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address (addr) + +void _dl_unmap (struct link_map *map); + +#define DL_UNMAP(map) _dl_unmap (map) diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h new file mode 100644 index 0000000..e6782b3 --- /dev/null +++ b/sysdeps/hppa/dl-machine.h @@ -0,0 +1,605 @@ +/* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version. + Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + Contributed by David Huggins-Daines <dhd@debian.org> + 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 dl_machine_h +#define dl_machine_h 1 + +#define ELF_MACHINE_NAME "hppa" + +#include <sys/param.h> +#include <string.h> +#include <link.h> +#include <assert.h> + +/* These must match the definition of the stub in bfd/elf32-hppa.c. */ +#define SIZEOF_PLT_STUB (4*4) +#define GOT_FROM_PLT_STUB (4*4) + +/* A PLABEL is a function descriptor. Properly they consist of just + FUNC and GP. But we want to traverse a binary tree too. See + dl-fptr.c for the code (it may be made common between HPPA and + IA-64 in the future). + + We call these 'fptr' to make it easier to steal code from IA-64. */ + +/* ld.so currently has 12 PLABEL32 relocs. We'll keep this constant + large for now in case we require more, as the rest of these will be + used by the dynamic program itself (libc.so has quite a few + PLABEL32 relocs in it). */ +#define HPPA_BOOT_FPTR_SIZE 256 + +struct hppa_fptr +{ + Elf32_Addr func; + Elf32_Addr gp; + struct hppa_fptr *next; +}; + +extern struct hppa_fptr __boot_ldso_fptr[]; +extern struct hppa_fptr *__fptr_root; +extern int __fptr_count; + +extern Elf32_Addr __hppa_make_fptr (const struct link_map *, Elf32_Addr, + struct hppa_fptr **, struct hppa_fptr *); + +/* Return nonzero iff E_MACHINE is compatible with the running host. */ +static inline int +elf_machine_matches_host (Elf32_Half e_machine) +{ + return e_machine == EM_PARISC; +} + + +/* Return the link-time address of _DYNAMIC. */ +static inline Elf32_Addr +elf_machine_dynamic (void) +{ + Elf32_Addr dynamic; + +#if 0 + /* Use this method if GOT address not yet set up. */ + asm ("\ + b,l 1f,%0 + depi 0,31,2,%0 +1: addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0 + ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0" + : "=r" (dynamic) : : "r1"); +#else + /* This works because we already have our GOT address available. */ + dynamic = (Elf32_Addr) &_DYNAMIC; +#endif + + return dynamic; +} + +/* Return the run-time load address of the shared object. */ +static inline Elf32_Addr +elf_machine_load_address (void) +{ + Elf32_Addr dynamic, dynamic_linkaddress; + + asm ("\ + b,l 1f,%0 + depi 0,31,2,%0 +1: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0 + ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%1 + addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%0 + ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%%r1),%0" + : "=r" (dynamic_linkaddress), "=r" (dynamic) : : "r1"); + + return dynamic - dynamic_linkaddress; +} + +/* Fixup a PLT entry to bounce directly to the function at VALUE. */ +static inline Elf32_Addr +elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const Elf32_Rela *reloc, + Elf32_Addr *reloc_addr, Elf32_Addr value) +{ + /* l is the link_map for the caller, t is the link_map for the object + * being called */ + reloc_addr[1] = D_PTR (t, l_info[DT_PLTGOT]); + reloc_addr[0] = value; + /* Return the PLT slot rather than the function value so that the + trampoline can load the new LTP. */ + return (Elf32_Addr) reloc_addr; +} + +/* Return the final value of a plt relocation. */ +static inline Elf32_Addr +elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, + Elf32_Addr value) +{ + /* We are rela only */ + return value + reloc->r_addend; +} + +/* Set up the loaded object described by L so its unrelocated PLT + entries 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, int profile) +{ + extern void _dl_runtime_resolve (void); + extern void _dl_runtime_profile (void); + Elf32_Addr jmprel = D_PTR(l, l_info[DT_JMPREL]); + + if (lazy && jmprel) + { + Elf32_Addr *got = NULL; + Elf32_Addr l_addr; + Elf32_Addr end_jmprel; + Elf32_Addr iplt; + + /* Relocate all the PLT slots. */ + l_addr = l->l_addr; + end_jmprel = jmprel + l->l_info[DT_PLTRELSZ]->d_un.d_val; + for (iplt = jmprel; iplt < end_jmprel; iplt += sizeof (Elf32_Rela)) + { + const Elf32_Rela *reloc; + Elf32_Word r_type; + Elf32_Word r_sym; + struct hppa_fptr *fptr; + + reloc = (const Elf32_Rela *) iplt; + r_type = ELF32_R_TYPE (reloc->r_info); + r_sym = ELF32_R_SYM (reloc->r_info); + + if (__builtin_expect (r_type == R_PARISC_IPLT, 1)) + { + fptr = (struct hppa_fptr *) (reloc->r_offset + l_addr); + if (r_sym != 0) + { + /* Relocate the pointer to the stub. */ + fptr->func += l_addr; + /* Instead of the LTP value, we put the reloc offset + here. The trampoline code will load the proper + LTP and pass the reloc offset to the fixup + function. */ + fptr->gp = iplt - jmprel; + if (!got) + { + static union { + unsigned char c[8]; + Elf32_Addr i[2]; + } sig = {{0x00,0xc0,0xff,0xee, 0xde,0xad,0xbe,0xef}}; + + /* Find our .got section. It's right after the + stub. */ + got = (Elf32_Addr *) (fptr->func + GOT_FROM_PLT_STUB); + + /* Sanity check to see if the address we are + going to check below is within a reasonable + approximation of the bounds of the PLT (or, + at least, is at an address that won't fault + on read). Then check for the magic signature + above. */ + if (fptr->func < (Elf32_Addr) fptr + sizeof(*fptr)) + return 0; + if (fptr->func > + ((Elf32_Addr) fptr + + SIZEOF_PLT_STUB + + ((l->l_info[DT_PLTRELSZ]->d_un.d_val / sizeof (Elf32_Rela)) + * 8))) + return 0; + if (got[-2] != sig.i[0] || got[-1] != sig.i[1]) + return 0; /* No lazy linking for you! */ + } + } + else + { + /* Relocate this *ABS* entry. */ + fptr->func = reloc->r_addend + l_addr; + fptr->gp = D_PTR (l, l_info[DT_PLTGOT]); + } + } + else if (__builtin_expect (r_type != R_PARISC_NONE, 0)) + _dl_reloc_bad_type (l, r_type, 1); + } + + if (got) + { + register Elf32_Addr ltp __asm__ ("%r19"); + /* Identify this shared object. */ + got[1] = (Elf32_Addr) l; + + /* This function will be called to perform the relocation. */ + if (__builtin_expect (!profile, 1)) + got[-2] = + (Elf32_Addr) ((struct hppa_fptr *) + ((unsigned long) &_dl_runtime_resolve & ~3))->func; + else + { + if (_dl_name_match_p (_dl_profile, l)) + { + /* This is the object we are looking for. Say that + we really want profiling and the timers are + started. */ + _dl_profile_map = l; + } + got[-2] = + (Elf32_Addr) ((struct hppa_fptr *) + ((unsigned long) &_dl_runtime_profile & ~3))->func; + } + got[-1] = ltp; + } + } + return lazy; +} + +/* 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. */ + +#define RTLD_START asm ("\ + .text + .globl _start + .type _start,@function +_start: + /* The kernel does not give us an initial stack frame. */ + ldo 64(%sp),%sp + /* Save the relevant arguments (yes, those are the correct + registers, the kernel is weird) in their stack slots. */ + stw %r25,-40(%sp) /* argc */ + stw %r24,-44(%sp) /* argv */ + + /* We need the LTP, and we need it now. */ + /* $PIC_pcrel$0 points 8 bytes past the current instruction, + just like a branch reloc. This sequence gets us the runtime + address of _DYNAMIC. */ + bl 0f,%r19 + depi 0,31,2,%r19 /* clear priviledge bits */ +0: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%r19 + ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%r26 + + /* Also get the link time address from the first entry of the GOT. */ + addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%r19 + ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r20 + + sub %r26,%r20,%r20 /* Calculate load offset */ + + /* Rummage through the dynamic entries, looking for DT_PLTGOT. */ + ldw,ma 8(%r26),%r19 +1: cmpib,=,n 3,%r19,2f /* tag == DT_PLTGOT? */ + cmpib,<>,n 0,%r19,1b + ldw,ma 8(%r26),%r19 + + /* Uh oh! We didn't find one. Abort. */ + iitlbp %r0,(%r0) + +2: ldw -4(%r26),%r19 /* Found it, load value. */ + add %r19,%r20,%r19 /* And add the load offset. */ + + /* Our initial stack layout is rather different from everyone + else's due to the unique PA-RISC ABI. As far as I know it + looks like this: + + ----------------------------------- (this frame created above) + | 32 bytes of magic | + |---------------------------------| + | 32 bytes argument/sp save area | + |---------------------------------| ((current->mm->env_end) + 63 & ~63) + | N bytes of slack | + |---------------------------------| + | envvar and arg strings | + |---------------------------------| + | ELF auxiliary info | + | (up to 28 words) | + |---------------------------------| + | Environment variable pointers | + | upwards to NULL | + |---------------------------------| + | Argument pointers | + | upwards to NULL | + |---------------------------------| + | argc (1 word) | + ----------------------------------- + + So, obviously, we can't just pass %sp to _dl_start. That's + okay, argv-4 will do just fine. + + The pleasant part of this is that if we need to skip + arguments we can just decrement argc and move argv, because + the stack pointer is utterly unrelated to the location of + the environment and argument vectors. */ + + /* This is always within range so we'll be okay. */ + bl _dl_start,%rp + ldo -4(%r24),%r26 + + /* FALLTHRU */ + .globl _dl_start_user + .type _dl_start_user,@function +_dl_start_user: + /* Save the entry point in %r3. */ + copy %ret0,%r3 + + /* Remember the lowest stack address. */ + addil LT'__libc_stack_end,%r19 + ldw RT'__libc_stack_end(%r1),%r20 + stw %sp,0(%r20) + + /* See if we were called as a command with the executable file + name as an extra leading argument. */ + addil LT'_dl_skip_args,%r19 + ldw RT'_dl_skip_args(%r1),%r20 + ldw 0(%r20),%r20 + + ldw -40(%sp),%r25 /* argc */ + comib,= 0,%r20,.Lnofix /* FIXME: will be mispredicted */ + ldw -44(%sp),%r24 /* argv (delay slot) */ + + sub %r25,%r20,%r25 + stw %r25,-40(%sp) + sh2add %r20,%r24,%r24 + stw %r24,-44(%sp) + +.Lnofix: + /* Call _dl_init(_dl_loaded, argc, argv, envp). */ + addil LT'_dl_loaded,%r19 + ldw RT'_dl_loaded(%r1),%r26 + ldw 0(%r26),%r26 + /* envp = argv + argc + 1 */ + sh2add %r25,%r24,%r23 + bl _dl_init,%r2 + ldo 4(%r23),%r23 /* delay slot */ + + /* Reload argc, argv to the registers start.S expects them in (feh) */ + ldw -40(%sp),%r25 + ldw -44(%sp),%r24 + + /* _dl_fini does have a PLT slot now. I don't know how to get + to it though, so this hack will remain. */ + .section .data +__dl_fini_plabel: + .word _dl_fini + .word 0xdeadbeef + .previous + + addil LT'__dl_fini_plabel,%r19 + ldw RT'__dl_fini_plabel(%r1),%r23 + stw %r19,4(%r23) + bv %r0(%r3) + depi 2,31,2,%r23 /* delay slot */"); + +/* This code gets called via the .plt stub, and is used in + dl-runtime.c to call the `fixup' function and then redirect to the + address it returns. + Enter with r19 = reloc offset, r20 = got-8, r21 = fixup ltp. */ +#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ + extern void tramp_name (void); \ + asm ( "\ + /* Trampoline for " #tramp_name " */ + .globl " #tramp_name " + .type " #tramp_name ",@function +" #tramp_name ": + /* Save return pointer */ + stw %r2,-20(%sp) + /* Save argument registers in the call stack frame. */ + stw %r26,-36(%sp) + stw %r25,-40(%sp) + stw %r24,-44(%sp) + stw %r23,-48(%sp) + /* Build a call frame. */ + stwm %sp,64(%sp) + + /* Set up args to fixup func. */ + ldw 8+4(%r20),%r26 /* got[1] == struct link_map * */ + copy %r19,%r25 /* reloc offset */ + + /* Call the real address resolver. */ + bl " #fixup_name ",%r2 + copy %r21,%r19 /* delay slot, set fixup func ltp */ + + ldwm -64(%sp),%sp + /* Arguments. */ + ldw -36(%sp),%r26 + ldw -40(%sp),%r25 + ldw -44(%sp),%r24 + ldw -48(%sp),%r23 + /* Return pointer. */ + ldw -20(%sp),%r2 + /* Call the real function. */ + ldw 0(%r28),%r22 + bv %r0(%r22) + ldw 4(%r28),%r19 +"); + +#ifndef PROF +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \ + TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup); +#else +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \ + strong_alias (_dl_runtime_resolve, _dl_runtime_profile); +#endif + + +/* Nonzero iff TYPE describes a relocation that should + skip the executable when looking up the symbol value. */ +#define elf_machine_lookup_noexec_p(type) ((type) == R_PARISC_COPY) + +/* Nonzero iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. */ +#define elf_machine_lookup_noplt_p(type) ((type) == R_PARISC_IPLT \ + || (type) == R_PARISC_EPLT) + +/* Used by ld.so for ... something ... */ +#define ELF_MACHINE_JMP_SLOT R_PARISC_IPLT + +/* We only use RELA. */ +#define ELF_MACHINE_NO_REL 1 + +#endif /* !dl_machine_h */ + +/* These are only actually used where RESOLVE_MAP is defined, anyway. */ +#ifdef RESOLVE_MAP + +static inline void +elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + const Elf32_Sym *sym, const struct r_found_version *version, + Elf32_Addr *const reloc_addr) +{ + const Elf32_Sym *const refsym = sym; + unsigned long const r_type = ELF32_R_TYPE (reloc->r_info); + struct link_map *sym_map; + Elf32_Addr value; + +#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); +#endif + + /* RESOLVE_MAP will return a null value for undefined syms, and + non-null for all other syms. In particular, relocs with no + symbol (symbol index of zero), also called *ABS* relocs, will be + resolved to MAP. (The first entry in a symbol table is all + zeros, and an all zero Elf32_Sym has a binding of STB_LOCAL.) + See RESOLVE_MAP definition in elf/dl-reloc.c */ +#ifdef RTLD_BOOTSTRAP + /* RESOLVE_MAP in rtld.c doesn't have the local sym test. */ + sym_map = (ELF32_ST_BIND (sym->st_info) != STB_LOCAL + ? RESOLVE_MAP (&sym, version, r_type) : map); +#else + sym_map = RESOLVE_MAP (&sym, version, r_type); +#endif + if (sym_map) + { + value = sym ? sym_map->l_addr + sym->st_value : 0; + value += reloc->r_addend; + } + else + value = 0; + + switch (r_type) + { + case R_PARISC_DIR32: +#ifndef RTLD_BOOTSTRAP + /* All hell breaks loose if we try to relocate these twice, + because any initialized variables in ld.so that refer to + other ones will have their values reset. In particular, + __fptr_next will be reset, sometimes causing endless loops in + __hppa_make_fptr(). So don't do that. */ + if (map == &_dl_rtld_map) + return; +#endif + /* Otherwise, nothing more to do here. */ + break; + + case R_PARISC_PLABEL32: + /* Easy rule: If there is a symbol and it is global, then we + need to make a dynamic function descriptor. Otherwise we + have the address of a PLT slot for a local symbol which we + know to be unique. */ + if (sym == NULL + || sym_map == NULL + || ELF32_ST_BIND (sym->st_info) == STB_LOCAL) + break; + + /* Okay, we need to make ourselves a PLABEL then. See the IA64 + code for an explanation of how this works. */ +#ifndef RTLD_BOOTSTRAP + value = __hppa_make_fptr (sym_map, value, &__fptr_root, NULL); +#else + { + struct hppa_fptr *p_boot_ldso_fptr; + struct hppa_fptr **p_fptr_root; + int *p_fptr_count; + unsigned long dot; + + /* Go from the top of __boot_ldso_fptr. As on IA64, we + probably haven't relocated the necessary values by this + point so we have to find them ourselves. */ + + asm ("bl 0f,%0 + depi 0,31,2,%0 +0: addil L'__boot_ldso_fptr - ($PIC_pcrel$0 - 8),%0 + ldo R'__boot_ldso_fptr - ($PIC_pcrel$0 - 12)(%%r1),%1 + addil L'__fptr_root - ($PIC_pcrel$0 - 16),%0 + ldo R'__fptr_root - ($PIC_pcrel$0 - 20)(%%r1),%2 + addil L'__fptr_count - ($PIC_pcrel$0 - 24),%0 + ldo R'__fptr_count - ($PIC_pcrel$0 - 28)(%%r1),%3" + : + "=r" (dot), + "=r" (p_boot_ldso_fptr), + "=r" (p_fptr_root), + "=r" (p_fptr_count)); + + value = __hppa_make_fptr (sym_map, value, p_fptr_root, + &p_boot_ldso_fptr[--*p_fptr_count]); + } +#endif + break; + + case R_PARISC_IPLT: + if (__builtin_expect (sym_map != NULL, 1)) + elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value); + else + { + /* If we get here, it's a (weak) undefined sym. */ + elf_machine_fixup_plt (NULL, map, reloc, reloc_addr, value); + } + return; + + case R_PARISC_COPY: + if (__builtin_expect (sym == NULL, 0)) + /* This can happen in trace mode if an object could not be + found. */ + break; + if (__builtin_expect (sym->st_size > refsym->st_size, 0) + || (__builtin_expect (sym->st_size < refsym->st_size, 0) + && __builtin_expect (_dl_verbose, 0))) + { + const char *strtab; + + strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]); + _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); + } + memcpy (reloc_addr, (void *) value, + MIN (sym->st_size, refsym->st_size)); + return; + + case R_PARISC_NONE: /* Alright, Wilbur. */ + return; + + default: + _dl_reloc_bad_type (map, r_type, 0); + } + + *reloc_addr = value; +} + +static inline void +elf_machine_lazy_rel (struct link_map *map, + Elf32_Addr l_addr, const Elf32_Rela *reloc) +{ + /* We don't have anything to do here. elf_machine_runtime_setup has + done all the relocs already. */ +} + +#endif /* RESOLVE_MAP */ diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c new file mode 100644 index 0000000..038404a --- /dev/null +++ b/sysdeps/hppa/dl-symaddr.c @@ -0,0 +1,39 @@ +/* Get the symbol address. HPPA version. + Copyright (C) 1999, 2000 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 <ldsodefs.h> +#include <dl-machine.h> + +void * +_dl_symbol_address (const struct link_map *map, const ElfW(Sym) *ref) +{ + Elf32_Addr value = (map ? map->l_addr : 0) + ref->st_value; + + /* On hppa, we have to return the pointer to function descriptor. */ + if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC) + return (void *) __hppa_make_fptr (map, value, &__fptr_root, NULL); + else + return (void *) value; +} + +ElfW(Addr) +_dl_start_address (const struct link_map *map, ElfW(Addr) start) +{ + return __hppa_make_fptr (map, start, &__fptr_root, NULL); +} diff --git a/sysdeps/hppa/elf/initfini.c b/sysdeps/hppa/elf/initfini.c new file mode 100644 index 0000000..c058ed0 --- /dev/null +++ b/sysdeps/hppa/elf/initfini.c @@ -0,0 +1,117 @@ +/* Special .init and .fini section support for HPPA + Copyright (C) 2000 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. + + In addition to the permissions in the GNU Library General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The Library General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + 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, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file is compiled into assembly code which is then munged by a sed + script into two files: crti.s and crtn.s. + + * crti.s puts a function prologue at the beginning of the + .init and .fini sections and defines global symbols for + those addresses, so they can be called as functions. + + * crtn.s puts the corresponding function epilogues + in the .init and .fini sections. */ + +/* If we use the standard C version, the linkage table pointer won't + be properly preserved due to the splitting up of function prologues + and epilogues. Therefore we write these in assembly to make sure + they do the right thing. + + Note that we cannot have a weak undefined __gmon_start__, because + that would require this to be PIC, and the linker is currently not + able to generate a proper procedure descriptor for _init. Sad but + true. Anyway, HPPA is one of those horrible architectures where + making the comparison and indirect call is quite expensive (see the + comment in sysdeps/generic/initfini.c). */ + +__asm__ (" + +#include \"defs.h\" + +/*@HEADER_ENDS*/ + +/*@_init_PROLOG_BEGINS*/ + .section .init + .align 4 + .globl _init + .type _init,@function + .proc + .callinfo +_init: + stw %rp,-20(%sp) + stwm %r4,64(%sp) + stw %r19,-32(%sp) + bl __gmon_start__,%rp + copy %r19,%r4 /* delay slot */ + copy %r4,%r19 + .align 4 + .procend +/*@_init_PROLOG_ENDS*/ + +/*@_init_EPILOG_BEGINS*/ + .section .init + copy %r4,%r19 + ldw -84(%sp),%rp + bv %r0(%rp) + ldwm -64(%sp),%r4 + .text + .align 4 + .weak __gmon_start__ + .type __gmon_start__,@function + .proc + .callinfo +__gmon_start__: + bv,n %r0(%r2) + .procend +/*@_init_EPILOG_ENDS*/ + +/*@_fini_PROLOG_BEGINS*/ + .section .fini + .align 4 + .globl _fini + .type _fini,@function + .proc + .callinfo +_fini: + stw %rp,-20(%sp) + stwm %r4,64(%sp) + stw %r19,-32(%sp) + copy %r19,%r4 + .align 4 + .procend +/*@_fini_PROLOG_ENDS*/ + +/*@_fini_EPILOG_BEGINS*/ + .section .fini + copy %r4,%r19 + ldw -84(%sp),%rp + bv %r0(%rp) + ldwm -64(%sp),%r4 +/*@_fini_EPILOG_ENDS*/ + +/*@TRAILER_BEGINS*/ +"); diff --git a/sysdeps/hppa/elf/start.S b/sysdeps/hppa/elf/start.S new file mode 100644 index 0000000..88bb790 --- /dev/null +++ b/sysdeps/hppa/elf/start.S @@ -0,0 +1,58 @@ + + .text + + .align 4 + + .import main, code + .import $global$, data + .import __libc_start_main, code + .import _fini, code + .import _init, code + + + + + .globl _start + .export _start, ENTRY + +_start: + + .proc + .callinfo + + /* load main */ + ldil LP%main, %r26 + ldo RP%main(%r26), %r26 + + /* argc and argv should be in 25 and 24 */ + + /* Expand the stack to store the 5th through 7th args */ + ldo 64(%sp), %sp + + /* void (*rtld_fini) (void) (actually the 6th arg) */ + stw %r23, -56(%sp) + + /* void (*init) (void) */ + ldil LP%_init, %r23 + ldo RP%_init(%r23), %r23 + + /* void (*fini) (void) */ + ldil LP%_fini, %r22 + ldo RP%_fini(%r22), %r22 + stw %r22, -52(%sp) + + /* void *stack_end */ + stw %sp, -60(%sp) + + /* load global */ + ldil L%$global$, %dp + ldo R%$global$(%dp), %dp + + bl __libc_start_main,%r2 + nop + /* die horribly if it returned (it shouldn't) */ + iitlbp %r0,(%r0) + nop + + .procend + diff --git a/sysdeps/hppa/fpu/bits/fenv.h b/sysdeps/hppa/fpu/bits/fenv.h new file mode 100644 index 0000000..7d25b99 --- /dev/null +++ b/sysdeps/hppa/fpu/bits/fenv.h @@ -0,0 +1,78 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org> + + 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 _FENV_H +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." +#endif + +/* Define bits representing the exception. We use the values of the + appropriate enable bits in the FPU status word (which, + coincidentally, are the same as the flag bits, but shifted right by + 27 bits). */ +enum +{ + FE_INVALID = 1<<4, /* V */ +#define FE_INVALID FE_INVALID + FE_DIVBYZERO = 1<<3, /* Z */ +#define FE_DIVBYZERO FE_DIVBYZERO + FE_OVERFLOW = 1<<2, /* O */ +#define FE_OVERFLOW FE_OVERFLOW + FE_UNDERFLOW = 1<<1, /* U */ +#define FE_UNDERFLOW FE_UNDERFLOW + FE_INEXACT = 1<<0, /* I */ +#define FE_INEXACT FE_INEXACT +}; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The PA-RISC FPU supports all of the four defined rounding modes. + We use the values of the RM field in the floating point status + register for the appropriate macros. */ +enum + { + FE_TONEAREST = 0 << 9, +#define FE_TONEAREST FE_TONEAREST + FE_TOWARDZERO = 1 << 9, +#define FE_TOWARDZERO FE_TOWARDZERO + FE_UPWARD = 2 << 9, +#define FE_UPWARD FE_UPWARD + FE_DOWNWARD = 3 << 9, +#define FE_DOWNWARD FE_DOWNWARD + }; + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t; + +/* Type representing floating-point environment. This structure + corresponds to the layout of the status and exception words in the + register file. */ +typedef struct +{ + unsigned int __status_word; + unsigned int __exception[7]; +} fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((fenv_t *) -1) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exceptions are masked. */ +# define FE_NOMASK_ENV ((fenv_t *) -2) +#endif diff --git a/sysdeps/hppa/fpu/fclrexcpt.c b/sysdeps/hppa/fpu/fclrexcpt.c new file mode 100644 index 0000000..4c64027 --- /dev/null +++ b/sysdeps/hppa/fpu/fclrexcpt.c @@ -0,0 +1,37 @@ +/* Clear given exceptions in current floating-point environment. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +feclearexcept (int excepts) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + /* Clear all the relevant bits. */ + sw[0] &= ~(excepts & FE_ALL_EXCEPT); + __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw)); + + /* Success. */ + return 0; +} diff --git a/sysdeps/hppa/fpu/fedisblxcpt.c b/sysdeps/hppa/fpu/fedisblxcpt.c new file mode 100644 index 0000000..95c362a --- /dev/null +++ b/sysdeps/hppa/fpu/fedisblxcpt.c @@ -0,0 +1,37 @@ +/* Disable floating-point exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fedisableexcept (int excepts) +{ + unsigned int sw[2], old_exc; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + old_exc = sw[0] & FE_ALL_EXCEPT; + + sw[0] &= ~(excepts & FE_ALL_EXCEPT); + __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw)); + + return old_exc; +} diff --git a/sysdeps/hppa/fpu/feenablxcpt.c b/sysdeps/hppa/fpu/feenablxcpt.c new file mode 100644 index 0000000..ac46722 --- /dev/null +++ b/sysdeps/hppa/fpu/feenablxcpt.c @@ -0,0 +1,37 @@ +/* Enable floating-point exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +feenableexcept (int excepts) +{ + unsigned int sw[2], old_exc; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + old_exc = sw[0] & FE_ALL_EXCEPT; + + sw[0] |= (excepts & FE_ALL_EXCEPT); + __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw)); + + return old_exc; +} diff --git a/sysdeps/hppa/fpu/fegetenv.c b/sysdeps/hppa/fpu/fegetenv.c new file mode 100644 index 0000000..0fe9773 --- /dev/null +++ b/sysdeps/hppa/fpu/fegetenv.c @@ -0,0 +1,33 @@ +/* Store current floating-point environment. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fegetenv (fenv_t *envp) +{ + __asm__ ( + "fstd %%fr0,0(%2)\n" + "fstd,ma %%fr1,8(%2)\n" + "fstd,ma %%fr2,8(%2)\n" + "fstd %%fr3,0(%2)\n" + : "=m" (*envp), "=r" (envp) : "1" (envp)); + return 0; +} diff --git a/sysdeps/hppa/fpu/fegetexcept.c b/sysdeps/hppa/fpu/fegetexcept.c new file mode 100644 index 0000000..6bf3f64 --- /dev/null +++ b/sysdeps/hppa/fpu/fegetexcept.c @@ -0,0 +1,32 @@ +/* Get enabled floating-point exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fegetexcept (void) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + return sw[0] & FE_ALL_EXCEPT; +} diff --git a/sysdeps/hppa/fpu/fegetround.c b/sysdeps/hppa/fpu/fegetround.c new file mode 100644 index 0000000..6e07f86 --- /dev/null +++ b/sysdeps/hppa/fpu/fegetround.c @@ -0,0 +1,32 @@ +/* Return current rounding direction. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fegetround (void) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + return sw[0] & FE_DOWNWARD; +} diff --git a/sysdeps/hppa/fpu/feholdexcpt.c b/sysdeps/hppa/fpu/feholdexcpt.c new file mode 100644 index 0000000..1062178 --- /dev/null +++ b/sysdeps/hppa/fpu/feholdexcpt.c @@ -0,0 +1,60 @@ +/* Store current floating-point environment and clear exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> +#include <string.h> + +int +feholdexcept (fenv_t *envp) +{ + fenv_t clear; + + /* Store the environment. */ + { + fenv_t * _regs = envp; + __asm__ ( + "fstd %%fr0,0(%2)\n" + "fstd,ma %%fr1,8(%2)\n" + "fstd,ma %%fr2,8(%2)\n" + "fstd %%fr3,0(%2)\n" + : "=m" (*_regs), "=r" (_regs) : "1" (_regs)); + memcpy (&clear, envp, sizeof (clear)); + } + + /* Now clear all exceptions. */ + clear.__status_word &= ~(FE_ALL_EXCEPT << 27); + memset (clear.__exception, 0, sizeof (clear.__exception)); + + /* And set all exceptions to non-stop. */ + clear.__status_word &= ~FE_ALL_EXCEPT; + + /* Load the new environment. */ + { + fenv_t * _regs = &clear + 1; + __asm__ ( + "fldd,mb -8(%2),%%fr3\n" + "fldd,mb -8(%2),%%fr2\n" + "fldd,mb -8(%2),%%fr1\n" + "fldd -8(%2),%%fr0\n" + : "=m" (*_regs), "=r" (_regs) : "1" (_regs)); + } + + return 0; +} diff --git a/sysdeps/hppa/fpu/fesetenv.c b/sysdeps/hppa/fpu/fesetenv.c new file mode 100644 index 0000000..4bfbefd --- /dev/null +++ b/sysdeps/hppa/fpu/fesetenv.c @@ -0,0 +1,70 @@ +/* Install given floating-point environment. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + Based on the m68k version by + Andreas Schwab <schwab@suse.de> + + 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 <fenv.h> + +int +fesetenv (const fenv_t *envp) +{ + fenv_t temp; + + /* Install the environment specified by ENVP. But there are a few + values which we do not want to come from the saved environment. + Therefore, we get the current environment and replace the values + we want to use from the environment specified by the parameter. */ + { + fenv_t * _regs = &temp; + __asm__ ( + "fstd %%fr0,0(%2)\n" + "fstd,ma %%fr1,8(%2)\n" + "fstd,ma %%fr2,8(%2)\n" + "fstd %%fr3,0(%2)\n" + : "=m" (*_regs), "=r" (_regs) : "1" (_regs)); + } + + temp.__status_word &= ~(FE_ALL_EXCEPT + | (FE_ALL_EXCEPT << 27) + | FE_DOWNWARD); + if (envp == FE_DFL_ENV) + ; + else if (envp == FE_NOMASK_ENV) + temp.__status_word |= FE_ALL_EXCEPT; + else + temp.__status_word |= (envp->__status_word + & (FE_ALL_EXCEPT + | FE_DOWNWARD + | (FE_ALL_EXCEPT << 27))); + + /* Load the new environment. */ + { + fenv_t * _regs = &temp + 1; + __asm__ ( + "fldd,mb -8(%2),%%fr3\n" + "fldd,mb -8(%2),%%fr2\n" + "fldd,mb -8(%2),%%fr1\n" + "fldd -8(%2),%%fr0\n" + : "=m" (*_regs), "=r" (_regs) : "1" (_regs)); + } + + /* Success. */ + return 0; +} diff --git a/sysdeps/hppa/fpu/fesetround.c b/sysdeps/hppa/fpu/fesetround.c new file mode 100644 index 0000000..0d5858f --- /dev/null +++ b/sysdeps/hppa/fpu/fesetround.c @@ -0,0 +1,39 @@ +/* Set current rounding direction. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fesetround (int round) +{ + unsigned int sw[2]; + + if (round & ~FE_DOWNWARD) + /* ROUND is not a valid rounding mode. */ + return 1; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + sw[0] &= ~FE_UPWARD; + sw[0] |= round; + __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw)); + + return 0; +} diff --git a/sysdeps/hppa/fpu/feupdateenv.c b/sysdeps/hppa/fpu/feupdateenv.c new file mode 100644 index 0000000..7e2d715 --- /dev/null +++ b/sysdeps/hppa/fpu/feupdateenv.c @@ -0,0 +1,40 @@ +/* Install given floating-point environment and raise exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +feupdateenv (const fenv_t *envp) +{ + unsigned int sw[2]; + + /* Get the current exception status. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + sw[0] &= (FE_ALL_EXCEPT << 27); + + /* Install new environment. */ + fesetenv (envp); + + /* Raise the saved exception. */ + feraiseexcept (sw[0] >> 27); + + /* Success. */ + return 0; +} diff --git a/sysdeps/hppa/fpu/fgetexcptflg.c b/sysdeps/hppa/fpu/fgetexcptflg.c new file mode 100644 index 0000000..800b1f4 --- /dev/null +++ b/sysdeps/hppa/fpu/fgetexcptflg.c @@ -0,0 +1,36 @@ +/* Store current representation for exceptions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fegetexceptflag (fexcept_t *flagp, int excepts) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + *flagp = (sw[0] >> 27) & excepts & FE_ALL_EXCEPT; + + /* Success. */ + return 0; +} + diff --git a/sysdeps/hppa/fpu/fraiseexcpt.c b/sysdeps/hppa/fpu/fraiseexcpt.c new file mode 100644 index 0000000..7feeb99 --- /dev/null +++ b/sysdeps/hppa/fpu/fraiseexcpt.c @@ -0,0 +1,89 @@ +/* Raise given exceptions. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org> + + 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 <fenv.h> +#include <math.h> + +int +feraiseexcept (int excepts) +{ + /* Raise exceptions represented by EXCEPTS. But we must raise only one + signal at a time. It is important that if the overflow/underflow + exception and the divide by zero exception are given at the same + time, the overflow/underflow exception follows the divide by zero + exception. */ + + /* We do these bits in assembly to be certain GCC doesn't optimize + away something important, and so we can force delayed traps to + occur. */ + + /* FIXME: These all need verification! */ + + /* First: invalid exception. */ + if (excepts & FE_INVALID) + { + /* One example of a invalid operation is 0 * Infinity. */ + double d = HUGE_VAL; + __asm__ __volatile__ ("fmpy,dbl %1,%%fr0,%0\n\t" + /* FIXME: is this a proper trap barrier? */ + "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d)); + } + + /* Next: division by zero. */ + if (excepts & FE_DIVBYZERO) + { + double d = 1.0; + __asm__ __volatile__ ("fdiv,dbl %1,%%fr0,%0\n\t" + "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d)); + } + + /* Next: overflow. */ + /* FIXME: Compare with IA-64 - do we have the same problem? */ + if (excepts & FE_OVERFLOW) + { + double d = DBL_MAX; + + __asm__ __volatile__ ("fmpy,dbl %1,%1,%0\n\t" + "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d)); + } + + /* Next: underflow. */ + if (excepts & FE_UNDERFLOW) + { + double d = DBL_MIN; + double e = 69.69; + + __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t" + "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e)); + } + + /* Last: inexact. */ + if (excepts & FE_INEXACT) + { + double d = 1.0; + double e = M_PI; + + __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t" + "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e)); + } + + /* Success. */ + return 0; +} diff --git a/sysdeps/hppa/fpu/fsetexcptflg.c b/sysdeps/hppa/fpu/fsetexcptflg.c new file mode 100644 index 0000000..2e369ea --- /dev/null +++ b/sysdeps/hppa/fpu/fsetexcptflg.c @@ -0,0 +1,41 @@ +/* Set floating-point environment exception handling. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> +#include <math.h> + +int +fesetexceptflag (const fexcept_t *flagp, int excepts) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + /* Install the new exception flags bits. */ + sw[0] &= ~(excepts & (FE_ALL_EXCEPT >> 27)); + sw[0] |= (*flagp & excepts & FE_ALL_EXCEPT) << 27; + + /* Store the new status word. */ + __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw)); + + /* Success. */ + return 0; +} diff --git a/sysdeps/hppa/fpu/ftestexcept.c b/sysdeps/hppa/fpu/ftestexcept.c new file mode 100644 index 0000000..15d1491 --- /dev/null +++ b/sysdeps/hppa/fpu/ftestexcept.c @@ -0,0 +1,32 @@ +/* Test exception in current environment. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000 + + 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 <fenv.h> + +int +fetestexcept (int excepts) +{ + unsigned int sw[2]; + + /* Get the current status word. */ + __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw)); + + return (sw[0] >> 27) & excepts & FE_ALL_EXCEPT; +} diff --git a/sysdeps/hppa/frame.h b/sysdeps/hppa/frame.h new file mode 100644 index 0000000..e6764da --- /dev/null +++ b/sysdeps/hppa/frame.h @@ -0,0 +1,28 @@ +/* Definition of stack frame structure. HPPA version. + Copyright (C) 2000 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. */ + +/* PA stacks grow upwards. */ +#define INNER_THAN > + +/* FIXME: will verify this later */ +struct layout +{ + void *next; + void *return_address; +}; diff --git a/sysdeps/hppa/hppa1.1/Implies b/sysdeps/hppa/hppa1.1/Implies new file mode 100644 index 0000000..5f935a2 --- /dev/null +++ b/sysdeps/hppa/hppa1.1/Implies @@ -0,0 +1,4 @@ +wordsize-32 +ieee754/flt-32 +ieee754/dbl-64 +ieee754/ldbl-128 diff --git a/sysdeps/hppa/hppa1.1/addmul_1.s b/sysdeps/hppa/hppa1.1/addmul_1.s index 0fdcb3c..5b3e0482 100644 --- a/sysdeps/hppa/hppa1.1/addmul_1.s +++ b/sysdeps/hppa/hppa1.1/addmul_1.s @@ -1,71 +1,72 @@ -; HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and -; add the result to a second limb vector. +;! HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and +;! add the result to a second limb vector. -; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr r26 -; s1_ptr r25 -; size r24 -; s2_limb r23 +;! INPUT PARAMETERS +;! res_ptr r26 +;! s1_ptr r25 +;! size r24 +;! s2_limb r23 -; This runs at 11 cycles/limb on a PA7000. With the used instructions, it -; can not become faster due to data cache contention after a store. On the -; PA7100 it runs at 10 cycles/limb, and that can not be improved either, -; since only the xmpyu does not need the integer pipeline, so the only -; dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb -; on the PA7100. +;! This runs at 11 cycles/limb on a PA7000. With the used instructions, it +;! can not become faster due to data cache contention after a store. On the +;! PA7100 it runs at 10 cycles/limb, and that can not be improved either, +;! since only the xmpyu does not need the integer pipeline, so the only +;! dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb +;! on the PA7100. -; There are some ideas described in mul_1.s that applies to this code too. +;! There are some ideas described in mul_1.s that applies to this code too. - .code + .text .export __mpn_addmul_1 -__mpn_addmul_1 +__mpn_addmul_1: .proc .callinfo frame=64,no_calls .entry ldo 64(%r30),%r30 fldws,ma 4(%r25),%fr5 - stw %r23,-16(%r30) ; move s2_limb ... + stw %r23,-16(%r30) ;! move s2_limb ... addib,= -1,%r24,L$just_one_limb - fldws -16(%r30),%fr4 ; ... into fr4 - add %r0,%r0,%r0 ; clear carry + fldws -16(%r30),%fr4 ;! ... into fr4 + add %r0,%r0,%r0 ;! clear carry xmpyu %fr4,%fr5,%fr6 fldws,ma 4(%r25),%fr7 fstds %fr6,-16(%r30) xmpyu %fr4,%fr7,%fr8 - ldw -12(%r30),%r19 ; least significant limb in product + ldw -12(%r30),%r20 ;! least significant limb in product ldw -16(%r30),%r28 fstds %fr8,-16(%r30) addib,= -1,%r24,L$end ldw -12(%r30),%r1 -; Main loop -L$loop ldws 0(%r26),%r29 +;! Main loop +L$loop: + ldws 0(%r26),%r29 fldws,ma 4(%r25),%fr5 - add %r29,%r19,%r19 - stws,ma %r19,4(%r26) - addc %r28,%r1,%r19 + add %r29,%r20,%r20 + stws,ma %r20,4(%r26) + addc %r28,%r1,%r20 xmpyu %fr4,%fr5,%fr6 ldw -16(%r30),%r28 fstds %fr6,-16(%r30) @@ -73,27 +74,28 @@ L$loop ldws 0(%r26),%r29 addib,<> -1,%r24,L$loop ldw -12(%r30),%r1 -L$end ldw 0(%r26),%r29 - add %r29,%r19,%r19 - stws,ma %r19,4(%r26) - addc %r28,%r1,%r19 +L$end: + ldw 0(%r26),%r29 + add %r29,%r20,%r20 + stws,ma %r20,4(%r26) + addc %r28,%r1,%r20 ldw -16(%r30),%r28 ldws 0(%r26),%r29 addc %r0,%r28,%r28 - add %r29,%r19,%r19 - stws,ma %r19,4(%r26) + add %r29,%r20,%r20 + stws,ma %r20,4(%r26) addc %r0,%r28,%r28 bv 0(%r2) - ldo -64(%r30),%r30 + ldo -64(%r30),%r30 -L$just_one_limb +L$just_one_limb: xmpyu %fr4,%fr5,%fr6 ldw 0(%r26),%r29 fstds %fr6,-16(%r30) ldw -12(%r30),%r1 ldw -16(%r30),%r28 - add %r29,%r1,%r19 - stw %r19,0(%r26) + add %r29,%r1,%r20 + stw %r20,0(%r26) addc %r0,%r28,%r28 bv 0(%r2) ldo -64(%r30),%r30 diff --git a/sysdeps/hppa/hppa1.1/mul_1.s b/sysdeps/hppa/hppa1.1/mul_1.s index cdd0c1d..7f53916 100644 --- a/sysdeps/hppa/hppa1.1/mul_1.s +++ b/sysdeps/hppa/hppa1.1/mul_1.s @@ -1,92 +1,94 @@ -; HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store -; the result in a second limb vector. +;! HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store +;! the result in a second limb vector. -; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr r26 -; s1_ptr r25 -; size r24 -; s2_limb r23 +;! INPUT PARAMETERS +;! res_ptr r26 +;! s1_ptr r25 +;! size r24 +;! s2_limb r23 -; This runs at 9 cycles/limb on a PA7000. With the used instructions, it can -; not become faster due to data cache contention after a store. On the -; PA7100 it runs at 7 cycles/limb, and that can not be improved either, since -; only the xmpyu does not need the integer pipeline, so the only dual-issue -; we will get are addc+xmpyu. Unrolling would not help either CPU. +;! This runs at 9 cycles/limb on a PA7000. With the used instructions, it can +;! not become faster due to data cache contention after a store. On the +;! PA7100 it runs at 7 cycles/limb, and that can not be improved either, since +;! only the xmpyu does not need the integer pipeline, so the only dual-issue +;! we will get are addc+xmpyu. Unrolling would not help either CPU. -; We could use fldds to read two limbs at a time from the S1 array, and that -; could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and -; PA7100, respectively. We don't do that since it does not seem worth the -; (alignment) troubles... +;! We could use fldds to read two limbs at a time from the S1 array, and that +;! could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and +;! PA7100, respectively. We don't do that since it does not seem worth the +;! (alignment) troubles... -; At least the PA7100 is rumored to be able to deal with cache-misses -; without stalling instruction issue. If this is true, and the cache is -; actually also lockup-free, we should use a deeper software pipeline, and -; load from S1 very early! (The loads and stores to -12(sp) will surely be -; in the cache.) +;! At least the PA7100 is rumored to be able to deal with cache-misses +;! without stalling instruction issue. If this is true, and the cache is +;! actually also lockup-free, we should use a deeper software pipeline, and +;! load from S1 very early; (The loads and stores to -12(sp) will surely be +;! in the cache.) - .code + .text .export __mpn_mul_1 -__mpn_mul_1 +__mpn_mul_1: .proc .callinfo frame=64,no_calls .entry ldo 64(%r30),%r30 fldws,ma 4(%r25),%fr5 - stw %r23,-16(%r30) ; move s2_limb ... + stw %r23,-16(%r30) ;! move s2_limb ... addib,= -1,%r24,L$just_one_limb - fldws -16(%r30),%fr4 ; ... into fr4 - add %r0,%r0,%r0 ; clear carry + fldws -16(%r30),%fr4 ;! ... into fr4 + add %r0,%r0,%r0 ;! clear carry xmpyu %fr4,%fr5,%fr6 fldws,ma 4(%r25),%fr7 fstds %fr6,-16(%r30) xmpyu %fr4,%fr7,%fr8 - ldw -12(%r30),%r19 ; least significant limb in product + ldw -12(%r30),%r20 ;! least significant limb in product ldw -16(%r30),%r28 fstds %fr8,-16(%r30) addib,= -1,%r24,L$end ldw -12(%r30),%r1 -; Main loop -L$loop fldws,ma 4(%r25),%fr5 - stws,ma %r19,4(%r26) - addc %r28,%r1,%r19 +;! Main loop +L$loop: + fldws,ma 4(%r25),%fr5 + stws,ma %r20,4(%r26) + addc %r28,%r1,%r20 xmpyu %fr4,%fr5,%fr6 ldw -16(%r30),%r28 fstds %fr6,-16(%r30) addib,<> -1,%r24,L$loop ldw -12(%r30),%r1 -L$end stws,ma %r19,4(%r26) - addc %r28,%r1,%r19 +L$end: + stws,ma %r20,4(%r26) + addc %r28,%r1,%r20 ldw -16(%r30),%r28 - stws,ma %r19,4(%r26) + stws,ma %r20,4(%r26) addc %r0,%r28,%r28 bv 0(%r2) ldo -64(%r30),%r30 -L$just_one_limb +L$just_one_limb: xmpyu %fr4,%fr5,%fr6 fstds %fr6,-16(%r30) ldw -16(%r30),%r28 diff --git a/sysdeps/hppa/hppa1.1/submul_1.s b/sysdeps/hppa/hppa1.1/submul_1.s index a4a3854..f2c19c7 100644 --- a/sysdeps/hppa/hppa1.1/submul_1.s +++ b/sysdeps/hppa/hppa1.1/submul_1.s @@ -1,77 +1,78 @@ -; HP-PA-1.1 __mpn_submul_1 -- Multiply a limb vector with a limb and -; subtract the result from a second limb vector. +;! HP-PA-1.1 __mpn_submul_1 -- Multiply a limb vector with a limb and +;! subtract the result from a second limb vector. -; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr r26 -; s1_ptr r25 -; size r24 -; s2_limb r23 +;! INPUT PARAMETERS +;! res_ptr r26 +;! s1_ptr r25 +;! size r24 +;! s2_limb r23 -; This runs at 12 cycles/limb on a PA7000. With the used instructions, it -; can not become faster due to data cache contention after a store. On the -; PA7100 it runs at 11 cycles/limb, and that can not be improved either, -; since only the xmpyu does not need the integer pipeline, so the only -; dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb -; on the PA7100. +;! This runs at 12 cycles/limb on a PA7000. With the used instructions, it +;! can not become faster due to data cache contention after a store. On the +;! PA7100 it runs at 11 cycles/limb, and that can not be improved either, +;! since only the xmpyu does not need the integer pipeline, so the only +;! dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb +;! on the PA7100. -; There are some ideas described in mul_1.s that applies to this code too. +;! There are some ideas described in mul_1.s that applies to this code too. -; It seems possible to make this run as fast as __mpn_addmul_1, if we use -; sub,>>= %r29,%r19,%r22 -; addi 1,%r28,%r28 -; but that requires reworking the hairy software pipeline... +;! It seems possible to make this run as fast as __mpn_addmul_1, if we use +;! sub,>>= %r29,%r20,%r22 +;! addi 1,%r28,%r28 +;! but that requires reworking the hairy software pipeline... - .code + .text .export __mpn_submul_1 -__mpn_submul_1 +__mpn_submul_1: .proc .callinfo frame=64,no_calls .entry ldo 64(%r30),%r30 fldws,ma 4(%r25),%fr5 - stw %r23,-16(%r30) ; move s2_limb ... + stw %r23,-16(%r30) ;! move s2_limb ... addib,= -1,%r24,L$just_one_limb - fldws -16(%r30),%fr4 ; ... into fr4 - add %r0,%r0,%r0 ; clear carry + fldws -16(%r30),%fr4 ;! ... into fr4 + add %r0,%r0,%r0 ;! clear carry xmpyu %fr4,%fr5,%fr6 fldws,ma 4(%r25),%fr7 fstds %fr6,-16(%r30) xmpyu %fr4,%fr7,%fr8 - ldw -12(%r30),%r19 ; least significant limb in product + ldw -12(%r30),%r20 ;! least significant limb in product ldw -16(%r30),%r28 fstds %fr8,-16(%r30) addib,= -1,%r24,L$end ldw -12(%r30),%r1 -; Main loop -L$loop ldws 0(%r26),%r29 +;! Main loop +L$loop: + ldws 0(%r26),%r29 fldws,ma 4(%r25),%fr5 - sub %r29,%r19,%r22 - add %r22,%r19,%r0 + sub %r29,%r20,%r22 + add %r22,%r20,%r0 stws,ma %r22,4(%r26) - addc %r28,%r1,%r19 + addc %r28,%r1,%r20 xmpyu %fr4,%fr5,%fr6 ldw -16(%r30),%r28 fstds %fr6,-16(%r30) @@ -79,22 +80,23 @@ L$loop ldws 0(%r26),%r29 addib,<> -1,%r24,L$loop ldw -12(%r30),%r1 -L$end ldw 0(%r26),%r29 - sub %r29,%r19,%r22 - add %r22,%r19,%r0 +L$end: + ldw 0(%r26),%r29 + sub %r29,%r20,%r22 + add %r22,%r20,%r0 stws,ma %r22,4(%r26) - addc %r28,%r1,%r19 + addc %r28,%r1,%r20 ldw -16(%r30),%r28 ldws 0(%r26),%r29 addc %r0,%r28,%r28 - sub %r29,%r19,%r22 - add %r22,%r19,%r0 + sub %r29,%r20,%r22 + add %r22,%r20,%r0 stws,ma %r22,4(%r26) addc %r0,%r28,%r28 bv 0(%r2) ldo -64(%r30),%r30 -L$just_one_limb +L$just_one_limb: xmpyu %fr4,%fr5,%fr6 ldw 0(%r26),%r29 fstds %fr6,-16(%r30) diff --git a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s b/sysdeps/hppa/hppa1.1/udiv_qrnnd.s index bf7dc70..c0a02d8 100644 --- a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s +++ b/sysdeps/hppa/hppa1.1/udiv_qrnnd.s @@ -1,53 +1,55 @@ -; HP-PA __udiv_qrnnd division support, used from longlong.h. -; This version runs fast on PA 7000 and later. +;! HP-PA __udiv_qrnnd division support, used from longlong.h. +;! This version runs fast on PA 7000 and later. -; Copyright (C) 1993, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1993, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; rem_ptr gr26 -; n1 gr25 -; n0 gr24 -; d gr23 +;! INPUT PARAMETERS +;! rem_ptr gr26 +;! n1 gr25 +;! n0 gr24 +;! d gr23 - .code -L$0000 .word 0x43f00000 + .text +L$0000: + .word 0x43f00000 .word 0x0 .export __udiv_qrnnd -__udiv_qrnnd +__udiv_qrnnd: .proc .callinfo frame=64,no_calls .entry ldo 64(%r30),%r30 - stws %r25,-16(0,%r30) ; n_hi - stws %r24,-12(0,%r30) ; n_lo - ldil L'L$0000,%r19 - ldo R'L$0000(%r19),%r19 + stws %r25,-16(0,%r30) ;! n_hi + stws %r24,-12(0,%r30) ;! n_lo + b,l L$0,%r1 + ldo L$0000-L$0(%r1),%r1 +L$0: fldds -16(0,%r30),%fr5 stws %r23,-12(0,%r30) comib,<= 0,%r25,L$1 fcnvxf,dbl,dbl %fr5,%fr5 - fldds 0(0,%r19),%fr4 + fldds 0(0,%r1),%fr4 fadd,dbl %fr4,%fr5,%fr5 -L$1 +L$1: fcpy,sgl %fr0,%fr6L fldws -12(0,%r30),%fr6R fcnvxf,dbl,dbl %fr6,%fr4 @@ -62,13 +64,14 @@ L$1 ldws -12(0,%r30),%r21 ldws -16(0,%r30),%r20 sub %r24,%r21,%r22 - subb %r25,%r20,%r19 - comib,= 0,%r19,L$2 + subb %r25,%r20,%r1 + comib,= 0,%r1,L$2 ldo -64(%r30),%r30 add %r22,%r23,%r22 ldo -1(%r28),%r28 -L$2 bv 0(%r2) +L$2: + bv 0(%r2) stws %r22,0(0,%r26) .exit diff --git a/sysdeps/hppa/lshift.s b/sysdeps/hppa/lshift.s index abac6ec..de6dd76 100644 --- a/sysdeps/hppa/lshift.s +++ b/sysdeps/hppa/lshift.s @@ -1,34 +1,34 @@ -; HP-PA __mpn_lshift -- +;! HP-PA __mpn_lshift -- -; Copyright (C) 1992, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr gr26 -; s_ptr gr25 -; size gr24 -; cnt gr23 +;! INPUT PARAMETERS +;! res_ptr gr26 +;! s_ptr gr25 +;! size gr24 +;! cnt gr23 - .code + .text .export __mpn_lshift -__mpn_lshift +__mpn_lshift: .proc .callinfo frame=64,no_calls .entry @@ -39,12 +39,12 @@ __mpn_lshift subi 32,%r23,%r1 mtsar %r1 addib,= -1,%r24,L$0004 - vshd %r0,%r22,%r28 ; compute carry out limb + vshd %r0,%r22,%r28 ;! compute carry out limb ldws,mb -4(0,%r25),%r29 addib,= -1,%r24,L$0002 vshd %r22,%r29,%r20 -L$loop ldws,mb -4(0,%r25),%r22 +L$loop: ldws,mb -4(0,%r25),%r22 stws,mb %r20,-4(0,%r26) addib,= -1,%r24,L$0003 vshd %r29,%r22,%r20 @@ -53,12 +53,12 @@ L$loop ldws,mb -4(0,%r25),%r22 addib,<> -1,%r24,L$loop vshd %r22,%r29,%r20 -L$0002 stws,mb %r20,-4(0,%r26) +L$0002: stws,mb %r20,-4(0,%r26) vshd %r29,%r0,%r20 bv 0(%r2) stw %r20,-4(0,%r26) -L$0003 stws,mb %r20,-4(0,%r26) -L$0004 vshd %r22,%r0,%r20 +L$0003: stws,mb %r20,-4(0,%r26) +L$0004: vshd %r22,%r0,%r20 bv 0(%r2) stw %r20,-4(0,%r26) diff --git a/sysdeps/hppa/memusage.h b/sysdeps/hppa/memusage.h new file mode 100644 index 0000000..5a06b7b --- /dev/null +++ b/sysdeps/hppa/memusage.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 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. */ + +#define GETSP() ({ register uintptr_t stack_ptr asm ("%r30"); stack_ptr; }) +#define STACK_GROWS_UPWARD 1 + +#include <sysdeps/generic/memusage.h> diff --git a/sysdeps/hppa/rshift.s b/sysdeps/hppa/rshift.s index c1480e5..bba60cf 100644 --- a/sysdeps/hppa/rshift.s +++ b/sysdeps/hppa/rshift.s @@ -1,34 +1,34 @@ -; HP-PA __mpn_rshift -- +;! HP-PA __mpn_rshift -- -; Copyright (C) 1992, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr gr26 -; s_ptr gr25 -; size gr24 -; cnt gr23 +;! INPUT PARAMETERS +;! res_ptr gr26 +;! s_ptr gr25 +;! size gr24 +;! cnt gr23 - .code + .text .export __mpn_rshift -__mpn_rshift +__mpn_rshift: .proc .callinfo frame=64,no_calls .entry @@ -36,12 +36,12 @@ __mpn_rshift ldws,ma 4(0,%r25),%r22 mtsar %r23 addib,= -1,%r24,L$0004 - vshd %r22,%r0,%r28 ; compute carry out limb + vshd %r22,%r0,%r28 ;! compute carry out limb ldws,ma 4(0,%r25),%r29 addib,= -1,%r24,L$0002 vshd %r29,%r22,%r20 -L$loop ldws,ma 4(0,%r25),%r22 +L$loop: ldws,ma 4(0,%r25),%r22 stws,ma %r20,4(0,%r26) addib,= -1,%r24,L$0003 vshd %r22,%r29,%r20 @@ -50,12 +50,12 @@ L$loop ldws,ma 4(0,%r25),%r22 addib,<> -1,%r24,L$loop vshd %r29,%r22,%r20 -L$0002 stws,ma %r20,4(0,%r26) +L$0002: stws,ma %r20,4(0,%r26) vshd %r0,%r29,%r20 bv 0(%r2) stw %r20,0(0,%r26) -L$0003 stws,ma %r20,4(0,%r26) -L$0004 vshd %r0,%r22,%r20 +L$0003: stws,ma %r20,4(0,%r26) +L$0004: vshd %r0,%r22,%r20 bv 0(%r2) stw %r20,0(0,%r26) diff --git a/sysdeps/hppa/setjmp.S b/sysdeps/hppa/setjmp.S new file mode 100644 index 0000000..0890975 --- /dev/null +++ b/sysdeps/hppa/setjmp.S @@ -0,0 +1,69 @@ +/* setjmp for HPPA. + Copyright (C) 1995, 1996, 1997, 1999 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> +#define _ASM +#define _SETJMP_H +#include <bits/setjmp.h> + + + .text + .align 4 + .import __sigjmp_save, code + .globl __sigsetjmp + .export __sigsetjmp, code + .proc + .callinfo +__sigsetjmp: + stw %r3, 0(%r26) + stw %r4, 8(%r26) + stw %r5, 12(%r26) + stw %r6, 16(%r26) + stw %r7, 20(%r26) + stw %r8, 24(%r26) + stw %r9, 28(%r26) + stw %r10, 32(%r26) + stw %r11, 36(%r26) + stw %r12, 40(%r26) + stw %r13, 44(%r26) + stw %r14, 48(%r26) + stw %r15, 52(%r26) + stw %r16, 56(%r26) + stw %r17, 60(%r26) + stw %r18, 64(%r26) + stw %r19, 68(%r26) + stw %r27, 72(%r26) + stw %r30, 76(%r26) + + stw %rp, 80(%r26) + + ldo 88(%r26),%r19 + fstds,ma %fr12, 8(%r19) /* 88 */ + fstds,ma %fr13, 8(%r19) /* 96 */ + fstds,ma %fr14, 8(%r19) /* 104 */ + fstds,ma %fr15, 8(%r19) /* 112 */ + fstds,ma %fr16, 8(%r19) /* 120 */ + fstds,ma %fr17, 8(%r19) /* 128 */ + fstds,ma %fr18, 8(%r19) /* 136 */ + fstds,ma %fr19, 8(%r19) /* 144 */ + fstds,ma %fr20, 8(%r19) /* 152 */ + fstds %fr21, 0(%r19) /* 160 */ + b __sigjmp_save + nop + .procend diff --git a/sysdeps/hppa/sub_n.s b/sysdeps/hppa/sub_n.s index 04fa3e1..b50bb11 100644 --- a/sysdeps/hppa/sub_n.s +++ b/sysdeps/hppa/sub_n.s @@ -1,56 +1,56 @@ -; HP-PA __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and -; store difference in a third limb vector. +;! HP-PA __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and +;! store difference in a third limb vector. -; Copyright (C) 1992, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1992, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; res_ptr gr26 -; s1_ptr gr25 -; s2_ptr gr24 -; size gr23 +;! INPUT PARAMETERS +;! res_ptr gr26 +;! s1_ptr gr25 +;! s2_ptr gr24 +;! size gr23 -; One might want to unroll this as for other processors, but it turns -; out that the data cache contention after a store makes such -; unrolling useless. We can't come under 5 cycles/limb anyway. +;! One might want to unroll this as for other processors, but it turns +;! out that the data cache contention after a store makes such +;! unrolling useless. We can't come under 5 cycles/limb anyway. - .code + .text .export __mpn_sub_n -__mpn_sub_n +__mpn_sub_n: .proc .callinfo frame=0,no_calls .entry - ldws,ma 4(0,%r25),%r20 - ldws,ma 4(0,%r24),%r19 + ldws,ma 4(0,%r25),%r21 + ldws,ma 4(0,%r24),%r20 - addib,= -1,%r23,L$end ; check for (SIZE == 1) - sub %r20,%r19,%r28 ; subtract first limbs ignoring cy + addib,= -1,%r23,L$end ;! check for (SIZE == 1) + sub %r21,%r20,%r28 ;! subtract first limbs ignoring cy -L$loop ldws,ma 4(0,%r25),%r20 - ldws,ma 4(0,%r24),%r19 +L$loop: ldws,ma 4(0,%r25),%r21 + ldws,ma 4(0,%r24),%r20 stws,ma %r28,4(0,%r26) addib,<> -1,%r23,L$loop - subb %r20,%r19,%r28 + subb %r21,%r20,%r28 -L$end stws %r28,0(0,%r26) +L$end: stws %r28,0(0,%r26) addc %r0,%r0,%r28 bv 0(%r2) subi 1,%r28,%r28 diff --git a/sysdeps/hppa/sysdep.h b/sysdeps/hppa/sysdep.h index 735882d..2ac9840 100644 --- a/sysdeps/hppa/sysdep.h +++ b/sysdeps/hppa/sysdep.h @@ -20,6 +20,11 @@ #include <sysdeps/generic/sysdep.h> #include <sys/syscall.h> +#include "config.h" + +#ifndef ASM_LINE_SEP +#define ASM_LINE_SEP ; +#endif #ifdef __ASSEMBLER__ @@ -34,13 +39,12 @@ incomplete stabs information. Fake some entries here which specify the current source file. */ #define ENTRY(name) \ - .SPACE $TEXT$; \ - .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY; \ - .align ALIGNARG(4); \ - .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY; \ - .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR; \ + .SPACE $TEXT$ ASM_LINE_SEP \ + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \ + .align ALIGNARG(4) ASM_LINE_SEP \ + .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \ + .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\ C_LABEL(name) \ - CALL_MCOUNT #undef END @@ -53,7 +57,7 @@ /* The mcount code relies on a normal frame pointer being on the stack to locate our caller, so push one just for its benefit. */ #define CALL_MCOUNT \ - XXX + XXX ASM_LINE_SEP #else #define CALL_MCOUNT /* Do nothing. */ #endif diff --git a/sysdeps/hppa/udiv_qrnnd.s b/sysdeps/hppa/udiv_qrnnd.s index 9b45eb4..0532057 100644 --- a/sysdeps/hppa/udiv_qrnnd.s +++ b/sysdeps/hppa/udiv_qrnnd.s @@ -1,45 +1,45 @@ -; HP-PA __udiv_qrnnd division support, used from longlong.h. -; This version runs fast on pre-PA7000 CPUs. +;! HP-PA __udiv_qrnnd division support, used from longlong.h. +;! This version runs fast on pre-PA7000 CPUs. -; Copyright (C) 1993, 1994 Free Software Foundation, Inc. +;! Copyright (C) 1993, 1994 Free Software Foundation, Inc. -; This file is part of the GNU MP Library. +;! This file is part of the GNU MP Library. -; The GNU MP 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 MP 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 MP 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. +;! The GNU MP 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 MP 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. +;! You should have received a copy of the GNU Library General Public License +;! along with the GNU MP 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. -; INPUT PARAMETERS -; rem_ptr gr26 -; n1 gr25 -; n0 gr24 -; d gr23 +;! INPUT PARAMETERS +;! rem_ptr gr26 +;! n1 gr25 +;! n0 gr24 +;! d gr23 -; The code size is a bit excessive. We could merge the last two ds;addc -; sequences by simply moving the "bb,< Odd" instruction down. The only -; trouble is the FFFFFFFF code that would need some hacking. +;! The code size is a bit excessive. We could merge the last two ds;addc +;! sequences by simply moving the "bb,< Odd" instruction down. The only +;! trouble is the FFFFFFFF code that would need some hacking. - .code + .text .export __udiv_qrnnd -__udiv_qrnnd +__udiv_qrnnd: .proc .callinfo frame=0,no_calls .entry comb,< %r23,0,L$largedivisor - sub %r0,%r23,%r1 ; clear cy as side-effect + sub %r0,%r23,%r1 ;! clear cy as side-effect ds %r0,%r1,%r0 addc %r24,%r24,%r24 ds %r25,%r23,%r25 @@ -111,12 +111,12 @@ __udiv_qrnnd bv 0(%r2) addc %r28,%r28,%r28 -L$largedivisor - extru %r24,31,1,%r19 ; r19 = n0 & 1 +L$largedivisor: + extru %r24,31,1,%r20 ;! r20 = n0 & 1 bb,< %r23,31,L$odd - extru %r23,30,31,%r22 ; r22 = d >> 1 - shd %r25,%r24,1,%r24 ; r24 = new n0 - extru %r25,30,31,%r25 ; r25 = new n1 + extru %r23,30,31,%r22 ;! r22 = d >> 1 + shd %r25,%r24,1,%r24 ;! r24 = new n0 + extru %r25,30,31,%r25 ;! r25 = new n1 sub %r0,%r22,%r21 ds %r0,%r21,%r0 addc %r24,%r24,%r24 @@ -185,14 +185,14 @@ L$largedivisor ds %r25,%r22,%r25 comclr,>= %r25,%r0,%r0 addl %r25,%r22,%r25 - sh1addl %r25,%r19,%r25 + sh1addl %r25,%r20,%r25 stws %r25,0(0,%r26) bv 0(%r2) addc %r24,%r24,%r28 -L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1) - shd %r25,%r24,1,%r24 ; r24 = new n0 - extru %r25,30,31,%r25 ; r25 = new n1 +L$odd: addib,sv,n 1,%r22,L$FF.. ;! r22 = (d / 2 + 1) + shd %r25,%r24,1,%r24 ;! r24 = new n0 + extru %r25,30,31,%r25 ;! r25 = new n1 sub %r0,%r22,%r21 ds %r0,%r21,%r0 addc %r24,%r24,%r24 @@ -262,8 +262,8 @@ L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1) addc %r24,%r24,%r28 comclr,>= %r25,%r0,%r0 addl %r25,%r22,%r25 - sh1addl %r25,%r19,%r25 -; We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25 + sh1addl %r25,%r20,%r25 +;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25 add,nuv %r28,%r25,%r25 addl %r25,%r1,%r25 addc %r0,%r28,%r28 @@ -273,9 +273,9 @@ L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1) bv 0(%r2) addc %r0,%r28,%r28 -; This is just a special case of the code above. -; We come here when d == 0xFFFFFFFF -L$FF.. add,uv %r25,%r24,%r24 +;! This is just a special case of the code above. +;! We come here when d == 0xFFFFFFFF +L$FF..: add,uv %r25,%r24,%r24 sub,<< %r24,%r23,%r0 ldo 1(%r24),%r24 stws %r24,0(0,%r26) diff --git a/sysdeps/ia64/fpu/printf_fphex.c b/sysdeps/ia64/fpu/printf_fphex.c index fca607c..3fa88a7 100644 --- a/sysdeps/ia64/fpu/printf_fphex.c +++ b/sysdeps/ia64/fpu/printf_fphex.c @@ -34,8 +34,9 @@ do { \ \ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16, \ info->spec == 'A'); \ - wnumstr = _itowa_word (num, wnumbuf + sizeof wnumbuf, 16, \ - info->spec == 'A'); \ + wnumstr = _itowa_word (num, \ + wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \ + 16, info->spec == 'A'); \ \ /* Fill with zeroes. */ \ while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \ @@ -50,7 +51,7 @@ do { \ /* We have 3 bits from the mantissa in the leading nibble. \ Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \ exponent = fpnum.ldbl.ieee.exponent; \ - \ + \ if (exponent == 0) \ { \ if (zero_mantissa) \ diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c index 5f20dba..5e328c7 100644 --- a/sysdeps/ieee754/ldbl-128/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -39,15 +39,17 @@ do { \ { \ numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16, \ info->spec == 'A'); \ - wnumstr = _itowa_word (num1, wnumbuf + sizeof wnumbuf, 16, \ - info->spec == 'A'); \ + wnumstr = _itowa_word (num1, + wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\ + 16, info->spec == 'A'); \ } \ else \ { \ numstr = _itoa (num1, numbuf + sizeof numbuf, 16, \ info->spec == 'A'); \ - wnumstr = _itowa (num1, wnumbuf + sizeof wnumbuf, 16, \ - info->spec == 'A'); \ + wnumstr = _itowa (num1, \ + wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \ + 16, info->spec == 'A'); \ } \ \ while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \ diff --git a/sysdeps/ieee754/ldbl-96/printf_fphex.c b/sysdeps/ieee754/ldbl-96/printf_fphex.c index 36d6014..9be0132 100644 --- a/sysdeps/ieee754/ldbl-96/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-96/printf_fphex.c @@ -38,14 +38,16 @@ do { \ { \ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16, \ info->spec == 'A'); \ - wnumstr = _itowa_word (num, wnumbuf + sizeof wnumbuf, 16, \ - info->spec == 'A'); \ + wnumstr = _itowa_word (num, \ + wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\ + 16, info->spec == 'A'); \ } \ else \ { \ numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');\ - wnumstr = _itowa (num, wnumbuf + sizeof wnumbuf, 16, \ - info->spec == 'A'); \ + wnumstr = _itowa (num, \ + wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \ + 16, info->spec == 'A'); \ } \ \ /* Fill with zeroes. */ \ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index d972f9c..08070ee 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -86,7 +86,7 @@ inhibit-siglist := yes endif ifeq ($(subdir),posix) -sysdep_headers += bits/pthreadtypes.h +sysdep_headers += bits/pthreadtypes.h bits/initspin.h endif ifeq ($(subdir),inet) diff --git a/sysdeps/unix/sysv/linux/bits/initspin.h b/sysdeps/unix/sysv/linux/bits/initspin.h new file mode 100644 index 0000000..936f178 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/initspin.h @@ -0,0 +1 @@ +/* No thread support. */ diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index c1d811d..e6d4a7d 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -61,6 +61,9 @@ case "$machine" in ia64*) arch_minimum_kernel=2.4.0 ;; + hppa*) + arch_minimum_kernel=2.3.99 + ;; *) arch_minimum_kernel=2.0.10 ;; @@ -82,10 +85,10 @@ fi if test -n "$minimum_kernel"; then echo $ac_n "checking for kernel header at least $minimum_kernel""... $ac_c" 1>&6 -echo "configure:86: checking for kernel header at least $minimum_kernel" >&5 +echo "configure:89: checking for kernel header at least $minimum_kernel" >&5 decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`; cat > conftest.$ac_ext <<EOF -#line 89 "configure" +#line 92 "configure" #include "confdefs.h" #include <linux/version.h> #if LINUX_VERSION_CODE < $decnum @@ -197,7 +200,7 @@ if test $host = $build; then ac_prefix=$ac_default_prefix fi echo $ac_n "checking for symlinks in ${ac_prefix}/include""... $ac_c" 1>&6 -echo "configure:201: checking for symlinks in ${ac_prefix}/include" >&5 +echo "configure:204: checking for symlinks in ${ac_prefix}/include" >&5 ac_message= if test -L ${ac_prefix}/include/net; then ac_message="$ac_message diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in index 05b58e9..7d538e8 100644 --- a/sysdeps/unix/sysv/linux/configure.in +++ b/sysdeps/unix/sysv/linux/configure.in @@ -48,6 +48,9 @@ case "$machine" in ia64*) arch_minimum_kernel=2.4.0 ;; + hppa*) + arch_minimum_kernel=2.3.99 + ;; *) arch_minimum_kernel=2.0.10 ;; diff --git a/sysdeps/unix/sysv/linux/errlist.c b/sysdeps/unix/sysv/linux/errlist.c index d985f49..eee2b4c 100644 --- a/sysdeps/unix/sysv/linux/errlist.c +++ b/sysdeps/unix/sysv/linux/errlist.c @@ -24,13 +24,13 @@ #define SYS_NERR __new_sys_nerr #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -asm (".data; .globl __old_sys_errlist; __old_sys_errlist:"); +asm (".data\n\t.globl __old_sys_errlist\n__old_sys_errlist:"); #endif #include <sysdeps/gnu/errlist.c> #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -asm (".type __old_sys_errlist,@object;.size __old_sys_errlist," +asm (".type __old_sys_errlist,@object\n\t.size __old_sys_errlist," OLD_ERRLIST_SIZE_STR "*" PTR_SIZE_STR); extern const char *const *__old_sys_errlist; diff --git a/sysdeps/unix/sysv/linux/hppa/Makefile b/sysdeps/unix/sysv/linux/hppa/Makefile new file mode 100644 index 0000000..1c93ec5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/Makefile @@ -0,0 +1,2 @@ +# linux/hppa does not use -lmilli anymore +gnulib := -lgcc diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions new file mode 100644 index 0000000..475fbe1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/Versions @@ -0,0 +1,6 @@ +libc { + GLIBC_2.2 { + # New rlimit interface + getrlimit; setrlimit; getrlimit64; setrlimit64; + } +}
\ No newline at end of file diff --git a/sysdeps/unix/sysv/linux/hppa/bits/errno.h b/sysdeps/unix/sysv/linux/hppa/bits/errno.h new file mode 100644 index 0000000..db4eaf6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/errno.h @@ -0,0 +1,57 @@ +/* Error constants. Linux/HPPA specific version. + Copyright (C) 1996, 1997, 1998, 1999, 2000 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. */ + +#ifdef _ERRNO_H + +# undef EDOM +# undef EILSEQ +# undef ERANGE +# include <linux/errno.h> + +/* Linux also has no ECANCELED error code. Since it is not used here + we define it to an invalid value. */ +# define ECANCELED 125 + +# ifndef __ASSEMBLER__ +/* We now need a declaration of the `errno' variable. */ +extern int errno; + +/* Function to get address of global `errno' variable. */ +extern int *__errno_location (void) __THROW __attribute__ ((__const__)); + +# if defined _LIBC +/* We wouldn't need a special macro anymore but it is history. */ +# define __set_errno(val) (*__errno_location ()) = (val) +# endif /* _LIBC */ + +# if !defined _LIBC || defined _LIBC_REENTRANT +/* When using threads, errno is a per-thread value. */ +# define errno (*__errno_location ()) +# endif +# endif /* !__ASSEMBLER__ */ +#endif /* _ERRNO_H */ + +#if !defined _ERRNO_H && defined __need_Emath +/* This is ugly but the kernel header is not clean enough. We must + define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is + defined. */ +# define EDOM 33 /* Math argument out of domain of function. */ +# define EILSEQ 84 /* Illegal byte sequence. */ +# define ERANGE 34 /* Math result not representable. */ +#endif /* !_ERRNO_H && __need_Emath */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h new file mode 100644 index 0000000..687ffc8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h @@ -0,0 +1,148 @@ +/* O_*, F_*, FD_* bit values for Linux/HPPA. + Copyright (C) 1995-1999, 2000 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 _FCNTL_H +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + +#include <sys/types.h> + + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#define O_ACCMODE 00000003 +#define O_APPEND 00000010 +#define O_BLKSEEK 00000100 /* HPUX only */ +#define O_CREAT 00000400 /* not fcntl */ +#define O_TRUNC 00001000 /* not fcntl */ +#define O_EXCL 00002000 /* not fcntl */ +#define O_ASYNC 00020000 +#define O_SYNC 00100000 +#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ +#define O_NDELAY O_NONBLOCK +#define O_NOCTTY 00400000 /* not fcntl */ + + +#ifdef __USE_GNU +# define O_DIRECT 00040000 /* direct disk access hint - currently ignored */ +# define O_DIRECTORY 00010000 /* must be a directory */ +# define O_NOFOLLOW 00000200 /* don't follow links */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 00004000 +#endif + +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC 01000000 /* HPUX only */ +# define O_RSYNC 02000000 /* HPUX only */ +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#define F_GETLK 5 /* Get record locking info. */ +#define F_SETLK 6 /* Set record locking info (non-blocking). */ +#define F_SETLKW 7 /* Set record locking info (blocking). */ + +#define F_GETLK64 8 /* Get record locking info. */ +#define F_SETLK64 9 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 10 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */ +# define F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 13 /* Set number of signal to be sent. */ +# define F_GETSIG 14 /* Get number of signal to be sent. */ +#endif + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 3 /* Remove lock. */ + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* operations for bsd flock(), also used by the kernel implementation */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif diff --git a/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h b/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h new file mode 100644 index 0000000..bad78b6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1996, 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 _SYS_IOCTL_H +# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." +#endif + +/* Use the definitions from the kernel header files. */ +#include <asm/ioctls.h> + +/* Oh well, this is necessary since the kernel data structure is + different from the user-level version. */ +#undef TCGETS +#undef TCSETS +#undef TCSETSW +#undef TCSETSF +#define TCGETS _IOR ('T', 16, char[36]) +#define TCSETS _IOW ('T', 17, char[36]) +#define TCSETSW _IOW ('T', 18, char[36]) +#define TCSETSF _IOW ('T', 19, char[36]) + +#include <linux/sockios.h> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h new file mode 100644 index 0000000..78c0171 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/mman.h @@ -0,0 +1,61 @@ +/* Definitions for POSIX memory map interface. Insert rest of disclaimer here */ + +#ifndef _SYS_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* these are basically taken from the kernel definitions */ + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_NONE 0x0 /* page can not be accessed */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x03 /* Mask for type of mapping */ +#define MAP_FIXED 0x04 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x10 /* don't use a file */ + +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_GROWSDOWN 0x8000 /* stack-like segment */ + +#define MS_SYNC 1 /* synchronous memory sync */ +#define MS_ASYNC 2 /* sync memory asynchronously */ +#define MS_INVALIDATE 4 /* invalidate the caches */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#define MADV_NORMAL 0 /* no further special treatment */ +#define MADV_RANDOM 1 /* expect random page references */ +#define MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define MADV_WILLNEED 3 /* will need these pages */ +#define MADV_DONTNEED 4 /* dont need these pages */ +#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ +#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ +#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ + +/* The range 12-64 is reserved for page size specification. */ +#define MADV_4K_PAGES 12 /* Use 4K pages */ +#define MADV_16K_PAGES 14 /* Use 16K pages */ +#define MADV_64K_PAGES 16 /* Use 64K pages */ +#define MADV_256K_PAGES 18 /* Use 256K pages */ +#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */ +#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */ +#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ +#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ + +/* compatibility flags */ +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FILE 0 +#define MAP_VARIABLE 0 + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +#endif + diff --git a/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h b/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h new file mode 100644 index 0000000..cec71b2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h @@ -0,0 +1,75 @@ +/* Definitions for Linux/hppa sigaction. + Copyright (C) 1996, 1997, 2000 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 _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ +#ifdef __USE_POSIX199309 + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + + /* Special flags. */ + unsigned long int sa_flags; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + }; + +/* Bits in `sa_flags'. */ + +#define SA_NOCLDSTOP 0x00000008 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x00000080 /* Don't create zombie on child death. */ +#define SA_SIGINFO 0x00000010 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_UNIX98 || defined __USE_MISC +# define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. */ +# define SA_RESETHAND 0x00000004 /* Reset to SIG_DFL on entry to handler. */ +# define SA_NODEFER 0x00000020 /* Don't automatically block the signal + when its handler is being executed. */ +# define SA_RESTART 0x00000040 /* Restart syscall on signal return. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historic no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h new file mode 100644 index 0000000..45ed06a --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/signum.h @@ -0,0 +1,82 @@ +/* Signal number definitions. Linux version. + Copyright (C) 1995, 1996, 1997, 1998, 1999 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. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGABRT 6 /* Abort (ANSI). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGEMT 7 +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* BUS error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad system call. */ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGVTALRM 20 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 21 /* Profiling alarm clock (4.2 BSD). */ +#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ +#define SIGIO 22 /* I/O now possible (4.2 BSD). */ +#define SIGWINCH 23 /* Window size change (4.3 BSD, Sun). */ +#define SIGSTOP 24 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 25 /* Keyboard stop (POSIX). */ +#define SIGCONT 26 /* Continue (POSIX). */ +#define SIGTTIN 27 /* Background read from tty (POSIX). */ +#define SIGTTOU 28 /* Background write to tty (POSIX). */ +#define SIGURG 29 /* Urgent condition on socket (4.2 BSD). */ +#define SIGLOST 30 /* Operating System Has Lost (HP/UX). */ +#define SIGUNUSED 31 +#define SIGXCPU 33 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 34 /* File size limit exceeded (4.2 BSD). */ +#define SIGSTKFLT 36 /* Stack fault. */ + +#define _NSIG 64 /* Biggest signal number + 1 + (including real-time signals). */ + +#define SIGRTMIN (__libc_current_sigrtmin ()) +#define SIGRTMAX (__libc_current_sigrtmax ()) + +/* These are the hard limits of the kernel. These values should not be + used directly at user level. */ +#define __SIGRTMIN 37 +#define __SIGRTMAX (_NSIG - 1) + +#endif /* <signal.h> included. */ diff --git a/sysdeps/unix/sysv/linux/hppa/brk.c b/sysdeps/unix/sysv/linux/hppa/brk.c new file mode 100644 index 0000000..9ed6c4f --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/brk.c @@ -0,0 +1,47 @@ +/* brk system call for Linux/i386. + Copyright (C) 1995, 1996 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 <errno.h> +#include <unistd.h> +#include <sysdep.h> + +/* This must be initialized data because commons can't have aliases. */ +void *__curbrk = 0; + +/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt + to work around different old braindamage in the old Linux ELF dynamic + linker. */ +weak_alias (__curbrk, ___brk_addr) + +int +__brk (void *addr) +{ + void *newbrk, *scratch; + + __curbrk = newbrk = INLINE_SYSCALL(brk, 1, addr); + + if (newbrk < addr) + { + __set_errno (ENOMEM); + return -1; + } + + return 0; +} +weak_alias (__brk, brk) diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S new file mode 100644 index 0000000..510e0ff --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/clone.S @@ -0,0 +1,82 @@ +/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org>, 2000. + Based on the Alpha version by Richard Henderson <rth@tamu.edu>, 1996. + + 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. */ + +/* clone() is even more special than fork() as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include <asm/unistd.h> +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> + +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ + + .text +ENTRY(__clone) + /* FIXME: I have no idea how profiling works on hppa. */ + + /* Sanity check arguments. */ + comib,<> 0,%arg0,.Lerror /* no NULL function pointers */ + ldi EINVAL,%ret0 + comib,<> 0,%arg1,.Lerror /* no NULL stack pointers */ + nop + + /* Save the fn ptr and arg on the new stack. */ + stwm %arg3,64(%arg1) + stw %arg3,-60(%arg1) + + /* Do the system call */ + copy %arg2,%arg0 + ble 0x100(%sr7,%r0) + ldi __NR_clone,%r20 + + ldi -4096,%r1 + comclr,>>= %r1,%ret0,%r0 /* Note: unsigned compare. */ + b,n .Lerror + + comib,=,n 0,%ret0,thread_start + + /* Successful return from the parent */ + bv %r0(%rp) + nop + + /* Something bad happened -- no child created */ +.Lerror: + b __syscall_error + nop + +thread_start: + /* Load up the arguments. */ + ldw -60(%sp),%arg0 + ldwm -64(%sp),%r22 + + /* Call the user's function */ + bl $$dyncall,%r31 + copy %r31,%rp + + bl _exit,%rp + copy %ret0,%arg0 + + /* Die horribly. */ + iitlbp %r0,(%r0) + +PSEUDO_END(__clone) + +weak_alias(__clone, clone) diff --git a/sysdeps/unix/sysv/linux/hppa/getrlimit.c b/sysdeps/unix/sysv/linux/hppa/getrlimit.c new file mode 100644 index 0000000..fc06dbd --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/getrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getrlimit.c> diff --git a/sysdeps/unix/sysv/linux/hppa/getrlimit64.c b/sysdeps/unix/sysv/linux/hppa/getrlimit64.c new file mode 100644 index 0000000..fef018f --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/getrlimit64.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c> diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h b/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h new file mode 100644 index 0000000..af048cb --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h @@ -0,0 +1,18 @@ +/* We have a separate header file here because we do not support + SA_RESTORER on hppa. */ + +/* This is the sigaction struction from the Linux 2.1.20 kernel. */ +/* Blah. This is bogus. We don't ever use it. */ +struct old_kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned long sa_mask; + unsigned long sa_flags; +}; + +/* This is the sigaction structure from the Linux 2.1.68 kernel. */ + +struct kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned long sa_flags; + sigset_t sa_mask; +}; diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h new file mode 100644 index 0000000..a1fa377 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h @@ -0,0 +1,32 @@ +/* definition of "struct stat" from the kernel */ +struct kernel_stat { + unsigned long st_dev; /* dev_t is 32 bits on parisc */ + unsigned long st_ino; /* 32 bits */ + unsigned short st_mode; /* 16 bits */ + unsigned short st_nlink; /* 16 bits */ + unsigned short st_reserved1; /* old st_uid */ + unsigned short st_reserved2; /* old st_gid */ + unsigned long st_rdev; + unsigned long st_size; + unsigned long st_atime; + unsigned long st_spare1; + unsigned long st_mtime; + unsigned long st_spare2; + unsigned long st_ctime; + unsigned long st_spare3; + long st_blksize; + long st_blocks; + unsigned long __unused1; /* ACL stuff */ + unsigned long __unused2; /* network */ + unsigned long __unused3; /* network */ + unsigned long __unused4; /* cnodes */ + unsigned short __unused5; /* netsite */ + short st_fstype; + unsigned long st_realdev; + unsigned short st_basemode; + unsigned short st_spareshort; + unsigned long st_uid; + unsigned long st_gid; + unsigned long st_spare4[3]; +}; + diff --git a/sysdeps/unix/sysv/linux/hppa/mmap.c b/sysdeps/unix/sysv/linux/hppa/mmap.c new file mode 100644 index 0000000..333d848 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/mmap.c @@ -0,0 +1,50 @@ +/* Copyright (C) 1994, 1995, 1996, 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 <sys/types.h> +#include <sys/mman.h> +#include <errno.h> + +/* Map addresses starting near ADDR and extending for LEN bytes. From + OFFSET into the file FD describes according to PROT and FLAGS. If ADDR + is nonzero, it is the desired mapping address. If the MAP_FIXED bit is + set in FLAGS, the mapping will be at ADDR exactly (which must be + page-aligned); otherwise the system chooses a convenient nearby address. + The return value is the actual mapping address chosen or MAP_FAILED + for errors (in which case `errno' is set). A successful `mmap' call + deallocates any previous mapping for the affected region. */ + +#include <sysdep.h> + +__ptr_t +__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + + __ptr_t ret; + + ret = INLINE_SYSCALL(mmap, 6, addr, len, prot, flags, fd, offset); + + /* check if it's really a negative number */ + if(((unsigned long)ret & 0xfffff000) == 0xfffff000) + return MAP_FAILED; + + return ret; + +} + +strong_alias (__mmap, mmap) diff --git a/sysdeps/unix/sysv/linux/hppa/profil-counter.h b/sysdeps/unix/sysv/linux/hppa/profil-counter.h new file mode 100644 index 0000000..8a6a0bc --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/profil-counter.h @@ -0,0 +1,2 @@ +/* We can use the ix86 version. */ +#include <sysdeps/unix/sysv/linux/i386/profil-counter.h> diff --git a/sysdeps/unix/sysv/linux/hppa/setrlimit.c b/sysdeps/unix/sysv/linux/hppa/setrlimit.c new file mode 100644 index 0000000..bfaef74 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/setrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setrlimit.c> diff --git a/sysdeps/unix/sysv/linux/hppa/socket.S b/sysdeps/unix/sysv/linux/hppa/socket.S new file mode 100644 index 0000000..dfbb721 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/socket.S @@ -0,0 +1,10 @@ +#include <sysdep.h> + + .globl __socket +PSEUDO(__socket, socket, 3) + +PSEUDO_END(__socket) + +#ifndef NO_WEAK_ALIAS +weak_alias (__socket, socket) +#endif diff --git a/sysdeps/unix/sysv/linux/hppa/sys/procfs.h b/sysdeps/unix/sysv/linux/hppa/sys/procfs.h new file mode 100644 index 0000000..b6c756f --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/sys/procfs.h @@ -0,0 +1,113 @@ +/* Copyright (C) 1996, 1997, 1999, 2000 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 _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include <features.h> +#include <signal.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/ucontext.h> +#include <sys/user.h> +#include <asm/elf.h> + +__BEGIN_DECLS + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned int pr_uid; + unsigned int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* The rest of this file provides the types for emulation of the + Solaris <proc_service.h> interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h new file mode 100644 index 0000000..60022f9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h @@ -0,0 +1,68 @@ +/* Copyright (C) 1997, 1998, 2000 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. */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <signal.h> + +/* We need the signal context definitions even if they are not used + included in <signal.h>. */ +#include <bits/sigcontext.h> + + +/* Type for general register. */ +typedef unsigned long int greg_t; + +/* Number of general registers. */ +#define NGREG 42 +#define NFPREG 33 + +/* Container for all general registers. */ +typedef struct gregset { + greg_t g_regs[32]; + greg_t sr_regs[5]; + greg_t g_pad[5]; +} gregset_t; + +/* Container for all FPU registers. */ +typedef struct fpregset { + double fp_dregs[32]; +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t gregs; + fpregset_t fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.S b/sysdeps/unix/sysv/linux/hppa/syscall.S new file mode 100644 index 0000000..413c572 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/syscall.S @@ -0,0 +1,28 @@ +/* Copyright (C) 1995, 1996, 1998 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> + +/* Please consult the file sysdeps/unix/sysv/linux/i386/sysdep.h for + more information about the value -4095 used below.*/ + + .text +ENTRY (syscall) + b . + nop + diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list new file mode 100644 index 0000000..f0d6431 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -0,0 +1,39 @@ +# File name Caller Syscall name # args Strong name Weak names + +# semaphore and shm system calls +msgctl - msgctl i:iip __msgctl msgctl +msgget - msgget i:ii __msgget msgget +msgrcv - msgrcv i:ibnii __msgrcv msgrcv +msgsnd - msgsnd i:ibni __msgsnd msgsnd +shmat - shmat i:ipi __shmat shmat +shmctl - shmctl i:iip __shmctl shmctl +shmdt - shmdt i:s __shmdt shmdt +shmget - shmget i:iii __shmget shmget +semop - semop i:ipi __semop semop +semget - semget i:iii __semget semget +semctl - semctl i:iiii __semctl semctl + +# proper socket implementations: +accept - accept i:iBN __libc_accept __accept accept +bind - bind i:ipi __bind bind +connect - connect i:ipi __libc_connect __connect connect +getpeername - getpeername i:ipp __getpeername getpeername +getsockname - getsockname i:ipp __getsockname getsockname +getsockopt - getsockopt i:iiiBN __getsockopt getsockopt +listen - listen i:ii __listen listen +recv - recv i:ibni __libc_recv __recv recv +recvfrom - recvfrom i:ibniBN __libc_recvfrom __recvfrom recvfrom +recvmsg - recvmsg i:ipi __libc_recvmsg recvmsg +send - send i:ibni __libc_send __send send +sendmsg - sendmsg i:ipi __libc_sendmsg sendmsg +sendto - sendto i:ibnibn __libc_sendto __sendto sendto +setsockopt - setsockopt i:iiibn __setsockopt setsockopt +shutdown - shutdown i:ii __shutdown shutdown +socket - socket i:iii __socket socket +socketpair - socketpair i:iiif __socketpair socketpair + +ptrace - ptrace 4 __ptrace ptrace + +getresuid - getresuid i:ppp getresuid +getresgid - getresgid i:ppp getresgid + diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.c b/sysdeps/unix/sysv/linux/hppa/sysdep.c new file mode 100644 index 0000000..0559cc7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1997, 1998 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 <errno.h> + +/* This routine is jumped to by all the syscall handlers, to stash + an error number into errno. */ +int +__syscall_error (int err_no) +{ + __set_errno (err_no); + return -1; +} + +/* We also have to have a 'real' definition of errno. */ +#undef errno +int errno = 0; +weak_alias (errno, _errno) diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h new file mode 100644 index 0000000..73d9a38 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -0,0 +1,242 @@ +/* Assembler macros for PA-RISC. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. + Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000. + + 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 <asm/unistd.h> +#include <sysdeps/generic/sysdep.h> +#include <sys/syscall.h> +#include "config.h" + +#ifndef ASM_LINE_SEP +#define ASM_LINE_SEP ; +#endif + +#undef SYS_ify +#define SYS_ify(syscall_name) (__NR_##syscall_name) + + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. */ + +#define ALIGNARG(log2) log2 + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in %eax + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can safely + test with -4095. */ + +/* We don't want the label for the error handle to be global when we define + it here. */ +#ifdef PIC +# define SYSCALL_ERROR_LABEL 0f +#else +# define SYSCALL_ERROR_LABEL syscall_error +#endif + +/* Define an entry point visible from C. + + There is currently a bug in gdb which prevents us from specifying + incomplete stabs information. Fake some entries here which specify + the current source file. */ +#define ENTRY(name) \ + .text ASM_LINE_SEP \ + .export C_SYMBOL_NAME(name) ASM_LINE_SEP \ + .type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \ + C_LABEL(name) \ + CALL_MCOUNT + +#define ret \ + bv 0(2) ASM_LINE_SEP \ + nop + +#undef END +#define END(name) \ +1: .size C_SYMBOL_NAME(name),1b-C_SYMBOL_NAME(name) + +/* If compiled for profiling, call `mcount' at the start of each function. */ +#ifdef PROF +/* The mcount code relies on a normal frame pointer being on the stack + to locate our caller, so push one just for its benefit. */ +#define CALL_MCOUNT /* XXX */ +#else +#define CALL_MCOUNT /* Do nothing. */ +#endif + +/* syscall wrappers consist of + #include <sysdep.h> + PSEUDO(...) + ret + PSEUDO_END(...) + + which means + ENTRY(name) + DO_CALL(...) + nop + bv 0(2) + nop +*/ + +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name) \ + DO_CALL(args, syscall_name) ASM_LINE_SEP \ + nop + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + END (name) + +#define JUMPTARGET(name) name +#define SYSCALL_PIC_SETUP /* Nothing. */ + +/* Linux takes system call arguments in registers: + syscall number gr20 + arg 1 gr26 + arg 2 gr25 + arg 3 gr24 + arg 4 gr23 + arg 5 gr22 + arg 6 gr21 + + The compiler calls us by the C convention: + syscall number in the DO_CALL macro + arg 1 gr26 + arg 2 gr25 + arg 3 gr24 + arg 4 gr23 + arg 5 -52(gr30) + arg 6 -56(gr30) + + gr22 and gr21 are caller-saves, so we can just load the arguments + there and generally be happy. */ + +/* the cmpb...no_error code below inside DO_CALL + * is intended to mimic the if (__sys_res...) + * code inside INLINE_SYSCALL + */ + +#undef DO_CALL +#define DO_CALL(args, syscall_name) \ + DOARGS_##args \ + ble 0x100(%sr2,%r0) ASM_LINE_SEP \ + ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \ + ldi -0x1000,%r1 ASM_LINE_SEP \ + cmpb,>>=,n %r1,%ret0,0f ASM_LINE_SEP \ + stw %rp, -20(%sr0,%r30) ASM_LINE_SEP \ + stw %ret0, -24(%sr0,%r30) ASM_LINE_SEP \ + .import __errno_location,code ASM_LINE_SEP \ + bl __errno_location,%rp ASM_LINE_SEP \ + ldo 64(%r30), %r30 ASM_LINE_SEP \ + ldo -64(%r30), %r30 ASM_LINE_SEP \ + ldw -24(%r30), %r26 ASM_LINE_SEP \ + sub %r0, %r26, %r26 ASM_LINE_SEP \ + stw %r26, 0(%sr0,%ret0) ASM_LINE_SEP \ + ldo -1(%r0), %ret0 ASM_LINE_SEP \ + ldw -20(%r30), %rp ASM_LINE_SEP \ +0: ASM_LINE_SEP \ + UNDOARGS_##args + +#define DOARGS_0 /* nothing */ +#define DOARGS_1 /* nothing */ +#define DOARGS_2 /* nothing */ +#define DOARGS_3 /* nothing */ +#define DOARGS_4 /* nothing */ +#define DOARGS_5 ldw -52(%r30), %r22 ASM_LINE_SEP +#define DOARGS_6 ldw -52(%r30), %r22 ASM_LINE_SEP \ + ldw -56(%r30), %r21 ASM_LINE_SEP + + +#define UNDOARGS_0 /* nothing */ +#define UNDOARGS_1 /* nothing */ +#define UNDOARGS_2 /* nothing */ +#define UNDOARGS_3 /* nothing */ +#define UNDOARGS_4 /* nothing */ +#define UNDOARGS_5 /* nothing */ +#define UNDOARGS_6 /* nothing */ + +#else + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) ({ \ + unsigned long __sys_res; \ + { \ + register unsigned long __res asm("r28"); \ + LOAD_ARGS_##nr(args) \ + asm volatile( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + " ldi %1, %%r20" \ + : "=r" (__res) \ + : "i" (SYS_ify(name)) ASM_ARGS_##nr \ + ); \ + __sys_res = __res; \ + } \ + if (__sys_res >= (unsigned long)-4095) { \ + __set_errno(-__sys_res); \ + __sys_res == (unsigned long)-1; \ + } \ + __sys_res; \ +}) + +#define LOAD_ARGS_0() +#define LOAD_ARGS_1(r26) \ + register unsigned long __r26 __asm__("r26") = (unsigned long)r26; \ + LOAD_ARGS_0() +#define LOAD_ARGS_2(r26,r25) \ + register unsigned long __r25 __asm__("r25") = (unsigned long)r25; \ + LOAD_ARGS_1(r26) +#define LOAD_ARGS_3(r26,r25,r24) \ + register unsigned long __r24 __asm__("r24") = (unsigned long)r24; \ + LOAD_ARGS_2(r26,r25) +#define LOAD_ARGS_4(r26,r25,r24,r23) \ + register unsigned long __r23 __asm__("r23") = (unsigned long)r23; \ + LOAD_ARGS_3(r26,r25,r24) +#define LOAD_ARGS_5(r26,r25,r24,r23,r22) \ + register unsigned long __r22 __asm__("r22") = (unsigned long)r22; \ + LOAD_ARGS_4(r26,r25,r24,r23) +#define LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \ + register unsigned long __r21 __asm__("r21") = (unsigned long)r21; \ + LOAD_ARGS_5(r26,r25,r24,r23,r22) + +#define ASM_ARGS_0 +#define ASM_ARGS_1 , "r" (__r26) +#define ASM_ARGS_2 , "r" (__r26), "r" (__r25) +#define ASM_ARGS_3 , "r" (__r26), "r" (__r25), "r" (__r24) +#define ASM_ARGS_4 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23) +#define ASM_ARGS_5 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22) +#define ASM_ARGS_6 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22), "r" (__r21) + +#endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/hppa/umount.c b/sysdeps/unix/sysv/linux/hppa/umount.c new file mode 100644 index 0000000..39cb251 --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/umount.c @@ -0,0 +1,9 @@ +/* since we don't have an oldumount system call, do what the kernel + does down here */ + +long __umount(char *name) +{ + return __umount2(name, 0); +} + +weak_alias(__umount, umount); |