about summary refs log tree commit diff
path: root/sysdeps/i386/dl-machine.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-23 01:54:07 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-23 01:54:07 +0000
commitbc9f6000f6752153e5e1902259d5f491a88a1ae5 (patch)
treeaffff963d9f44f476e13e4ee673f67509456096f /sysdeps/i386/dl-machine.h
parent5ae9d168f66cc6b40f74cfb4a8f2631fc1df6a2a (diff)
downloadglibc-bc9f6000f6752153e5e1902259d5f491a88a1ae5.tar.gz
glibc-bc9f6000f6752153e5e1902259d5f491a88a1ae5.tar.xz
glibc-bc9f6000f6752153e5e1902259d5f491a88a1ae5.zip
1997-03-23 02:11  Ulrich Drepper  <drepper@cygnus.com>

	* time/sys/time.h: Make values ITIMER_* also available as macros.

	* elf/dl-support.c (_dl_sysdep_read_whole_file): Don't call
	__fstat but instead __fxstat directly to avoid dependency on
	libc.a when inline failed.
	* sysdeps/generic/dl-sysdep.c (_dl_sysdep_read_whole_file): Likewise.

	* math/Makefile (libm-routines): Add s_remquo.
	* sysdeps/libm-i387/s_remquo.S: New file.
	* sysdeps/libm-i387/s_remquof.S: New file.
	* sysdeps/libm-i387/s_remquol.S: New file.
	* sysdeps/libm-ieee754/s_remquo.c: New file.
	* sysdeps/libm-ieee754/s_remquof.c: New file.
	* sysdeps/libm-ieee754/s_remquol.c: New file.

	* math/libm-test.c (remquo_test): New function.

	* sysdeps/libm-ieee754/s_rintl.c: Handle implicit leading one
	correctly.

1997-03-22 14:06  Ulrich Drepper  <drepper@cygnus.com>

	* math/Makefile (libm-calls): Add s_nan.
	* sysdeps/libm-ieee754/s_nan.c: New file.  Implement `nan' function.
	* sysdeps/libm-ieee754/s_nanf.c: New file.  Implement `nanf' function.
	* sysdeps/libm-ieee754/s_nanl.c: New file.  Implement `nanl' function.

	* math/libm-test.c (basic_tests): Add tests for `nan' function.

	* math/libm-test.c (copysign_test): New function.
	(main): Call copysign_test.

1997-03-22 06:28  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/libm-ieee754/s_nextafter.c: Return y if x == y.
	* sysdeps/libm-ieee754/s_nextafterf.c: Likewise.
	* sysdeps/libm-ieee754/s_nextafterl.c: Likewise.
	* sysdeps/libm-i387/s_nextafterl.c: Likewise.

	* math/libm-test.c (fdim_test, fmin_test, fmax_test, nextafter_test):
	New functions.  Test these functions.
	(main): Call above new functions.

1997-03-22 04:53  Ulrich Drepper  <drepper@cygnus.com>

	* Net release 2.0.2.

1997-03-22 04:37  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/termbits.h (OXTABS): Define as alias for
	XTABS.
	* sysdeps/unix/sysv/linux/alpha/termbits.h (OXTABS): Likewise.
	* termios/sys/ttydefaults.h: Partly revert patch by Andreas Schwab
	of Sun Dec 15 16:33:44 1996.
	Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>.

1997-03-21 13:41  Roland McGrath  <roland@baalperazim.frob.com>

	* sysdeps/sparc/dl-machine.h (elf_machine_rel): Rewritten as for i386.
	Check here for non-SHN_UNDEF STB_LOCAL symbols don't do any lookup or
	consult their values.
	(elf_machine_lookup_noexec_p, elf_machine_lookup_noplt_p,
	ELF_MACHINE_RELOC_NOPLT): New macros.

	* elf/rtld.c (dl_main): Pass ELF_MACHINE_RELOC_NOPLT to
	_dl_lookup_symbol in place of DL_LOOKUP_NOPLT.
	* sysdeps/i386/dl-machine.h (ELF_MACHINE_RELOC_NOPLT): New macro.

	* sysdeps/i386/dl-machine.h (elf_machine_rel): Rewritten to do the
	symbol lookup before checking reloc type except for R_386_RELATIVE.
	(elf_machine_lookup_noexec_p, elf_machine_lookup_noplt_p): New macros.

	* elf/dl-reloc.c (RESOLVE): Remove STB_LOCAL check; let it be
	per-machine since it supposedly can't happen on i386.

	* elf/dl-lookup.c (do_lookup): Change arg FLAGS to RELOC_TYPE.  Use
	elf_machine_lookup_{noexec,noplt}_p macros on it.  Remove gratuitous
	indirection from REF arg; change callers.
	(_dl_lookup_symbol, _dl_lookup_versioned_symbol): Change arg name.
	(_dl_lookup_symbol_skip, _dl_lookup_versioned_symbol_skip): Remove
	FLAGS arg altogether.
	* elf/dlsym.c: Remove argument of FLAGS parameter.
	* elf/dlvsym.c: Likewise.
	* elf/link.h: Update decls.

	* Makefile (distribute): Add BUGS.
Diffstat (limited to 'sysdeps/i386/dl-machine.h')
-rw-r--r--sysdeps/i386/dl-machine.h108
1 files changed, 58 insertions, 50 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 40623e795c..8e6df12d6b 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -218,7 +218,14 @@ _dl_start_user:\n\
 
 /* Nonzero iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.  */
-#define elf_machine_pltrel_p(type) ((type) == R_386_JMP_SLOT)
+#define elf_machine_lookup_noexec_p(type) ((type) == R_386_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_386_JMP_SLOT)
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
+#define ELF_MACHINE_RELOC_NOPLT	R_386_JMP_SLOT
 
 /* The i386 never uses Elf32_Rela relocations.  */
 #define ELF_MACHINE_NO_RELA 1
@@ -235,62 +242,63 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 		 const Elf32_Sym *sym, const struct r_found_version *version)
 {
   Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
-  Elf32_Addr loadbase;
 
-  switch (ELF32_R_TYPE (reloc->r_info))
+  if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
     {
-    case R_386_COPY:
-      loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOEXEC);
-      memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
-      break;
-    case R_386_GLOB_DAT:
-      loadbase = RESOLVE (&sym, version, 0);
-      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
-      break;
-    case R_386_JMP_SLOT:
-      loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOPLT);
-      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
-      break;
-    case R_386_32:
-      {
-	Elf32_Addr undo = 0;
-#ifndef RTLD_BOOTSTRAP
-	/* This is defined in rtld.c, but nowhere in the static libc.a;
-	   make the reference weak so static programs can still link.  This
-	   declaration cannot be done when compiling rtld.c (i.e.  #ifdef
-	   RTLD_BOOTSTRAP) because rtld.c contains the common defn for
-	   _dl_rtld_map, which is incompatible with a weak decl in the same
-	   file.  */
-	weak_extern (_dl_rtld_map);
-	if (map == &_dl_rtld_map)
-	  /* Undo the relocation done here during bootstrapping.  Now we will
-	     relocate it anew, possibly using a binding found in the user
-	     program or a loaded library rather than the dynamic linker's
-	     built-in definitions used while loading those libraries.  */
-	  undo = map->l_addr + sym->st_value;
-#endif
-	loadbase = RESOLVE (&sym, version, 0);
-	*reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo;
-	break;
-      }
-    case R_386_RELATIVE:
 #ifndef RTLD_BOOTSTRAP
       if (map != &_dl_rtld_map) /* Already done in rtld itself.  */
 #endif
 	*reloc_addr += map->l_addr;
-      break;
-    case R_386_PC32:
-      loadbase = RESOLVE (&sym, version, 0);
-      *reloc_addr += ((sym ? (loadbase + sym->st_value) : 0) -
-		      (Elf32_Addr) reloc_addr);
-      break;
-    case R_386_NONE:		/* Alright, Wilbur.  */
-      break;
-    default:
-      assert (! "unexpected dynamic reloc type");
-      break;
     }
-
+  else
+    {
+#ifndef RTLD_BOOTSTRAP
+      const Elf32_Sym *const refsym = sym;
+#endif
+      Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+      if (sym)
+	value += sym->st_value;
+
+      switch (ELF32_R_TYPE (reloc->r_info))
+	{
+	case R_386_COPY:
+	  memcpy (reloc_addr, (void *) value, sym->st_size);
+	  break;
+	case R_386_GLOB_DAT:
+	case R_386_JMP_SLOT:
+	  *reloc_addr = value;
+	  break;
+	case R_386_32:
+	  {
+#ifndef RTLD_BOOTSTRAP
+	   /* This is defined in rtld.c, but nowhere in the static
+	      libc.a; make the reference weak so static programs can
+	      still link.  This declaration cannot be done when
+	      compiling rtld.c (i.e.  #ifdef RTLD_BOOTSTRAP) because
+	      rtld.c contains the common defn for _dl_rtld_map, which
+	      is incompatible with a weak decl in the same file.  */
+	    weak_extern (_dl_rtld_map);
+	    if (map == &_dl_rtld_map)
+	      /* Undo the relocation done here during bootstrapping.
+		 Now we will relocate it anew, possibly using a
+		 binding found in the user program or a loaded library
+		 rather than the dynamic linker's built-in definitions
+		 used while loading those libraries.  */
+	      value -= map->l_addr + refsym->st_value;
+#endif
+	    *reloc_addr += value;
+	    break;
+	  }
+	case R_386_PC32:
+	  *reloc_addr += (value - (Elf32_Addr) reloc_addr);
+	  break;
+	case R_386_NONE:		/* Alright, Wilbur.  */
+	  break;
+	default:
+	  assert (! "unexpected dynamic reloc type");
+	  break;
+	}
+    }
 }
 
 static inline void