[go] cmd/internal/obj/riscv: add support for compressed instructions

1 view
Skip to first unread message

Joel Sing (Gerrit)

unread,
Nov 18, 2025, 2:33:45 AM (3 days ago) Nov 18
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Junyang Shao, Mark Freeman, Mark Ryan, Go LUCI, Cherry Mui, Meng Zhuo, golang-co...@googlegroups.com

Joel Sing submitted the change

Change information

Commit message:
cmd/internal/sys,internal/goarch,runtime: enable the use of compressed instructions on riscv64

Enable the use of compressed instructions on riscv64 by reducing
the PC quantum to two bytes and reducing the minimum instruction
length to two bytes. Change gostartcall on riscv64 to land at
two times the PC quantum into goexit, so that we retain four byte
alignment and revise the NOP instructions in goexit to ensure that
they are never compressed. Additionally, adjust PCALIGN so that it
correctly handles two byte offsets.

Fixes #47560
Updates #71105
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I4329a8fbfcb4de636aadaeadabb826bc22698640
Reviewed-by: Junyang Shao <shaoj...@google.com>
Reviewed-by: Mark Freeman <markf...@google.com>
Reviewed-by: Mark Ryan <mark...@rivosinc.com>
Files:
  • M src/cmd/internal/obj/riscv/obj.go
  • M src/cmd/internal/sys/arch.go
  • M src/internal/goarch/goarch_riscv64.go
  • M src/runtime/asm_riscv64.s
  • M src/runtime/sys_riscv64.go
Change size: S
Delta: 5 files changed, 25 insertions(+), 11 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Mark Freeman, +2 by Mark Ryan, +1 by Junyang Shao
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4329a8fbfcb4de636aadaeadabb826bc22698640
Gerrit-Change-Number: 523477
Gerrit-PatchSet: 12
Gerrit-Owner: Joel Sing <jo...@sing.id.au>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Joel Sing <jo...@sing.id.au>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Mark Ryan <mark...@rivosinc.com>
Gerrit-Reviewer: Meng Zhuo <mengzh...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages