crt/ssp: fix stack smashing protection bootstrapping
Fix stack protection bootstrapping issue where the guard initialization
function itself triggers false positive stack overflow detection.
This issue occurs when the mingw-w64 CRT library is built with GCC's
-fstack-protector-strong flag, which effectively renders any resulting
binary (whether statically or dynamically linked) corrupted. The final
binary crashes during startup, before it even reaches the main function.
The problem is that the init() function starts with __stack_chk_guard = 0
but initializes it to a random value, causing the stack protection check
to always fail (0 != random) at function exit.
By introducing attribute __no_stack_protector__ we prevent early testing
of the uninitialized guard value.
Signed-off-by: Igor Kostenko <work.kerogi@gmail.com>
1 file changed