From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4B4163858D28; Sat, 1 Jan 2022 07:23:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B4163858D28 From: "shorne at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99783] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos Date: Sat, 01 Jan 2022 07:23:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: shorne at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: shorne at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2022 07:23:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99783 --- 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. 0x90= e4 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 =3D bfd_check_overflow (howto->complain_on_overflo= w, x 1185 howto->bitsize, x 1186 howto->rightshift, x 1187 bfd_arch_bits_per_address (input_bfd), x 1188 value); x 1189 value >>=3D 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 =3D=3D 0 || howto->dst_mask =3D=3D N_ONES (size)) x 1194 x =3D 0; x 1195 else x 1196 { x 1197 BFD_ASSERT (size =3D=3D 4); x 1198 x =3D 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 P= C: 0x43afb3 (gdb) n or1k_final_link_relocate (howto=3Dhowto@entry=3D0x50fff0 , input_bfd=3Dinput_bfd@entry=3D0x57ac90, input_section=3Dinput_section@entry=3D0x593fb8, contents=3Dcontents@entry=3D0xb3e17b0 "\234!\377\374\030`", offset=3D68, value=3D37092) at elf32-or1k.c:1189 (gdb) p status $3 =3D bfd_reloc_overflow (gdb) p/x value $4 =3D 0x90e4 On Fri, Dec 31, 2021 at 11:26:06AM +0000, giulio.benetti at benettiengineer= ing dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99783=