Landing: c05b5e5d8cb6

Project / Subsystem

gcc / c/c++

Date

2025-09-13

Author

H.J. Lu

Commit

c05b5e5d8cb660ed43159d66fd669c20746d6bea

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c/c++
patch_id
commit_hash
c05b5e5d8cb660ed43159d66fd669c20746d6bea
source_type
github
headline
C/C++: Enable user-defined stack protection guard symbols.
tldr
This change allows users to define the stack protection guard as a global symbol, and merges it if it matches the compiler's internal symbol.
author
H.J. Lu
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c
  • c++
  • security
  • stack protection
  • ssp
discussion_id_link
bugzilla_pr
date
2025-09-13T00:00:00.000Z

This commit introduces a new target hook, stack_protect_guard_symbol_p, which allows users to define their own stack protection guard as a global symbol. If the hook returns true, the compiler declares __stack_chk_guard as a global uintptr_t variable and merges it with the user-declared variable if they match, including its visibility attribute. This enables more flexible stack protection schemes.