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]

Re: tc-hppa.c SOM and branch limit fixes


On Thu, 28 Sep 2000, John David Anglin wrote:

>     # Test for an off-by-2 bug in range check for conditional branches
>     gas_test_error "brlenbug.s" "" "Check for error(s) in branch length"
> 
> in unsorted.exp now fails, probably due the change in calculating branch
> limits.

Yes, I know.  Sourceware hasn't been responding for me, so I haven't benn
able to check in a fix.  The new code spits out a reloc for the out of
range branch, but it's against a local sym and thus gets converted to a
reloc against $CODE$.  At the moment, the assembler doesn't add in the
local symbol offset from the start of $CODE$, so this fails badly.  In any
case, having a reloc for SOM isn't much use as the HP SOM linker doesn't
create long branch stubs.

gas/ChangeLog
	* config/tc-hppa.c (hppa_force_relocation): If OBJ_SOM, don't
	force relocs for 12 bit branches.
	(md_apply_fix): Similarly, adjust logic here.

Index: config/tc-hppa.c
===================================================================
RCS file: /home/cvs/parisc/binutils/gas/config/tc-hppa.c,v
retrieving revision 1.24
diff -u -p -r1.24 tc-hppa.c
--- tc-hppa.c	2000/09/27 16:51:57	1.24
+++ tc-hppa.c	2000/09/28 03:38:30
@@ -4422,9 +4422,15 @@ md_apply_fix (fixP, valp)
 	  && fixP->fx_pcrel
 	  && !arg_reloc_stub_needed (symbol_arg_reloc_info (fixP->fx_addsy),
 				     hppa_fixP->fx_arg_reloc)
-	  && ((*valp - 8 + 8192) < 16384
-	      || (fmt == 17 && (*valp - 8 + 262144) < 524288)
-	      || (fmt == 22 && (*valp - 8 + 8388608) < 16777216))
+#ifdef OBJ_ELF
+	  && (*valp - 8 + 8192 < 16384
+	      || (fmt == 17 && *valp - 8 + 262144 < 524288)
+	      || (fmt == 22 && *valp - 8 + 8388608 < 16777216))
+#endif
+#ifdef OBJ_SOM
+	  && (*valp - 8 + 262144 < 524288
+	      || (fmt == 22 && *valp - 8 + 8388608 < 16777216))
+#endif
 	  && !S_IS_EXTERNAL (fixP->fx_addsy)
 	  && !S_IS_WEAK (fixP->fx_addsy)
 	  && S_GET_SEGMENT (fixP->fx_addsy) == hppa_fixP->segment
@@ -8467,7 +8473,10 @@ hppa_force_relocation (fixp)
 		  - md_pcrel_from (fixp) - 8);
       if (distance + 8388608 >= 16777216
 	  || (hppa_fixp->fx_r_format == 17 && distance + 262144 >= 524288)
-	  || (hppa_fixp->fx_r_format == 12 && distance + 8192 >= 16384))
+#ifdef OBJ_ELF
+	  || (hppa_fixp->fx_r_format == 12 && distance + 8192 >= 16384)
+#endif
+	  )
 	return 1;
     }
 
-- 
Linuxcare.  Support for the Revolution.


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