feat(asm): emit the riscv64 local-exec TLS sequence

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:51:02 +02:00
1 parent f8dbd4f017
commit f2892e4f59
6 files changed
+114 -29

No files matched your search

+5 -1
View File
@@ -30,6 +30,8 @@ func (img *Image) GOObjectRISCV(pkgPath, srcPath string) ([]byte, error) {
return relocRISCVPcrelStype, 8
case RelRISCVJal:
return relocRISCVJal, 4
case RelRISCVTLSLE:
return relocRISCVTLSLE, 8
default:
return relocRISCVPcrelItype, 8
}
@@ -38,11 +40,13 @@ func (img *Image) GOObjectRISCV(pkgPath, srcPath string) ([]byte, error) {
// RISC-V relocation types (cmd/internal/objabi). The Go linker applies
// R_RISCV_PCREL_ITYPE/STYPE to an AUIPC + I/S-type instruction pair as a
// single 8-byte field; R_RISCV_JAL covers a single 4-byte J-type instruction.
// single 8-byte field; R_RISCV_JAL covers a single 4-byte J-type instruction;
// R_RISCV_TLS_LE covers the LUI + I-type pair of a local-exec TLS reference.
const (
relocRISCVJal = 59 // R_RISCV_JAL
relocRISCVPcrelItype = 62 // R_RISCV_PCREL_ITYPE
relocRISCVPcrelStype = 63 // R_RISCV_PCREL_STYPE
relocRISCVTLSLE = 65 // R_RISCV_TLS_LE
)
// toolchainObjectPreambleRISCV returns the "go object ...\n!\n" header