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

            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 platforms
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 address
and can't go through a lazy resolver, rather than a PLT-like reference that
might.

Reply via email to