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


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

[PATCH] Handle R_SPARC_UA{16,32} in ld.so


On Fri, Jun 29, 2001 at 02:22:00PM -0700, David S. Miller wrote:
> 
> Ian Lance Taylor writes:
>  > Jakub Jelinek <jakub@redhat.com> writes:
>  > > As far as glibc is concerned, if you show me a real-world DSO which really
>  > > needs R_SPARC_UA16 or R_SPARC_UA32, then I'll happily add those relocs to
>  > > sparc/sparc32/dl-machine.h, but the libstdc++ Artur mailed me had just
>  > > R_SPARC_UA32 with all r_offsets divisible by 4.
>  > 
>  > Do it now.  Why wait until somebody has trouble?  It's probably easy
>  > to create a C test case using attribute((__packed__)).
> 
> Jakub, Ian is right.  Even though such examples are silly, they are
> technically legal.

Agreed.
Uli, can you please check this in?

2001-07-02  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Handle
	R_SPARC_UA16 and R_SPARC_UA32.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise.

--- libc/sysdeps/sparc/sparc32/dl-machine.h.jj	Mon Mar 12 10:56:20 2001
+++ libc/sysdeps/sparc/sparc32/dl-machine.h	Mon Jul  2 13:30:09 2001
@@ -434,6 +434,16 @@ elf_machine_rela (struct link_map *map, 
 	case R_SPARC_HI22:
 	  *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
 	  break;
+	case R_SPARC_UA16:
+	  ((unsigned char *) reloc_addr) [0] = value >> 8;
+	  ((unsigned char *) reloc_addr) [1] = value;
+	  break;
+	case R_SPARC_UA32:
+	  ((unsigned char *) reloc_addr) [0] = value >> 24;
+	  ((unsigned char *) reloc_addr) [1] = value >> 16;
+	  ((unsigned char *) reloc_addr) [2] = value >> 8;
+	  ((unsigned char *) reloc_addr) [3] = value;
+	  break;
 #endif
 	case R_SPARC_NONE:		/* Alright, Wilbur.  */
 	  break;
--- libc/sysdeps/sparc/sparc64/dl-machine.h.jj	Sat May  5 15:47:37 2001
+++ libc/sysdeps/sparc/sparc64/dl-machine.h	Mon Jul  2 13:29:03 2001
@@ -338,6 +338,16 @@ elf_machine_rela (struct link_map *map, 
 	  elf_machine_fixup_plt(map, 0, reloc, reloc_addr, value);
 	  break;
 #ifndef RTLD_BOOTSTRAP
+	case R_SPARC_UA16:
+	  ((unsigned char *) reloc_addr) [0] = value >> 8;
+	  ((unsigned char *) reloc_addr) [1] = value;
+	  break;
+	case R_SPARC_UA32:
+	  ((unsigned char *) reloc_addr) [0] = value >> 24;
+	  ((unsigned char *) reloc_addr) [1] = value >> 16;
+	  ((unsigned char *) reloc_addr) [2] = value >> 8;
+	  ((unsigned char *) reloc_addr) [3] = value;
+	  break;
 	case R_SPARC_UA64:
 	  if (! ((long) reloc_addr & 3))
 	    {


	Jakub


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