8 #if defined(__AMDGCN__) || defined(__nvptx__)
9 /* Global constructors not supported on this target, yet. */
10 uintptr_t __stack_chk_guard
= 0x00000aff; /* 0, 0, '\n', 255 */
13 uintptr_t __stack_chk_guard
= 0;
16 __attribute__((__constructor__
))
17 __stack_chk_init (void)
19 if (__stack_chk_guard
!= 0)
22 #if defined(__CYGWIN__) || defined(__rtems__)
23 arc4random_buf(&__stack_chk_guard
, sizeof(__stack_chk_guard
));
25 /* If getentropy is not available, use the "terminator canary". */
26 ((unsigned char *)&__stack_chk_guard
)[0] = 0;
27 ((unsigned char *)&__stack_chk_guard
)[1] = 0;
28 ((unsigned char *)&__stack_chk_guard
)[2] = '\n';
29 ((unsigned char *)&__stack_chk_guard
)[3] = 255;
35 __attribute__((__noreturn__
))
36 __stack_chk_fail (void)
38 char msg
[] = "*** stack smashing detected ***: terminated\n";
39 write (2, msg
, strlen (msg
));
46 __attribute__((visibility ("hidden")))
47 __stack_chk_fail_local (void)