[gold][PATCH] PR gold/17619: Check PC-relative offset overflow in PLT entry

H.J. Lu hjl.tools@gmail.com
Thu Nov 20 16:07:00 GMT 2014


On Wed, Nov 19, 2014 at 5:08 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 4:37 PM, Cary Coutant <ccoutant@google.com> wrote:
>>> +  // Check PC-relative offset overflow in PLT entry.
>>> +  bool gotplt_after_plt = got_address > plt_address;
>>> +  int32_t plt_got_pcrel_offset = (got_address + got_offset
>>> +                                 - (plt_address + plt_offset + 6));
>>> +  if ((gotplt_after_plt && plt_got_pcrel_offset < 0)
>>> +      || (!gotplt_after_plt && plt_got_pcrel_offset > 0))
>>> +    gold_error(_("PC-relative offset overflow in PLT entry"));
>>
>> It would be nice to print more information here. I think it's
>> next-to-impossible at this point to translate the PLT index into a
>
> I will update it.
>

Does this patch look OK? I got

./ld -shared -o libfoo.so gap.o foo.o
./ld: warning: overflow in PLT unwind data; unwinding through PLT may fail
./ld: error: PC-relative offset overflow in PLT entry 1
./ld: error: PC-relative offset overflow in PLT entry 2
make: *** [libfoo.so] Error 1

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-PC-relative-offset-overflow-in-PLT-entry.patch
Type: text/x-patch
Size: 1940 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20141120/d9fb83c0/attachment.bin>


More information about the Binutils mailing list