From f752bfe37962db44ac8db553d840f8215966911e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Mar 1997 05:17:15 +0000 Subject: Update. 1997-03-20 06:07 Ulrich Drepper * sysdeps/powerpc/dl-machine.h: Fix typo in last change. * sysdeps/unix/sparc/sysdep.h: Update copyright. 1997-03-19 15:13 Miguel de Icaza * linuxthreads/sysdeps/sparc/pt-machine (RELEASE): Fix. * stdlib/tst-strtol.c: Save the value of errno, printf may modify it. * sysdeps/sparc/DEFS.h [HAVE_ELF]: Use type @function in the FUNC macro on ELF systems. * sysdeps/sparc/configure.in: Fix. * sysdeps/sparc/dl-machine.h: Fix OPCODE_CALL. * sysdeps/sparc/setjmp.S: Fix my bugs. * sysdeps/unix/sysv/linux/sparc/Dist: Add start.c, fork.S, and pipe.S. * sysdeps/unix/sysv/linux/sparc/Makefile: Define asm-CPPFLAGS and as-FLAGS-.so. * sysdeps/unix/sysv/linux/sparc/syscalls.list: Add fork, pipe, and syscall. * sysdeps/unix/sysv/linux/sparc/fork.S: New file. * sysdeps/unix/sysv/linux/sparc/pipe.S: New file. * sysdeps/unix/sysv/linux/sparc/socket.S: Fix. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Fix. * elf/dl-lookup.c (do_lookup): Return true if we found a weak symbol. (_dl_lookup_symbol): Test against the symbol being global not against the symbol being not weak (fixes important problem with the SPARC linker) * sysdeps/unix/sysv/linux/sparc/brk.c: Fix. * sysdeps/unix/sysv/linux/sparc/start.c: Startup code for Linux/SPARC (while I get my asmCPPFLAGS-so variable). 1997-03-20 01:49 Ulrich Drepper * sysdeps/libm-ieee754/s_tanhl.c (__tanhl): Correct handling of -inf. * elf/dl-reloc.c (RESOLVE): Don't try to resolve local symbols. --- ChangeLog | 49 ++++++++++++++++++++++++++--- stdlib/tst-strtol.c | 49 +++++++++++++++-------------- sysdeps/libm-ieee754/s_modf.c | 5 +-- sysdeps/libm-ieee754/s_modff.c | 1 - sysdeps/powerpc/dl-machine.h | 6 ++-- sysdeps/sparc/DEFS.h | 10 +++++- sysdeps/sparc/configure | 2 +- sysdeps/sparc/configure.in | 2 +- sysdeps/sparc/dl-machine.h | 3 +- sysdeps/sparc/setjmp.S | 9 ++++-- sysdeps/unix/sparc/sysdep.h | 34 ++++++++++---------- sysdeps/unix/sysv/linux/sparc/Dist | 3 ++ sysdeps/unix/sysv/linux/sparc/Makefile | 5 +-- sysdeps/unix/sysv/linux/sparc/fork.S | 33 +++++++++++++++++++ sysdeps/unix/sysv/linux/sparc/pipe.S | 37 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/sparc/syscalls.list | 3 ++ sysdeps/unix/sysv/linux/sparc/sysdep.h | 12 ++++--- 17 files changed, 197 insertions(+), 66 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/sparc/fork.S create mode 100644 sysdeps/unix/sysv/linux/sparc/pipe.S diff --git a/ChangeLog b/ChangeLog index 87de29f..df79015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,47 @@ -1997-03-20 01:49 Ulrich Drepper +1997-03-20 06:07 Ulrich Drepper + + * sysdeps/powerpc/dl-machine.h: Fix typo in last change. + + * sysdeps/unix/sparc/sysdep.h: Update copyright. + +1997-03-19 15:13 Miguel de Icaza + + * linuxthreads/sysdeps/sparc/pt-machine (RELEASE): Fix. + + * stdlib/tst-strtol.c: Save the value of errno, printf may modify + it. + + * sysdeps/sparc/DEFS.h [HAVE_ELF]: Use type @function in the FUNC + macro on ELF systems. + + * sysdeps/sparc/configure.in: Fix. + + * sysdeps/sparc/dl-machine.h: Fix OPCODE_CALL. - * sysdeps/libm-ieee754/s_tanhl.c (__tanhl): Correct handling of - -inf. + * sysdeps/sparc/setjmp.S: Fix my bugs. + + * sysdeps/unix/sysv/linux/sparc/Dist: Add start.c, fork.S, and pipe.S. + * sysdeps/unix/sysv/linux/sparc/Makefile: Define asm-CPPFLAGS and + as-FLAGS-.so. + * sysdeps/unix/sysv/linux/sparc/syscalls.list: Add fork, pipe, and + syscall. + * sysdeps/unix/sysv/linux/sparc/fork.S: New file. + * sysdeps/unix/sysv/linux/sparc/pipe.S: New file. + * sysdeps/unix/sysv/linux/sparc/socket.S: Fix. + * sysdeps/unix/sysv/linux/sparc/sysdep.h: Fix. + + * elf/dl-lookup.c (do_lookup): Return true if we found a weak + symbol. + (_dl_lookup_symbol): Test against the symbol being global not + against the symbol being not weak (fixes important problem with + the SPARC linker) + + * sysdeps/unix/sysv/linux/sparc/brk.c: Fix. + + * sysdeps/unix/sysv/linux/sparc/start.c: Startup code for + Linux/SPARC (while I get my asmCPPFLAGS-so variable). + +1997-03-20 01:49 Ulrich Drepper * Makeconfig: (rpath-link): Add math/ directory. (math-objdir): New variable. @@ -47,6 +87,7 @@ * sysdeps/libm-ieee754/s_tanh.c: Handle x == +-0 as a special case since tanh(-0) == -0. * sysdeps/libm-ieee754/s_tanhf.c: Likewise. + * sysdeps/libm-ieee754/s_tanhl.c (__tanhl): Correct handling of -inf. 1997-03-19 21:13 Ulrich Drepper @@ -179,7 +220,7 @@ 1997-03-18 05:28 Roland McGrath - * elf/dl-reloc.c (RESOLVE): Don't try to resolve ocal symbols. + * elf/dl-reloc.c (RESOLVE): Don't try to resolve local symbols. 1997-03-17 21:39 Philip Blundell diff --git a/stdlib/tst-strtol.c b/stdlib/tst-strtol.c index e351e97..0857871 100644 --- a/stdlib/tst-strtol.c +++ b/stdlib/tst-strtol.c @@ -79,16 +79,19 @@ main (int argc, char ** argv) register const struct ltest *lt; char *ep; int status = 0; + int save_errno; for (lt = tests; lt->str != NULL; ++lt) { register long int l; errno = 0; - l = strtol(lt->str, &ep, lt->base); - printf("strtol(\"%s\", , %d) test %u", - lt->str, lt->base, (unsigned int) (lt - tests)); - if (l == (long int) lt->expect && *ep == lt->left && errno == lt->err) + l = strtol (lt->str, &ep, lt->base); + save_errno = errno; + printf ("strtol(\"%s\", , %d) test %u", + lt->str, lt->base, (unsigned int) (lt - tests)); + if (l == (long int) lt->expect && *ep == lt->left + && save_errno == lt->err) puts("\tOK"); else { @@ -99,13 +102,13 @@ main (int argc, char ** argv) if (lt->left != *ep) { char exp1[5], exp2[5]; - expand(exp1, *ep); - expand(exp2, lt->left); - printf(" leaves '%s', expected '%s'\n", exp1, exp2); + expand (exp1, *ep); + expand (exp2, lt->left); + printf (" leaves '%s', expected '%s'\n", exp1, exp2); } if (errno != lt->err) - printf(" errno %d (%s) instead of %d (%s)\n", - errno, strerror(errno), lt->err, strerror(lt->err)); + printf (" errno %d (%s) instead of %d (%s)\n", + errno, strerror (errno), lt->err, strerror (lt->err)); status = 1; } } @@ -115,32 +118,32 @@ main (int argc, char ** argv) register unsigned long int ul; errno = 0; - ul = strtoul(lt->str, &ep, lt->base); - printf("strtoul(\"%s\", , %d) test %u", - lt->str, lt->base, (unsigned int) (lt - tests)); + ul = strtoul (lt->str, &ep, lt->base); + printf ("strtoul(\"%s\", , %d) test %u", + lt->str, lt->base, (unsigned int) (lt - tests)); if (ul == lt->expect && *ep == lt->left && errno == lt->err) puts("\tOK"); else { - puts("\tBAD"); + puts ("\tBAD"); if (ul != lt->expect) - printf(" returns %lu, expected %lu\n", - ul, lt->expect); + printf (" returns %lu, expected %lu\n", + ul, lt->expect); if (lt->left != *ep) { char exp1[5], exp2[5]; - expand(exp1, *ep); - expand(exp2, lt->left); - printf(" leaves '%s', expected '%s'\n", exp1, exp2); + expand (exp1, *ep); + expand (exp2, lt->left); + printf (" leaves '%s', expected '%s'\n", exp1, exp2); } if (errno != lt->err) - printf(" errno %d (%s) instead of %d (%s)\n", - errno, strerror(errno), lt->err, strerror(lt->err)); + printf (" errno %d (%s) instead of %d (%s)\n", + errno, strerror (errno), lt->err, strerror (lt->err)); status = 1; } } - exit(status ? EXIT_FAILURE : EXIT_SUCCESS); + exit (status ? EXIT_FAILURE : EXIT_SUCCESS); } static void @@ -148,11 +151,11 @@ expand (dst, c) char *dst; int c; { - if (isprint(c)) + if (isprint (c)) { dst[0] = c; dst[1] = '\0'; } else - (void) sprintf(dst, "%#.3o", (unsigned int) c); + (void) sprintf (dst, "%#.3o", (unsigned int) c); } diff --git a/sysdeps/libm-ieee754/s_modf.c b/sysdeps/libm-ieee754/s_modf.c index 888d4f4..7851f675 100644 --- a/sysdeps/libm-ieee754/s_modf.c +++ b/sysdeps/libm-ieee754/s_modf.c @@ -60,7 +60,6 @@ static double one = 1.0; } } } else if (j0>51) { /* no fraction part */ - u_int32_t high; *iptr = x*one; /* We must handle NaNs separately. */ if (j0 == 0x400 && ((i0 & 0xfffff) | i1)) @@ -70,10 +69,8 @@ static double one = 1.0; } else { /* fraction part in low x */ i = ((u_int32_t)(0xffffffff))>>(j0-20); if((i1&i)==0) { /* x is integral */ - u_int32_t high; *iptr = x; - GET_HIGH_WORD(high,x); - INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ return x; } else { INSERT_WORDS(*iptr,i0,i1&(~i)); diff --git a/sysdeps/libm-ieee754/s_modff.c b/sysdeps/libm-ieee754/s_modff.c index 60f7f1e..e6c22b2 100644 --- a/sysdeps/libm-ieee754/s_modff.c +++ b/sysdeps/libm-ieee754/s_modff.c @@ -55,7 +55,6 @@ static float one = 1.0; } } } else { /* no fraction part */ - u_int32_t ix; *iptr = x*one; /* We must handle NaNs separately. */ if (j0 == 0x80 && (i0 & 0x7fffff)) diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index 541892c..526887d 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -53,9 +53,9 @@ #define OPCODE_SLWI(ra,rs,sh) OPCODE_RLWINM(ra,rs,sh,0,31-sh) #define PPC_DCBST(where) asm __volatile__ ("dcbst 0,%0" : : "r"(where)) -+#define PPC_SYNC asm __volatile__ ("sync") -+#define PPC_ISYNC asm __volatile__ ("sync; isync") -+#define PPC_ICBI(where) asm __volatile__ ("icbi 0,%0" : : "r"(where)) +#define PPC_SYNC asm __volatile__ ("sync") +#define PPC_ISYNC asm __volatile__ ("sync; isync") +#define PPC_ICBI(where) asm __volatile__ ("icbi 0,%0" : : "r"(where)) /* Use this when you've modified some code, but it won't be in the instruction fetch queue (or when it doesn't matter if it is). */ diff --git a/sysdeps/sparc/DEFS.h b/sysdeps/sparc/DEFS.h index ef69663..ab70f55 100644 --- a/sysdeps/sparc/DEFS.h +++ b/sysdeps/sparc/DEFS.h @@ -1,4 +1,12 @@ -#define FUNC(name) \ +#ifdef HAVE_ELF +# define FUNC(name) \ + .global name; \ + .type name,@function; \ + .align 4; \ + name: +#else +# define FUNC(name) \ .global name; \ .align 4; \ name: +#endif diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure index 5616867..a8f815a 100755 --- a/sysdeps/sparc/configure +++ b/sysdeps/sparc/configure @@ -1,4 +1,4 @@ # Local configure fragment for sysdeps/sparc. # The assembler on SPARC needs the -fPIC flag even when it's assembler code. -ASFLAGS_SO = -fPIC +ASFLAGS_SO=-fPIC diff --git a/sysdeps/sparc/configure.in b/sysdeps/sparc/configure.in index 3e2b2f0..e71a7e3 100644 --- a/sysdeps/sparc/configure.in +++ b/sysdeps/sparc/configure.in @@ -3,4 +3,4 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/sparc. # The assembler on SPARC needs the -fPIC flag even when it's assembler code. -ASFLAGS_SO = -fPIC +ASFLAGS_SO=-fPIC diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h index 6f1d7eb..e87f197 100644 --- a/sysdeps/sparc/dl-machine.h +++ b/sysdeps/sparc/dl-machine.h @@ -26,7 +26,7 @@ /* Some SPARC opcodes we need to use for self-modifying code. */ #define OPCODE_NOP 0x01000000 /* nop */ -#define OPCODE_CALL 0x04000000 /* call ?; add PC-rel word address */ +#define OPCODE_CALL 0x40000000 /* call ?; add PC-rel word address */ #define OPCODE_SETHI_G1 0x03000000 /* sethi ?, %g1; add value>>10 */ #define OPCODE_JMP_G1 0x81c06000 /* jmp %g1+?; add lo 10 bits of value */ #define OPCODE_SAVE_SP64 0x9de3bfc0 /* save %sp, -64, %sp */ @@ -262,6 +262,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy) .globl _dl_runtime_resolve .type _dl_runtime_resolve, @function _dl_runtime_resolve: + t 1 #call %g0 # Pass two args to fixup: the PLT address computed from the PC saved # in the PLT's call insn, and the reloc offset passed in %g1. diff --git a/sysdeps/sparc/setjmp.S b/sysdeps/sparc/setjmp.S index d959907..f07a348 100644 --- a/sysdeps/sparc/setjmp.S +++ b/sysdeps/sparc/setjmp.S @@ -26,16 +26,19 @@ ENTRY (__sigsetjmp) return PC. Save the signal mask if requested with a tail-call for simplicity; it always returns zero. */ #ifdef PIC + mov %o7,%g1 2: - jmpl 1f,%g2 + call 1f nop 1: sethi %hi(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7 - sethi %hi(C_SYMBOL_NAME (__sigjmp_save)), %g3 - st %sp, [%o0 + (JB_SP * 4)] or %l7,%lo(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7 + add %l7,%o7,%l7 + sethi %hi(C_SYMBOL_NAME (__sigjmp_save)), %g3 or %g3,%lo(C_SYMBOL_NAME (__sigjmp_save)), %g3 + st %sp, [%o0 + (JB_SP * 4)] st %fp, [%o0 + (JB_FP * 4)] + mov %g1,%o7 ld [%l7+%g3],%g1 jmp %g1 st %o7, [%o0+(JB_PC*4)] diff --git a/sysdeps/unix/sparc/sysdep.h b/sysdeps/unix/sparc/sysdep.h index eab661c..fe74a91 100644 --- a/sysdeps/unix/sparc/sysdep.h +++ b/sysdeps/unix/sparc/sysdep.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1993, 1994, 1995 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +/* Copyright (C) 1993, 1994, 1995, 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 diff --git a/sysdeps/unix/sysv/linux/sparc/Dist b/sysdeps/unix/sysv/linux/sparc/Dist index 6134c60..b50a46f 100644 --- a/sysdeps/unix/sysv/linux/sparc/Dist +++ b/sysdeps/unix/sysv/linux/sparc/Dist @@ -1,2 +1,5 @@ __sigtrampoline.S clone.S +start.c +pipe.S +fork.S diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile index 30ef946..4cbd3bd 100644 --- a/sysdeps/unix/sysv/linux/sparc/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/Makefile @@ -2,10 +2,11 @@ ifeq ($(subdir),signal) sysdep_routines += __sigtrampoline endif +asm-CPPFLAGS=-D__ASSEMBLY__ +as-FLAGS-.so=-fPIC + # When I get this to work, this is the right thing ifeq ($(subdir),elf) CFLAGS-rtld.c += -mv8 #rtld-routines += dl-sysdepsparc endif # elf - -asm-CPPFLAGS = -fPIC diff --git a/sysdeps/unix/sysv/linux/sparc/fork.S b/sysdeps/unix/sysv/linux/sparc/fork.S new file mode 100644 index 0000000..55633f2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/fork.S @@ -0,0 +1,33 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Miguel de Icaza , 1997. + + 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., 675 Mass Ave, + Cambridge, MA 02139, USA. */ + +#include + +PSEUDO (__libc_fork, fork, 0) + tst %o1 + be,a parent + nop + /* child: return 0 */ + clr %o0 +parent: + ret + +PSEUDO_END (__libc_fork) +weak_alias (__libc_fork, __fork) +weak_alias (__libc_fork, fork) diff --git a/sysdeps/unix/sysv/linux/sparc/pipe.S b/sysdeps/unix/sysv/linux/sparc/pipe.S new file mode 100644 index 0000000..4c50656 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/pipe.S @@ -0,0 +1,37 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Miguel de Icaza , 1997. + + 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 + .globl __libc_pipe +ENTRY (__libc_pipe) + mov %o0, %o2 /* Save PIPEDES. */ + mov SYS_ify(pipe),%g1 + ta 0x10 + bcc,a 2f + nop + SYSCALL_ERROR_HANDLER +2: + st %o0, [%o2] /* PIPEDES[0] = %o0; */ + st %o1, [%o2 + 4] /* PIPEDES[1] = %o1; */ + retl + clr %o0 + +PSEUDO_END (__libc_pipe) +weak_alias (__libc_pipe, __pipe) +weak_alias (__libc_pipe, pipe) diff --git a/sysdeps/unix/sysv/linux/sparc/syscalls.list b/sysdeps/unix/sysv/linux/sparc/syscalls.list index 7883d70..3d59984 100644 --- a/sysdeps/unix/sysv/linux/sparc/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/syscalls.list @@ -1,3 +1,6 @@ # File name Caller Syscall name # args Strong name Weak names +fork - fork 0 __fork fork +pipe - pipe 1 __pipe pipe s_llseek llseek _llseek 5 __sys_llseek +syscall - syscall 0 __syscall syscall diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 5ae4401..0e5a8cd 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -20,11 +20,6 @@ #ifndef _LINUX_SPARC_SYSDEP_H #define _LINUX_SPARC_SYSDEP_H 1 -/* Kernel headers use __ASSEMBLY__ */ -#ifdef ASSEMBLER -#define __ASSEMBLY__ -#endif - #include #undef SYS_ify @@ -40,6 +35,13 @@ /* Linux/SPARC uses a different trap number */ #undef PSEUDO +#undef ENTRY + +#define ENTRY(name) \ + .global C_SYMBOL_NAME(name); \ + .align 2;\ + C_LABEL(name);\ + .type name,@function; #ifdef PIC #define SYSCALL_ERROR_HANDLER \ -- cgit v1.1