https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

--- Comment #9 from shorne at gmail dot com ---
I was able to debug this.

Basically, the code to avoid overflow by masking the relocation value with
0xffff fails if the relocation value has the 16-bit sign bit set. I.e. 0x90e4
has 0x8000 set when we see the overflow message.

It seems the number of GOT relocations in libgeos as gone beyond this limit and
triggered this bug.

This is an oversite and needs a further patch to OpenRISC binutils.  I will
think about how to patch it and post a patch in a few days


DEBUG:

x   1184          status = bfd_check_overflow (howto->complain_on_overflow,
x   1185                                       howto->bitsize,
x   1186                                       howto->rightshift,
x   1187                                       bfd_arch_bits_per_address
(input_bfd),
x   1188                                       value);
x   1189          value >>= howto->rightshift;
x   1190
x   1191          /* If we're overwriting the entire destination,
x   1192             then no need to read the current contents.  */
x  >1193          if (size == 0 || howto->dst_mask == N_ONES (size))
x   1194            x = 0;
x   1195          else
x   1196            {
x   1197              BFD_ASSERT (size == 4);
x   1198              x = bfd_get_32 (input_bfd, contents + offset);
x   1199            }
x   1200
x   1201          switch (howto->type)
x   1202            {
x   1203            case R_OR1K_SLO16:
x   1204            case R_OR1K_GOTOFF_SLO16:
x   1205            case R_OR1K_TLS_LE_SLO16:

native process 3648008 In: or1k_final_link_relocate                 L1193 PC:
0x43afb3
(gdb) n
or1k_final_link_relocate (howto=howto@entry=0x50fff0
<or1k_elf_howto_table+560>, input_bfd=input_bfd@entry=0x57ac90,
input_section=input_section@entry=0x593fb8,
    contents=contents@entry=0xb3e17b0 "\234!\377\374\030`", offset=68,
value=37092) at elf32-or1k.c:1189
(gdb) p status
$3 = bfd_reloc_overflow
(gdb) p/x value
$4 = 0x90e4

On Fri, Dec 31, 2021 at 11:26:06AM +0000, giulio.benetti at benettiengineering
dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

Reply via email to