From bf47fa234412a30f51255b42c92cd29f0b985e79 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 16 Jun 1998 16:30:14 +0000 Subject: [PATCH] Update. 1998-06-16 David S. Miller * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_fixup_plt): During rtld bootstrap, always perform flushes as the kernel will emulate it when the underlying cpu does not implement flush. * sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h: Move... * sysdeps/unix/sysv/linux/sparc/kernel_termios.h: ...to here. * sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: No longer build trampoline code. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Branch to label .Lerror not __clone_syscall_error. (.Lerror): Fixup EINVAL setting. * sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (__syscall_getgroups, __syscall_setgroups): Add. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c (__sigaction): Member name is k_sa_handler. Use memcpy to copy around sa_mask data. * math/math.h: Include bits/nan.h when compiling for ISO C 9x. --- ChangeLog | 28 ++++ FAQ.in | 13 ++ math/math.h | 2 +- sysdeps/sparc/sparc32/dl-machine.h | 4 +- .../unix/sysv/linux/sparc/kernel_termios.h | 38 +++++ .../unix/sysv/linux/sparc/sparc32/Makefile | 4 - .../linux/sparc/sparc32/__sigtrampoline.S | 140 ------------------ sysdeps/unix/sysv/linux/sparc/sparc32/clone.S | 4 +- .../unix/sysv/linux/sparc/sparc32/getgroups.c | 2 + .../unix/sysv/linux/sparc/sparc32/setgroups.c | 2 + .../unix/sysv/linux/sparc/sparc32/sigaction.c | 10 +- .../sysv/linux/sparc/sparc32/syscalls.list | 2 + .../sysv/linux/sparc/sys/kernel_termios.h | 20 --- 13 files changed, 96 insertions(+), 173 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/sparc/kernel_termios.h delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h diff --git a/ChangeLog b/ChangeLog index 020a24a52a..4ea8633fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,33 @@ +1998-06-16 David S. Miller + + * sysdeps/sparc/sparc32/dl-machine.h + (elf_machine_fixup_plt): During rtld bootstrap, always perform + flushes as the kernel will emulate it when the underlying cpu does + not implement flush. + + * sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h: Move... + * sysdeps/unix/sysv/linux/sparc/kernel_termios.h: ...to here. + + * sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S: Remove. + * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: No longer build + trampoline code. + + * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S + (__clone): Branch to label .Lerror not __clone_syscall_error. + (.Lerror): Fixup EINVAL setting. + * sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c: New file. + * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file. + * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list + (__syscall_getgroups, __syscall_setgroups): Add. + + * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c + (__sigaction): Member name is k_sa_handler. Use memcpy to copy + around sa_mask data. + 1998-06-16 Ulrich Drepper + * math/math.h: Include bits/nan.h when compiling for ISO C 9x. + * string/Makefile: Make sure test-ffs does not use builtins. 1998-06-16 Thorsten Kukuk diff --git a/FAQ.in b/FAQ.in index 93784f62f7..53889ff4a3 100644 --- a/FAQ.in +++ b/FAQ.in @@ -657,6 +657,19 @@ option is using NSS. There is no switch anymore. Therefore it is *highly* recommended *not* to use --enable-static-nss since this makes the behaviour of the programs on the system inconsistent. +?? I just upgraded my Linux system to glibc and now I get + errors whenever I try to link any program. + +{ZW} This happens when you have installed glibc as the primary C library but +have stray symbolic links pointing at your old C library. If the first +`libc.so' the linker finds is libc 5, it will use that. Your program +expects to be linked with glibc, so the link fails. + +The most common case is that glibc put its `libc.so' in /usr/lib, but there +was a `libc.so' from libc 5 in /lib, which gets searched first. To fix the +problem, just delete /lib/libc.so. You may also need to delete other +symbolic links in /lib, such as /lib/libm.so if it points to libm.so.5. + ? Source and binary incompatibilities, and what to do about them ?? I expect GNU libc to be 100% source code compatible with diff --git a/math/math.h b/math/math.h index 704d499240..a5d5b504f2 100644 --- a/math/math.h +++ b/math/math.h @@ -33,7 +33,7 @@ __BEGIN_DECLS #include /* Get machine-dependent NAN value (returned for some domain errors). */ -#ifdef __USE_GNU +#ifdef __USE_ISOC9X # include #endif diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 348e0a4bbe..f08eb0381a 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -271,7 +271,9 @@ elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc, unsigned long *hwcap = WEAKADDR(_dl_hwcap); int do_flush = (!hwcap || (*hwcap & HWCAP_SPARC_FLUSH)); #else - int do_flush = 0; + /* Unfortunately, this is necessary, so that we can ensure + ld.so will not execute corrupt PLT entry instructions. */ + const int do_flush = 1; #endif /* For thread safety, write the instructions from the bottom and diff --git a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h new file mode 100644 index 0000000000..843bcad8b4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h @@ -0,0 +1,38 @@ +/* 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. */ + +#ifndef _KERNEL_TERMIOS_H +#define _KERNEL_TERMIOS_H 1 +/* The following corresponds to the values from the Linux 2.1.20 kernel. */ + +/* We need the definition of tcflag_t, cc_t, and speed_t. */ +#include + +#define __KERNEL_NCCS 17 + +struct __kernel_termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[__KERNEL_NCCS]; /* control characters */ + }; + +#endif /* kernel_termios.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile index 01a0e8310f..016290646a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile @@ -1,7 +1,3 @@ -ifeq ($(subdir),signal) -sysdep_routines += __sigtrampoline -endif - asm-CPPFLAGS=-D__ASSEMBLY__ ASFLAGS-.os=-fPIC diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S b/sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S deleted file mode 100644 index 8e88a3ff04..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/__sigtrampoline.S +++ /dev/null @@ -1,140 +0,0 @@ -/* Userland trampoline code for sigaction on Linux/SPARC */ -/* (C) 1996, 1997 Free Software Foundation, Inc. */ -/* This file is part of the GNU C Library. */ -/* Contributed by Miguel de Icaza (miguel@gnu.ai.mit.edu) */ -/* Many thanks go to David Miller for explaining all this to me */ -/* miguel@nuclecu.unam.mx */ -/* Sources: David Miller, 4.4BSD/SPARC code */ - -#include -#define __ASSEMBLY__ -/* For REGWIN_SZ */ -#include -#include - -/* The C compiler frame size */ -#define CCFSZ 96 - - .text - -ENTRY(____sparc_signal_trampoline) - .global C_SYMBOL_NAME(____sig_table) - - /* Make room for 32 %f registers + %fsr - * this is 132 bytes + alignement = 136 - * 96 is the C frame size - */ - save %sp,-136-CCFSZ,%sp - - /* save regular registers */ - mov %g2,%l2 - mov %g3,%l3 - mov %g4,%l4 - mov %g5,%l5 - mov %g6,%l6 - mov %g7,%l7 - - /* save fpu registers */ - ld [%fp+64+16+20],%l0 /* load the psr from sigcontext */ - sethi %hi(PSR_EF),%l1 - andcc %l0,%l1,%l0 /* is floating point enabled? */ - be 1f - rd %y,%l1 /* save y anyways */ - - /* save fpu registers */ - st %fsr, [%sp + CCFSZ + 0] - std %f0, [%sp + CCFSZ + 8] - std %f2, [%sp + CCFSZ + 16] - std %f4, [%sp + CCFSZ + 24] - std %f6, [%sp + CCFSZ + 32] - std %f8, [%sp + CCFSZ + 40] - std %f10, [%sp + CCFSZ + 48] - std %f12, [%sp + CCFSZ + 56] - std %f14, [%sp + CCFSZ + 64] - std %f16, [%sp + CCFSZ + 72] - std %f18, [%sp + CCFSZ + 80] - std %f20, [%sp + CCFSZ + 88] - std %f22, [%sp + CCFSZ + 96] - std %f24, [%sp + CCFSZ + 104] - std %f26, [%sp + CCFSZ + 112] - std %f28, [%sp + CCFSZ + 120] - std %f30, [%sp + CCFSZ + 128] - -1: - /* Load signal number */ - ld [%fp + REGWIN_SZ],%o0 - mov %fp,%o1 - mov 0xfea,%o2 - - /* Sanity check */ - cmp %o0,33 - bl 1f - or %g0,%g0,%g1 /*Call sys_setup */ - t 0x10 -1: -#ifdef PIC - /* Save return address */ - mov %o7,%o5 -11: call 12f - sethi %hi(_GLOBAL_OFFSET_TABLE_-(11b-.)),%o4 -12: or %o5,%lo(_GLOBAL_OFFSET_TABLE_-(11b-.)),%o4 - add %o7,%o4,%o4 - /* restore return address */ - mov %o5,%o7 - /* o4 has the GOT pointer */ -#endif - sethi %hi(C_SYMBOL_NAME(____sig_table)),%o5 - or %o5,%lo(C_SYMBOL_NAME(____sig_table)),%o5 -#ifdef PIC - ld [%o4+%o5], %o5 -#endif - sll %o0,2,%o4 - add %o5,%o4,%o4 - ld [%o4],%o4 - ld [%fp + REGWIN_SZ + 4],%o1 /* Load subcode */ - ld [%fp + REGWIN_SZ + 8],%o2 /* pointer to sigcontext */ - call %o4 - ld [%fp + REGWIN_SZ + 12],%o3 /* Address where signal ocurre - */ - - /* handler returned, restore state */ - tst %l0 - be 1f - wr %l1,%g0,%y - - /* fpu restoration */ - ld [%sp + CCFSZ + 0], %fsr - ldd [%sp + CCFSZ + 8], %f0 - ldd [%sp + CCFSZ + 16], %f2 - ldd [%sp + CCFSZ + 24], %f4 - ldd [%sp + CCFSZ + 32], %f6 - ldd [%sp + CCFSZ + 40], %f8 - ldd [%sp + CCFSZ + 48], %f10 - ldd [%sp + CCFSZ + 56], %f12 - ldd [%sp + CCFSZ + 64], %f14 - ldd [%sp + CCFSZ + 72], %f16 - ldd [%sp + CCFSZ + 80], %f18 - ldd [%sp + CCFSZ + 88], %f20 - ldd [%sp + CCFSZ + 96], %f22 - ldd [%sp + CCFSZ + 104], %f24 - ldd [%sp + CCFSZ + 112], %f26 - ldd [%sp + CCFSZ + 120], %f28 - ldd [%sp + CCFSZ + 128], %f30 - -1: - mov %l2,%g2 - mov %l3,%g3 - mov %l4,%g4 - mov %l5,%g5 - mov %l6,%g6 - mov %l7,%g7 - - /* call sigreturn */ - restore %g0,SYS_ify(sigreturn),%g1 /* register back and set syscal */ - add %sp,64+16,%o0 - t 0x10 - /* if we return, sysreturn failed */ - mov SYS_ify(exit),%g1 - t 0x10 - -END(____sparc_signal_trampoline) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S index e053569650..e40ee32706 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S @@ -44,7 +44,7 @@ __clone: mov %i2,%o0 set __NR_clone,%g1 ta 0x10 - bcs __clone_syscall_error + bcs .Lerror tst %o1 bne __thread_start nop @@ -54,7 +54,7 @@ __clone: .Lerror: call __errno_location - set EINVAL,%i0 + or %g0,EINVAL,%i0 st %i0,[%o0] mov -1,%i0 ret diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c new file mode 100644 index 0000000000..102ea24e14 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c @@ -0,0 +1,2 @@ +/* We also have to rewrite the kernel gid_t to the user land type. */ +#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c new file mode 100644 index 0000000000..0e7086278f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c @@ -0,0 +1,2 @@ +/* We also have to rewrite the kernel gid_t to the user land type. */ +#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c index b9c20ddcd0..742ac5583c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c @@ -34,14 +34,14 @@ __sigaction (int sig, __const struct sigaction *act, struct sigaction *oact) struct kernel_sigaction k_sigact, k_osigact; /* Magic to tell the kernel we are using "new-style" signals, in that - the signal table is not kept in userspace. Not the same as the + the signal table is not kept in userspace. Not the same as the really-new-style rt signals. */ sig = -sig; if (act) { - k_sigact.sa_handler = act->sa_handler; - k_sigact.sa_mask = act->sa_mask.__val[0]; + k_sigact.k_sa_handler = act->sa_handler; + memcpy (&k_sigact.sa_mask, &act->sa_mask, sizeof (sigset_t)); k_sigact.sa_flags = act->sa_flags; } @@ -70,8 +70,8 @@ __sigaction (int sig, __const struct sigaction *act, struct sigaction *oact) { if (oact) { - oact->sa_handler = k_osigact.sa_handler; - oact->sa_mask.__val[0] = k_osigact.sa_mask; + oact->sa_handler = k_osigact.k_sa_handler; + memcpy (&oact->sa_mask, &k_osigact.sa_mask, sizeof (sigset_t)); oact->sa_flags = k_osigact.sa_flags; oact->sa_restorer = NULL; } diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list index 7883d70719..9a3e4d0e58 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list @@ -1,3 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names +s_getgroups getgroups getgroups 2 __syscall_getgroups s_llseek llseek _llseek 5 __sys_llseek +s_setgroups setgroups setgroups 2 __syscall_setgroups diff --git a/sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h deleted file mode 100644 index b33fd31128..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sys/kernel_termios.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _SYS_KERNEL_TERMIOS_H -#define _SYS_KERNEL_TERMIOS_H 1 -/* The following corresponds to the values from the Linux 2.1.20 kernel. */ - -/* We need the definition of tcflag_t, cc_t, and speed_t. */ -#include - -#define __KERNEL_NCCS 17 - -struct __kernel_termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[__KERNEL_NCCS]; /* control characters */ - }; - -#endif /* sys/kernel_termios.h */