summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-05-08 09:11:25 +0000
committerRoland McGrath <roland@gnu.org>1995-05-08 09:11:25 +0000
commit421f82e5cc8f81ab003247d771bcecbad799be85 (patch)
tree6d2e888aa32ba05854b1bd793b903cd0eb755bc4 /sysdeps
parent0fb807c1dbb08de4408c440c2db490b52bd16f57 (diff)
downloadglibc-421f82e5cc8f81ab003247d771bcecbad799be85.tar.gz
glibc-421f82e5cc8f81ab003247d771bcecbad799be85.tar.xz
glibc-421f82e5cc8f81ab003247d771bcecbad799be85.zip
Sat May 6 11:06:47 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* Makeconfig (+gccwarn): Add -Winline.

	* hurd/hurdsig.c (_hurd_internal_post_signal): If SS->context is
 	set, avoid abort_rpcs, and use reply and intr ports saved in
 	SS->context.
	* sysdeps/mach/hurd/i386/trampoline.c: Don't set SS->intr_port
 	from SS->context.  Don't clear SS->context.
	* sysdeps/mach/hurd/i386/sigreturn.c: Don't set SS->intr_port when
 	setting SS->context.  If msg_sig_post returns, re-lock and clear
 	SS->context.

Fri May  5 10:37:09 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* mach/Makefile (errsystems.c): Comment out generation rule.

	* sysdeps/mach/_strerror.c: Consider a system unknown if its
 	bad_sub member is null.

	* mach/mig-alloc.c: Add weak alias to non-__ name.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/dl-machine.h37
-rw-r--r--sysdeps/i386/dl-runtime.c9
-rw-r--r--sysdeps/mach/_strerror.c6
-rw-r--r--sysdeps/mach/hurd/getdtsz.c7
-rw-r--r--sysdeps/mach/hurd/i386/sigreturn.c10
-rw-r--r--sysdeps/mach/hurd/i386/trampoline.c18
6 files changed, 35 insertions, 52 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 5e1ee2a413..1797ae5b87 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -68,11 +68,10 @@ elf_machine_load_address (void)
   ++(const Elf32_Rel *) (dynamic_info)[DT_REL]->d_un.d_ptr;
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
-   LOADADDR is the load address of the object; INFO is an array indexed
-   by DT_* of the .dynamic section info.  */
+   MAP is the object containing the reloc.  */
 
 static inline void
-elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
+elf_machine_rel (struct link_map *map,
 		 const Elf32_Rel *reloc,
 		 Elf32_Addr sym_loadaddr, const Elf32_Sym *sym)
 {
@@ -92,7 +91,7 @@ elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
       *reloc_addr += sym_value;
       break;
     case R_386_RELATIVE:
-      *reloc_addr += loadaddr;
+      *reloc_addr += map->l_addr;
       break;
     case R_386_PC32:
       *reloc_addr = sym_value - (Elf32_Addr) reloc_addr;
@@ -105,13 +104,7 @@ elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
 
 
 /* The i386 never uses Elf32_Rela relocations.  */
-static inline void
-elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
-		  const Elf32_Rela *reloc, 
-		  Elf32_Addr sym_loadaddr, const Elf32_Sym *sym)
-{
-  _dl_signal_error (0, "Elf32_Rela relocation requested -- unused on i386");
-}
+#define ELF_MACHINE_NO_RELA 1
 
 
 /* Set up the loaded object described by L so its unrelocated PLT
@@ -140,9 +133,16 @@ elf_machine_runtime_setup (struct link_map *l)
 #define RTLD_START asm ("\
 .text\n\
 .globl _start\n\
-_start:	call _dl_start\n\
-	# Save the user entry point address in %ebx.\n\
-	movl %eax, %ebx\n\
+.globl _dl_start_user\n\
+_start:\n\
+	call _dl_start\n\
+_dl_start_user:\n\
+	# Save the user entry point address in %edi.\n\
+	movl %eax, %edi\n\
+	# Point %ebx at the GOT.
+1:	call 2f\n\
+2:	popl %ebx\n\
+	addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %ebx\n\
 	# Call _dl_init_next to return the address of an initializer\n\
 	# function to run.\n\
 0:	call _dl_init_next@PLT\n\
@@ -160,10 +160,7 @@ _start:	call _dl_start\n\
 	# Loop to call _dl_init_next for the next initializer.\n\
 	jmp 0b\n\
 	# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
-1:	call 2f\n\
-2:	popl %eax\n\
-	addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %eax\n\
-	leal _dl_fini@GOT(%eax), %edx\n\
-	# Jump to the user entry point.\n\
-	jmp *%ebx\n\
+	leal _dl_fini@GOT(%ebx), %edx\n\
+	# Jump to the user's entry point.\n\
+	jmp *%edi\n\
 ");
diff --git a/sysdeps/i386/dl-runtime.c b/sysdeps/i386/dl-runtime.c
index 897524fdd3..1bc569760c 100644
--- a/sysdeps/i386/dl-runtime.c
+++ b/sysdeps/i386/dl-runtime.c
@@ -17,8 +17,6 @@ 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.  */
 
-register void *sp asm ("%esp");
-
 #include <link.h>
 #include "dynamic-link.h"
 
@@ -30,7 +28,7 @@ register void *sp asm ("%esp");
    0(%esp)	identifier for this shared object (struct link_map *)
 
    The user expects the real function the PLT refers to to be entered
-   8(%esp) as the top of stack.  */
+   with 8(%esp) as the top of stack.  */
 
 void
 _dl_runtime_resolve (Elf32_Word reloc_offset)
@@ -63,14 +61,15 @@ _dl_runtime_resolve (Elf32_Word reloc_offset)
     scope = _dl_loaded;
   
   definer = &symtab[ELF32_R_SYM (reloc->r_info)];
-  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer, scope);
+  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,
+				scope, l->l_name);
   
   /* Restore list frobnication done above for DT_SYMBOLIC.  */
   l->l_next = real_next;
   l->l_prev->l_next = l;
 
   /* Apply the relocation with that value.  */
-  elf_machine_rel (l->l_addr, l->l_info, reloc, loadbase, definer);
+  elf_machine_rel (l, reloc, loadbase, definer);
 
   /* The top of the stack is the word we set L from; but this location
      holds the address we will return to.  Store there the address of a
diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c
index 4740902a10..398c77fbdf 100644
--- a/sysdeps/mach/_strerror.c
+++ b/sysdeps/mach/_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 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
@@ -20,7 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include <mach/error.h>
-#include <mach/errorlib.h>
+#include <errorlib.h>
 
 /* Return a string describing the errno code in ERRNUM.  */
 char *
@@ -38,7 +38,7 @@ DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024])
   sub = err_get_sub (errnum);
   code = err_get_code (errnum);
 
-  if (system > err_max_system)
+  if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
     {
       sprintf (buf, "Unknown error system %d", system);
       return buf;
diff --git a/sysdeps/mach/hurd/getdtsz.c b/sysdeps/mach/hurd/getdtsz.c
index 3e6385f64e..1befd48a70 100644
--- a/sysdeps/mach/hurd/getdtsz.c
+++ b/sysdeps/mach/hurd/getdtsz.c
@@ -21,6 +21,7 @@ Cambridge, MA 02139, USA.  */
 #include <unistd.h>
 #include <hurd.h>
 #include <hurd/fd.h>
+#include <hurd/resource.h>
 
 /* Return the maximum number of file descriptors the current process
    could possibly have (until it raises the resource limit).  */
@@ -29,9 +30,9 @@ DEFUN_VOID(__getdtablesize)
 {
   int size;
   HURD_CRITICAL_BEGIN;
-  __mutex_lock (&_hurd_rlimits_lock);
-  size = _hurd_rlimits[RLIM_NOFILE].rlim_cur; /* XXX RLIM_INFINITY?? */
-  __mutex_unlock (&_hurd_rlimits_lock);
+  __mutex_lock (&_hurd_rlimit_lock);
+  size = _hurd_rlimits[RLIMIT_NOFILE].rlim_cur;
+  __mutex_unlock (&_hurd_rlimit_lock);
   HURD_CRITICAL_END;
   return size;
 }
diff --git a/sysdeps/mach/hurd/i386/sigreturn.c b/sysdeps/mach/hurd/i386/sigreturn.c
index d00fa7755f..0e5ccfc9f5 100644
--- a/sysdeps/mach/hurd/i386/sigreturn.c
+++ b/sysdeps/mach/hurd/i386/sigreturn.c
@@ -57,15 +57,13 @@ __sigreturn (struct sigcontext *scp)
 	 the signal thread will notice it if it runs another handler, and
 	 arrange to have us called over again in the new reality.  */
       ss->context = scp;
-      /* Clear the intr_port slot, since we are not in fact doing
-	 an interruptible RPC right now.  If SS->intr_port is not null,
-	 the SCP context is doing an interruptible RPC, but the signal
-	 thread will examine us while we are blocked in the sig_post RPC.  */
-      ss->intr_port = MACH_PORT_NULL;
       __spin_unlock (&ss->lock);
       __msg_sig_post (_hurd_msgport, 0, __mach_task_self ());
-      /* If a pending signal was handled, sig_post never returned.  */
+      /* If a pending signal was handled, sig_post never returned.
+	 If it did return, the pending signal didn't run a handler;
+	 proceed as usual.  */
       __spin_lock (&ss->lock);
+      ss->context = NULL;
     }
 
   if (scp->sc_onstack)
diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
index 3402181481..2a31588e21 100644
--- a/sysdeps/mach/hurd/i386/trampoline.c
+++ b/sysdeps/mach/hurd/i386/trampoline.c
@@ -73,23 +73,11 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 		  sizeof (state->basic));
 	  memcpy (&state->fpu, &ss->context->sc_i386_float_state,
 		  sizeof (state->fpu));
-	  state->set = (1 << i386_THREAD_STATE) | (1 << i386_FLOAT_STATE);
-	  assert (! rpc_wait);
-	  /* The intr_port slot was cleared before sigreturn sent us the
-	     sig_post that made us notice this pending signal, so
-	     _hurd_internal_post_signal wouldn't do interrupt_operation.
-	     After we return, our caller will set SCP->sc_intr_port (in the
-	     new context) from SS->intr_port and clear SS->intr_port.  Now
-	     that we are restoring this old context recorded by sigreturn,
-	     we want to restore its intr_port too; so store it in
-	     SS->intr_port now, so it will end up in SCP->sc_intr_port
-	     later.  */
-	  ss->intr_port = ss->context->sc_intr_port;
+	  state->set |= (1 << i386_THREAD_STATE) | (1 << i386_FLOAT_STATE);
 	}
-      /* If the sigreturn context was bogus, just ignore it.  */
-      ss->context = NULL;
     }
-  else if (! machine_get_basic_state (ss->thread, state))
+
+  if (! machine_get_basic_state (ss->thread, state))
     return NULL;
 
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&