about summary refs log tree commit diff
path: root/sysdeps/sparc/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/sparc/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/sparc/dl-machine.h')
-rw-r--r--sysdeps/sparc/dl-machine.h148
1 files changed, 64 insertions, 84 deletions
diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h
index e87f1970e7..880542d2b3 100644
--- a/sysdeps/sparc/dl-machine.h
+++ b/sysdeps/sparc/dl-machine.h
@@ -104,93 +104,66 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
   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_SPARC_RELATIVE)
+    *reloc_addr += map->l_addr + reloc->r_addend;
+  else
     {
-    case R_SPARC_COPY:
-      loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOEXEC);
-      memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
-      break;
-    case R_SPARC_GLOB_DAT:
-    case R_SPARC_32:
-      loadbase = RESOLVE (&sym, version, 0);
-      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-		     + reloc->r_addend);
-      break;
-    case R_SPARC_JMP_SLOT:
-      loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOPLT);
-      {
-	Elf32_Addr value = ((sym ? (loadbase + sym->st_value) : 0)
-			    + reloc->r_addend);
-	reloc_addr[1] = OPCODE_SETHI_G1 | (value >> 10);
-	reloc_addr[2] = OPCODE_JMP_G1 | (value & 0x3ff);
-      }
-      break;
-    case R_SPARC_8:
-      loadbase = RESOLVE (&sym, version, 0);
-      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			      + reloc->r_addend);
-      break;
-    case R_SPARC_16:
-      loadbase = RESOLVE (&sym, version, 0);
-      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			       + reloc->r_addend);
-      break;
-    case R_SPARC_RELATIVE:
-      *reloc_addr += map->l_addr + reloc->r_addend;
-      break;
-    case R_SPARC_DISP8:
-      loadbase = RESOLVE (&sym, version, 0);
-      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			      + reloc->r_addend
-			      - (Elf32_Addr) reloc_addr);
-      break;
-    case R_SPARC_DISP16:
-      loadbase = RESOLVE (&sym, version, 0);
-      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			       + reloc->r_addend
-			       - (Elf32_Addr) reloc_addr);
-      break;
-    case R_SPARC_DISP32:
-      loadbase = RESOLVE (&sym, version, 0);
-      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-		     + reloc->r_addend
-		     - (Elf32_Addr) reloc_addr);
-      break;
-      case R_SPARC_LO10:
+      Elf32_Addr value;
+      if (sym->st_shndx != SHN_UNDEF &&
+	  ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
+	value = map->l_addr;
+      else
 	{
-	  unsigned int saddr;
-
-	  loadbase = RESOLVE (&sym, version, 0);
-	  saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
-
-	  *reloc_addr = (*reloc_addr & ~0x3ff) | (saddr & 0x3ff);
+	  value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+	  if (sym)
+	    value += sym->st_value;
 	}
-       break;
-    case R_SPARC_WDISP30:
-      {
-	unsigned int saddr;
-
-	loadbase = RESOLVE (&sym, version, 0);
-	saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
-	*reloc_addr = ((*reloc_addr & 0xc0000000)
-		       | ((saddr - (unsigned int) reloc_addr)>>2));
-      }
-      break;
-    case R_SPARC_HI22:
-      {
-	unsigned int saddr;
-
-	loadbase = RESOLVE (&sym, version, 0);
-	saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
+      value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
 
-	*reloc_addr = (*reloc_addr & 0xffc00000)|(saddr >> 10);
-      }
-      break;
-    case R_SPARC_NONE:		/* Alright, Wilbur.  */
-      break;
-    default:
-      assert (! "unexpected dynamic reloc type");
-      break;
+      switch (ELF32_R_TYPE (reloc->r_info))
+	{
+	case R_SPARC_COPY:
+	  memcpy (reloc_addr, (void *) value, sym->st_size);
+	  break;
+	case R_SPARC_GLOB_DAT:
+	case R_SPARC_32:
+	  *reloc_addr = value;
+	  break;
+	case R_SPARC_JMP_SLOT:
+	  reloc_addr[1] = OPCODE_SETHI_G1 | (value >> 10);
+	  reloc_addr[2] = OPCODE_JMP_G1 | (value & 0x3ff);
+	  break;
+	case R_SPARC_8:
+	  *(char *) reloc_addr = value;
+	  break;
+	case R_SPARC_16:
+	  *(short *) reloc_addr = value;
+	  break;
+	case R_SPARC_DISP8:
+	  *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+	  break;
+	case R_SPARC_DISP16:
+	  *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+	  break;
+	case R_SPARC_DISP32:
+	  *reloc_addr = (value - (Elf32_Addr) reloc_addr);
+	  break;
+	case R_SPARC_LO10:
+	  *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
+	  break;
+	case R_SPARC_WDISP30:
+	  *reloc_addr = ((*reloc_addr & 0xc0000000)
+			 | ((value - (unsigned int) reloc_addr) >> 2));
+	  break;
+	case R_SPARC_HI22:
+	  *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
+	  break;
+	case R_SPARC_NONE:		/* Alright, Wilbur.  */
+	  break;
+	default:
+	  assert (! "unexpected dynamic reloc type");
+	  break;
+	}
     }
 }
 
@@ -213,7 +186,14 @@ elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
 
 /* 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_SPARC_JMP_SLOT)
+#define elf_machine_lookup_noexec_p(type) ((type) == R_SPARC_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_SPARC_JMP_SLOT)
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
+#define ELF_MACHINE_RELOC_NOPLT	R_SPARC_JMP_SLOT
 
 /* The SPARC never uses Elf32_Rel relocations.  */
 #define ELF_MACHINE_NO_REL 1