This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Remove unneeded relocation handling for sparc RTLD_BOOTSTRAP


Hi!

We only need R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT, R_SPARC_RELATIVE and
perhaps R_SPARC_NONE for ld.so, so we can ifdef out the rest of the rela
handling...

2000-11-23  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/sparc/sparc32/dl-machine.h: Ifdef out handling for relocs
	which never occur during bootstrap.
	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.

--- libc/sysdeps/sparc/sparc32/dl-machine.h.jj	Mon Nov 20 13:48:40 2000
+++ libc/sysdeps/sparc/sparc32/dl-machine.h	Thu Nov 23 13:48:14 2000
@@ -377,6 +377,7 @@ elf_machine_rela (struct link_map *map, 
 
       switch (ELF32_R_TYPE (reloc->r_info))
 	{
+#ifndef RTLD_BOOTSTRAP
 	case R_SPARC_COPY:
 	  if (sym == NULL)
 	    /* This can happen in trace mode if an object could not be
@@ -397,6 +398,7 @@ elf_machine_rela (struct link_map *map, 
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
 	  break;
+#endif
 	case R_SPARC_GLOB_DAT:
 	case R_SPARC_32:
 	  *reloc_addr = value;
@@ -404,6 +406,7 @@ elf_machine_rela (struct link_map *map, 
 	case R_SPARC_JMP_SLOT:
 	  elf_machine_fixup_plt(map, 0, reloc, reloc_addr, value);
 	  break;
+#ifndef RTLD_BOOTSTRAP
 	case R_SPARC_8:
 	  *(char *) reloc_addr = value;
 	  break;
@@ -429,11 +432,14 @@ elf_machine_rela (struct link_map *map, 
 	case R_SPARC_HI22:
 	  *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
 	  break;
+#endif
 	case R_SPARC_NONE:		/* Alright, Wilbur.  */
 	  break;
+#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
 	default:
 	  _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0);
 	  break;
+#endif
 	}
     }
 }
--- libc/sysdeps/sparc/sparc64/dl-machine.h.jj	Mon Nov 20 13:48:40 2000
+++ libc/sysdeps/sparc/sparc64/dl-machine.h	Thu Nov 23 13:55:35 2000
@@ -212,6 +212,7 @@ elf_machine_rela (struct link_map *map, 
 
       switch (ELF64_R_TYPE_ID (reloc->r_info))
 	{
+#ifndef RTLD_BOOTSTRAP
 	case R_SPARC_COPY:
 	  if (sym == NULL)
 	    /* This can happen in trace mode if an object could not be
@@ -232,11 +233,12 @@ elf_machine_rela (struct link_map *map, 
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
 	  break;
-
+#endif
 	case R_SPARC_64:
 	case R_SPARC_GLOB_DAT:
 	  *reloc_addr = value;
 	  break;
+#ifndef RTLD_BOOTSTRAP
 	case R_SPARC_8:
 	  *(char *) reloc_addr = value;
 	  break;
@@ -311,11 +313,11 @@ elf_machine_rela (struct link_map *map, 
 	    ((*(unsigned int *)reloc_addr & 0xffc00000) |
 	     ((value >> 10) & 0x003fffff));
 	  break;
-
+#endif
 	case R_SPARC_JMP_SLOT:
 	  elf_machine_fixup_plt(map, 0, reloc, reloc_addr, value);
 	  break;
-
+#ifndef RTLD_BOOTSTRAP
 	case R_SPARC_UA64:
 	  if (! ((long) reloc_addr & 3))
 	    {
@@ -333,10 +335,12 @@ elf_machine_rela (struct link_map *map, 
 	  ((unsigned char *) reloc_addr) [6] = value >> 8;
 	  ((unsigned char *) reloc_addr) [7] = value;
 	  break;
-
+#endif
+#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
 	default:
 	  _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0);
 	  break;
+#endif
 	}
     }
 }

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]