[PATCH v4] RISC-V: Add new relocation types for global array accesses with non-constant indices

Project / Subsystem

binutils / risc-v

Date

2026-07-30

Proposer

Liqin Weng <wengliqin@linux.spacemit.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

—/10

All attributes

project
binutils
subsystem
risc-v
patch_id
—
discussion_id
20260730010330.4124332-1-wengliqin@linux.spacemit.com
source_type
public_inbox
title
[PATCH v4] RISC-V: Add new relocation types for global array accesses with non-constant indices
headline
RISC-V: Add new relocation types for global array accesses with non-constant indices
tldr
Introduces new RISC-V relocation types (R_RISCV_BASE_IDX_*) for efficient global array access with non-constant indices.
proposer
Liqin Weng <wengliqin@linux.spacemit.com>
consensus
Proposed
outcome
proposed
sentiment_score
—
technical_tradeoffs
[]
series_id
—
series_role
standalone
series_parts
[]
tags
  • • binutils
  • • risc-v
  • • relocation
  • • compiler
bugzilla_url
—
date
2026-07-30T00:00:00.000Z

[PATCH v4] RISC-V: Add new relocation types for global array accesses with non-constant indices

This patch introduces support for new RISC-V relocation types, specifically R_RISCV_BASE_IDX_LO12, R_RISCV_BASE_IDX_LO12_S, and R_RISCV_BASE_IDX_ADD. These are designed to enable more efficient code generation for accessing global arrays when the array subscripts are not constant, aligning with the RISC-V PSABI specification.