Skip to content

RISC-V: prepend --no-relax-gp to linker arguments - #162772

Open
TechnoPorg wants to merge 1 commit into
rust-lang:mainfrom
TechnoPorg:riscv-no-relax-gp
Open

TechnoPorg wants to merge 1 commit into
rust-lang:mainfrom
TechnoPorg:riscv-no-relax-gp

Conversation

@TechnoPorg

Copy link
Copy Markdown

As suggested in #t-compiler/linker > RISC-V global pointer relaxations, this prepends --no-relax-gp to the link args on RISC-V to be sure we're not performing global pointer relaxations on a target that may not support them. This is with the goal of eventually stabilizing the relax target feature, as afaict behaviour around gp is the remaining blocker.

I also have a branch where relax is enabled by default on these targets (#t-compiler/risc-v > Should `-C target-feature=+relax` become the default?), but the benefits are less clear-cut than I thought they would be, so this is a safer starting point.

In the future, this could be switched to --relax-gp on targets known to support global pointer relaxations. If people want to opt in (say, for a bare metal target where they've independently set up gp), they can just add -Clink-arg={-Wl,}--relax-gp.

r? wg-linker

@rustbot

rustbot commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2026
@rustbot

rustbot commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @mati865 (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • wg-linker expanded to davidlattimore, jyn514, madsmtm, mati865
  • Random selection from davidlattimore, mati865

@TechnoPorg

Copy link
Copy Markdown
Author

@rustbot label O-riscv

@rustbot rustbot added the O-riscv Target: RISC-V architecture label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-riscv Target: RISC-V architecture S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants