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]

[PATCH] R_ALPHA_RELATIVE addend


On Fri, Aug 31, 2001 at 10:57:44AM -0700, Ulrich Drepper wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > But unless it is for RTLD_BOOTSTRAP only (in which case you know how ld.so
> > has been linked),
> 
> Why?  There are two different pieces of code handling _RELATIVE
> relocations depending on whether DT_RELACOUNT is available.
> 
> The code in elf_machine_rela would stay as it is.  The code in
> elf_machine_rela_relative can use the addend.

Ok, then it should be done now or very RSN (we already have several
bins/libs with DT_RELACOUNT for alpha out there), provided Richard decides
to do that.
Here is what I think should be changed in bfd, so that R_ALPHA_RELATIVE's
r_addend is equal to the memory location after linking.

2001-08-31  Jakub Jelinek  <jakub@redhat.com>

	* bfd/elf64-alpha.c (elf64_alpha_relocate_section): Duplicate memory
	value into R_ALPHA_RELATIVE's addend.
	(elf64_alpha_finish_dynamic_symbol): Likewise.

--- elf64-alpha.c.jj	Fri Aug 31 20:10:45 2001
+++ elf64-alpha.c	Fri Aug 31 20:16:32 2001
@@ -3613,7 +3613,7 @@ elf64_alpha_relocate_section (output_bfd
 				       + sgot->output_offset
 				       + gotent->got_offset);
 		    outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
-		    outrel.r_addend = 0;
+		    outrel.r_addend = relocation + addend;
 
 		    bfd_elf64_swap_reloca_out (output_bfd, &outrel,
 					       ((Elf64_External_Rela *)
@@ -3678,7 +3678,7 @@ elf64_alpha_relocate_section (output_bfd
 	    else if (info->shared && (input_section->flags & SEC_ALLOC))
 	      {
 		outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
-		outrel.r_addend = 0;
+		outrel.r_addend = relocation + addend;
 	      }
 	    else
 	      goto default_reloc;
@@ -3871,7 +3871,7 @@ elf64_alpha_finish_dynamic_symbol (outpu
 				     + sgot->output_offset
 				     + gotent->got_offset);
 		  outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
-		  outrel.r_addend = 0;
+		  outrel.r_addend = plt_addr;
 
 		  bfd_elf64_swap_reloca_out (output_bfd, &outrel,
 					     ((Elf64_External_Rela *)


	Jakub


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