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]

[new patch] Re: Reloc BUG in as


> > > > > as sometimes does not create reloc entry. It is a bug. Tested on binutils
> > > > > 2.10.91.
> > > > 
> > > > Actually, it's the reverse, isn't it?  GAS should never create the
> > > > reloc for 'call a-b', since it can compute it correctly while assembling.
> > > 
> > > That is arguably true.  However, in that case gas needs to generate a
> > > call to the absolute address.  But it doesn't.  It generates a
> > > PC-relative call.
> > 
> > The real problem here is that
> > 
> >  call <absolute expression>
> > 
> > is not valid x86 assembly, where "valid 86 assembly" is as defined by
> > existing Unixware and other related AT&T derived x86 assemblers.
> > 
> > There was quite some discussion about this on the mailing lists (binutils
> > or gcc, I forget) around the time I made this patch:
> > 
> > 1999-09-13  Alan Modra  <alan@spri.levels.unisa.edu.au>
> > 
> > 	* config/tc-i386.c (md_assemble): Handle "jmp/call constant" as a
> > 	pc-relative jmp/call to an absolute symbol.
> > 
> > > There are two correct options: 1) generate a call to the absolute
> > > address; 2) generate a PC-relative call with a relocation which the
> > > linker will resolve to the absolute address. 
> > 
> > or 3) Revert above patch (which was to work around a gcc bug as mush as
> > anyting else), and error out.
> 
> No, I think that patch is the right thing to do.  It seems that it is
> not firing in every situation, though, since the original message has
> a test case which does not generate the expected relocation to the
> absolute symbol.

I created this patch - it handles that situation correctly. I don't see a
reason why pcrel should be discarded when you process difference of 2
symbols in the same segment. Maybe it breaks something else - the person
who wrote this part of code should check the patch.

Mikulas

--- gas/write.c_	Fri Mar  2 15:33:45 2001
+++ gas/write.c	Fri Mar  2 17:04:35 2001
@@ -2558,14 +2558,12 @@
 		S_GET_VALUE (sub_symbolP);
 
 	      add_symbolP = NULL;
-	      pcrel = 0;	/* No further pcrel processing.  */
 
 	      /* Let the target machine make the final determination
 		 as to whether or not a relocation will be needed to
 		 handle this fixup.  */
 	      if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
 		{
-		  fixP->fx_pcrel = 0;
 		  fixP->fx_addsy = NULL;
 		  fixP->fx_subsy = NULL;
 		}



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