This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] Bug-compatibility with Sol* ld.so


Might this be related to these two:

http://gcc.gnu.org/ml/gcc-prs/2002-09/msg00614.html

(with follow-up http://gcc.gnu.org/ml/gcc-prs/2002-09/msg00632.html)

and

http://gcc.gnu.org/ml/gcc-testresults/2002-09/msg00768.html


/ChJ

-----Original Message-----
From: binutils-owner@sources.redhat.com
[mailto:binutils-owner@sources.redhat.com] On Behalf Of Jakub Jelinek
Sent: Tuesday, September 24, 2002 5:58 PM
To: binutils@sources.redhat.com
Subject: [PATCH] Bug-compatibility with Sol* ld.so


Hi!

Here is the patch I've just commited. It passed make check and manual
inspection with -Bsymbolic seemed ok too. Had to change glibc which
relied on this and will have to change prelink, argh.

2002-09-24  Jakub Jelinek  <jakub@redhat.com>

	* elf32-sparc.c (elf32_sparc_relocate_section): Put
R_SPARC_RELATIVE
	addend into r_addend, not *r_offset.
	(elf32_sparc_finish_dynamic_symbol): Likewise.
	* elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword
at
	R_SPARC_RELATIVE's r_offset.

--- bfd/elf32-sparc.c.jj	2002-07-30 16:14:55.000000000 +0200
+++ bfd/elf32-sparc.c	2002-09-23 16:40:53.000000000 +0200
@@ -1281,7 +1281,6 @@ elf32_sparc_relocate_section (output_bfd
 		off &= ~1;
 	      else
 		{
-		  bfd_put_32 (output_bfd, relocation, sgot->contents +
off);
 
 		  if (info->shared)
 		    {
@@ -1297,7 +1296,8 @@ elf32_sparc_relocate_section (output_bfd
 					 + sgot->output_offset
 					 + off);
 		      outrel.r_info = ELF32_R_INFO (0,
R_SPARC_RELATIVE);
-		      outrel.r_addend = 0;
+		      outrel.r_addend = relocation;
+		      relocation = 0;
 		      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
 						 (((Elf32_External_Rela
*)
 						   srelgot->contents)
@@ -1305,6 +1305,7 @@ elf32_sparc_relocate_section (output_bfd
 		      ++srelgot->reloc_count;
 		    }
 
+		  bfd_put_32 (output_bfd, relocation, sgot->contents +
off);
 		  local_got_offsets[r_symndx] |= 1;
 		}
 	    }
@@ -1810,14 +1811,21 @@ elf32_sparc_finish_dynamic_symbol (outpu
       if (info->shared
 	  && (info->symbolic || h->dynindx == -1)
 	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
-	rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
+	{
+	  asection *sec = h->root.u.def.section;
+	  rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
+	  rela.r_addend = (h->root.u.def.value
+			   + sec->output_section->vma
+			   + sec->output_offset);
+	}
       else
 	{
-	  bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents +
h->got.offset);
 	  rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
+	  rela.r_addend = 0;
 	}
 
-      rela.r_addend = 0;
+      bfd_put_32 (output_bfd, (bfd_vma) 0,
+		  sgot->contents + (h->got.offset &~ (bfd_vma) 1));
       bfd_elf32_swap_reloca_out (output_bfd, &rela,
 				 ((Elf32_External_Rela *)
srela->contents
 				  + srela->reloc_count));
--- bfd/elf64-sparc.c.jj	2002-07-30 16:14:56.000000000 +0200
+++ bfd/elf64-sparc.c	2002-09-24 15:12:21.000000000 +0200
@@ -2727,11 +2727,12 @@ sparc64_elf_finish_dynamic_symbol (outpu
 	}
       else
 	{
-	  bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents +
h->got.offset);
 	  rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
 	  rela.r_addend = 0;
 	}
 
+      bfd_put_64 (output_bfd, (bfd_vma) 0,
+		  sgot->contents + (h->got.offset &~ (bfd_vma) 1));
       bfd_elf64_swap_reloca_out (output_bfd, &rela,
 				 ((Elf64_External_Rela *)
srela->contents
 				  + srela->reloc_count));

	Jakub



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