[PATCH] alpha: don't delete a caller's gp reload after a call
Project / Subsystem
binutils / alpha
Date
2026-08-14
Proposer
Matt Turner <mattst88@gmail.com>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Ensuring correct program behavior and preventing crashes by retaining GP reloads vs. a potential (though minimal in this case) code size increase by not optimizing away instructions that were previously deemed redundant.
All attributes
- project
- binutils
- subsystem
- alpha
- patch_id
- —
- discussion_id
- 20260814192712.1016834-1-mattst88@gmail.com
- source_type
- public_inbox
- title
- [PATCH] alpha: don't delete a caller's gp reload after a call
- headline
- alpha: Don't delete caller's gp reload after call
- tldr
- Fixes a bug in Alpha relaxation where deleting a GP reload after a call can lead to incorrect GP values and crashes, especially in multi-sub-GOT scenarios.
- proposer
- Matt Turner <mattst88@gmail.com>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Ensuring correct program behavior and preventing crashes by retaining GP reloads vs. a potential (though minimal in this case) code size increase by not optimizing away instructions that were previously deemed redundant.
- series_id
- —
- series_role
- standalone
- series_parts
- []
- tags
-
- • alpha
- • linker
- • optimization
- • GP
- • bug fix
- bugzilla_url
- —
- date
- 2026-08-14T00:00:00.000Z
[PATCH] alpha: don't delete a caller's gp reload after a call
This patch corrects an optimization in the Alpha linker’s relaxation process that incorrectly deleted a GP reload instruction. The optimization was applied when a function call was followed by specific instructions, assuming the callee would preserve the caller’s GP. However, this assumption fails in cases involving tail calls or when the callee resides in a different GOT subsection, leading to the caller resuming with an incorrect GP. This can cause runtime crashes, particularly when indirect calls jump through corrupted GOT entries. The patch retains the GP reload instruction to ensure correct GP values are maintained.