This is the mail archive of the binutils@sourceware.org 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: [committed] Ensure pc-relative calls can reach their target on hppa64


I noticed in comparing the code in elf32-hppa.c to the new code that I
added for the branch offset check, that the offset calculation was off
by eight bytes.  The enclosed change fixes that error.

Tested on hppa64-hp-hpux11.11 and committed to trunk.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2009-02-15  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* elf-hppa.h (elf_hppa_final_link_relocate): Correct addend value used
	in branch offset check.

Index: elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.90
diff -u -3 -p -r1.90 elf-hppa.h
--- elf-hppa.h	25 Jan 2009 23:05:20 -0000	1.90
+++ elf-hppa.h	14 Feb 2009 16:40:02 -0000
@@ -1684,6 +1684,7 @@ elf_hppa_final_link_relocate (Elf_Intern
 	/* Turn VALUE into a proper PC relative address.  */
 	value -= (offset + input_section->output_offset
 		  + input_section->output_section->vma);
+	addend -= 8;
 
 	if (r_type == (unsigned int) R_PARISC_PCREL22F)
 	  max_branch_offset = (1 << (22-1)) << 2;
@@ -1708,9 +1709,9 @@ elf_hppa_final_link_relocate (Elf_Intern
 
 	/* Adjust for any field selectors.  */
 	if (r_type == R_PARISC_PCREL17R)
-	  value = hppa_field_adjust (value, -8 + addend, e_rsel);
+	  value = hppa_field_adjust (value, addend, e_rsel);
 	else
-	  value = hppa_field_adjust (value, -8 + addend, e_fsel);
+	  value = hppa_field_adjust (value, addend, e_fsel);
 
 	/* All branches are implicitly shifted by 2 places.  */
 	value >>= 2;


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