Landing: 976bba902f3a
Project / Subsystem
gcc / risc-v
Date
2026-05-09
Author
Michiel Derhaeg
Commit
976bba902f3a8146b7ca5b352795977bc9179132
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- risc-v
- patch_id
- —
- commit_hash
- 976bba902f3a8146b7ca5b352795977bc9179132
- source_type
- github
- headline
- RISC-V: No Longer Emit cm.popret When zcmp + zicfiss Is Enabled
- tldr
- GCC now uses cm.pop + sspopchk + a regular return instead of cm.popret when both zcmp and zicfiss are enabled, for better shadow stack management.
- author
- Michiel Derhaeg
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • risc-v
- • security
- • shadow stack
- • code generation
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-09T00:00:00.000Z
When -fcf-protection=return and zcmp are enabled, GCC previously generated cm.popret instructions, which skip emitting sspopchk. This commit replaces cm.popret with cm.pop + sspopchk + jr ra, ensuring sspopchk is always emitted for improved security with shadow stacks. The change was regtested for rv32g and rv64g.