This is the mail archive of the 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] GAS: .reloc: Avoid lost addend in converted relocs

On Wed, 29 May 2013, Alan Modra wrote:

> >  	      if (S_IS_LOCAL (sym) && !symbol_section_p (sym)
> > -		  && !(howto->partial_inplace
> > -		       && howto->pc_relative
> > -		       && howto->src_mask != addr_mask))
> > +		  && (sec->use_rela_p
> > +		      || (howto->partial_inplace
> > +			  && (!howto->pc_relative
> > +			      || howto->src_mask == addr_mask))))
> This change doesn't make sense to me.  Before, you excluded a specific
> set of partial_inplace relocs, now you say any partial_inplace is good?

 Not really.  Before, I excluded a specific set of partial_inplace relocs 
(pc_relative, with a narrow relocatable field), now I exclude that set 
only on !use_rela_p targets.  Plus any !partial_inplace relocs on such 
targets.  This is because in both cases there is no room to store an 
addend (on !use_rela_p targets).

 My understanding is partial_inplace is meaningless on use_rela_p targets 
(and should be clear in all reloc howto tables, though there may be copy & 
paste bugs there), because these targets always use the reloc itself to 
store the addend.  Therefore the reloc can always be converted on such 
targets and we don't have to check this flag on them.

> Maybe what you really want here is:
> 		  && (sec->use_rela_p
> 		      || howto->src_mask == addr_mask))

 Nope, this would prevent !pc_relative relocs from being converted -- 
which we want to do to get a reloc overflow error elsewhere at the 
assembly stage rather than at the link stage if the addend overflows the 
relocatable field this early already.

 Have I made my intent clear enough to you now?


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