From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 687C53836C62; Tue, 9 Mar 2021 18:03:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 687C53836C62 From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99491] New: [mips64] over-strict refusal to emit tail calls Date: Tue, 09 Mar 2021 18:03:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Tue, 09 Mar 2021 18:03:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99491 Bug ID: 99491 Summary: [mips64] over-strict refusal to emit tail calls Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bugdal at aerifal dot cx Target Milestone: --- mips_function_ok_for_sibcall refuses to generate sibcalls (except locally) = on mips64 due to %gp being call-saved and the possibility that the callee is a lazy resolver stub. This is presumably correct-ish on dynamic-linked platfo= rms with lazy resolver, due to the resolver using the caller's value of %gp, but completely gratuitous on platforms that are static linked or don't use lazy resolver, such as musl libc. Moreover, the problem could be fixed even for lazy-resolver targets by generating an indirect function call reference that forcibly loads the addr= ess and can't go through a lazy resolver, rather than a PLT-like reference that might.=