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

            Bug ID: 106338
           Summary: RISC-V static-chain register may be clobbered by PLT
                    stubs
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: funanzeng at gmail dot com
  Target Milestone: ---

In commit 09cae7507d9e88f2b05cf3a9404bf181e65ccbac, Palmer ported GCC to RISC-V
and t2 were chosen as the static chain register. However, when I supporting
this feature in LLVM(https://reviews.llvm.org/D129106), jrtc27 pointed out that
this issue.

In practice, static chain parameters are only used in Go and is always used
with closures, where the function pointer is already resolved. As a result,
this issue may not be triggered unless a user directly calls a foreign function
with a static chain parameter, and thus has not caused any problem.

FYI, in a recent change to the RISC-V ABI, STO_RISCV_VARIANT_CC was added to
support unknown ABI.

Reply via email to