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: [PATCH] gold: Add linker relaxation of tail calls on sparc.


From: Ian Lance Taylor <iant@google.com>
Date: Tue, 24 Apr 2012 14:57:54 -0700

>> +  call_insn = elfcpp::Swap<32, true>::readval(wv);
>> +  delay_insn = elfcpp::Swap<32, true>::readval(wv + 1);
> 
> It is possible that reading delay_insn is reading past the end of the
> section data.  Consider passing in view_size from the caller and
> verifying that rela.get_r_offset() + 8 <= view_size.

Good idea, I'll write down a TODO to add similar checks to the sparc
TLS relocation handling which does the same kind of delay slot access.

>> +  // Now check the branch distance.  We are called after the
>> +  // call has been relocated, so we just have to peek at the
>> +  // offset contained in the instruction.
>> +  off = call_insn & 0x3fffffff;
>> +  if ((off & 0x3fe00000)
>> +      && (off & 0x3fe00000) != 0x3fe00000)
>> +    return;
> 
> I think this is a little clearer if you write the explicit != 0.
> 
>   if ((off & 0x3fe00000) != 0
>       && (off & 0x3fe00000) != 0x3fe00000)

Ok.

> This is OK with those changes.

All done and committed, thanks Ian.


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