]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c/c++: Declare stack protection guard as a global symbol
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 13 Sep 2025 01:52:39 +0000 (18:52 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 4 May 2026 22:01:23 +0000 (06:01 +0800)
Add a new target hook, stack_protect_guard_symbol_p, to support the user
provided stack protection guard as a global symbol.  If the hook returns
true,

1. Declare __stack_chk_guard as a global uintptr_t variable so that it
can be initialized as an integer.
2. If the user declared variable matches __stack_chk_guard, merge it with
__stack_chk_guard, including its visibility attribute.

gcc/

PR c/121911
* target.def (stack_protect_guard_symbol_p): New target hook.
* targhooks.cc (default_stack_protect_guard): Use the type of
uintptr_t, instead of ptr_type_node, if the
stack_protect_guard_symbol_p hook returns true.
* config/i386/i386.cc (ix86_stack_protect_guard_symbol_p): New.
(TARGET_STACK_PROTECT_GUARD_SYMBOL_P): Likewise.
* doc/tm.texi: Regenerated.
* doc/tm.texi.in (TARGET_STACK_PROTECT_GUARD_SYMBOL_P): New.

gcc/c-family/

PR c/121911
* c-common.cc (c_common_nodes_and_builtins): If the
stack_protect_guard_symbol_p hook returns true, declare a global
symbol for stack protection guard.

gcc/testsuite/

PR c/121911
* g++.target/i386/ssp-global-1.C: New test.
* g++.target/i386/ssp-global-2.C: Likewise.
* g++.target/i386/ssp-global-3.C: Likewise.
* g++.target/i386/ssp-global-hidden-1.C: Likewise.
* g++.target/i386/ssp-global-hidden-2.C: Likewise.
* g++.target/i386/ssp-global-hidden-3.C: Likewise.
* gcc.target/i386/ssp-global-2.c: Likewise.
* gcc.target/i386/ssp-global-3.c: Likewise.
* gcc.target/i386/ssp-global-4.c: Likewise.
* gcc.target/i386/ssp-global-hidden-1.c: Likewise.
* gcc.target/i386/ssp-global-hidden-2.c: Likewise.
* gcc.target/i386/ssp-global-hidden-3.c: Likewise.
* gcc.target/i386/ssp-global.c: Include <stdint.h>.
(__stack_chk_guard): Change its type to uintptr_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
19 files changed:
gcc/c-family/c-common.cc
gcc/config/i386/i386.cc
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/target.def
gcc/targhooks.cc
gcc/testsuite/g++.target/i386/ssp-global-1.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/ssp-global-2.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/ssp-global-3.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/ssp-global-hidden-1.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/ssp-global-hidden-2.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/ssp-global-hidden-3.C [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-hidden-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-hidden-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global-hidden-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ssp-global.c

index dcbf5192fc1604de3718be1ec4ee8bc5637c33f3..2bf71e540451cd44ece587725f744afaa549e38d 100644 (file)
@@ -4927,6 +4927,11 @@ c_common_nodes_and_builtins (void)
        }
     }
 
+  /* Call the target stack_protect_guard hook if the stack protection
+     guard is declared as a global symbol.  */
+  if (targetm.stack_protect_guard_symbol_p ())
+    lang_hooks.decls.pushdecl (targetm.stack_protect_guard ());
+
   if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
     {
       va_list_arg_type_node = va_list_ref_type_node =
index 15c2d631635b0d32ee58ebda6e0f175664168b97..e73c2d7f7d04c9096514371f12eb885e3a37aa42 100644 (file)
@@ -25524,6 +25524,14 @@ ix86_stack_protect_guard (void)
   return default_stack_protect_guard ();
 }
 
+/* Implement TARGET_STACK_PROTECT_GUARD_SYMBOL_P.  */
+
+static bool
+ix86_stack_protect_guard_symbol_p (void)
+{
+  return TARGET_SSP_GLOBAL_GUARD;
+}
+
 static bool
 ix86_stack_protect_runtime_enabled_p (void)
 {
@@ -28539,6 +28547,10 @@ ix86_libgcc_floating_mode_supported_p
 #undef TARGET_STACK_PROTECT_GUARD
 #define TARGET_STACK_PROTECT_GUARD ix86_stack_protect_guard
 
+#undef TARGET_STACK_PROTECT_GUARD_SYMBOL_P
+#define TARGET_STACK_PROTECT_GUARD_SYMBOL_P \
+  ix86_stack_protect_guard_symbol_p
+
 #undef TARGET_STACK_PROTECT_RUNTIME_ENABLED_P
 #define TARGET_STACK_PROTECT_RUNTIME_ENABLED_P \
   ix86_stack_protect_runtime_enabled_p
index 2832a447e3ee1a8f6ea7880de2737ee8d1ed0949..a4ae17decb07bfab096d11ba41958fd87a976dff 100644 (file)
@@ -5426,6 +5426,13 @@ The default version of this hook creates a variable called
 @samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_STACK_PROTECT_GUARD_SYMBOL_P (void)
+Usually, the compiler uses an external variable @samp{__stack_chk_guard}
+defined in @file{libgcc2.c} as the stack protection guard symbol.  Define
+this hook to return true if a user provided definition of
+@samp{__stack_chk_guard} with the @code{uintptr_t} type is used.
+@end deftypefn
+
 @deftypefn {Target Hook} tree TARGET_STACK_PROTECT_FAIL (void)
 This hook returns a @code{CALL_EXPR} that alerts the runtime that the
 stack protect guard variable has been modified.  This expression should
index 274bb899d0cb9c81d9cc64fd29181944db0c5307..1acda0c264ccbb14add0827a4cebb93c0399fc17 100644 (file)
@@ -3825,6 +3825,8 @@ generic code.
 
 @hook TARGET_STACK_PROTECT_GUARD
 
+@hook TARGET_STACK_PROTECT_GUARD_SYMBOL_P
+
 @hook TARGET_STACK_PROTECT_FAIL
 
 @hook TARGET_STACK_PROTECT_RUNTIME_ENABLED_P
index 11b358f4160f0ec8d91dfdfe5c406e069ae9263c..cdb3a6a6c84085511ae675185805c83ebc3b0e1f 100644 (file)
@@ -4654,6 +4654,17 @@ The default version of this hook creates a variable called\n\
  tree, (void),
  default_stack_protect_guard)
 
+/* Return true if the user provided stack protection guard definition of
+   __stack_chk_guard is used.  */
+DEFHOOK
+(stack_protect_guard_symbol_p,
+ "Usually, the compiler uses an external variable @samp{__stack_chk_guard}\n\
+defined in @file{libgcc2.c} as the stack protection guard symbol.  Define\n\
+this hook to return true if a user provided definition of\n\
+@samp{__stack_chk_guard} with the @code{uintptr_t} type is used.",
+ bool, (void),
+ hook_bool_void_false)
+
 /* This target hook allows the operating system to override the CALL_EXPR
    that is invoked when a check vs the guard variable fails.  */
 DEFHOOK
index 5f1eac75122c9cc945012a02426784f6c2584328..295f70cb3f50da59b74819bb307936ed39b57817 100644 (file)
@@ -941,9 +941,12 @@ default_stack_protect_guard (void)
     {
       rtx x;
 
+      if (targetm.stack_protect_guard_symbol_p ())
+       t = lang_hooks.types.type_for_mode (ptr_mode, 1);
+      else
+       t = ptr_type_node;
       t = build_decl (UNKNOWN_LOCATION,
-                     VAR_DECL, get_identifier ("__stack_chk_guard"),
-                     ptr_type_node);
+                     VAR_DECL, get_identifier ("__stack_chk_guard"), t);
       TREE_STATIC (t) = 1;
       TREE_PUBLIC (t) = 1;
       DECL_EXTERNAL (t) = 1;
@@ -954,8 +957,14 @@ default_stack_protect_guard (void)
 
       /* Do not share RTL as the declaration is visible outside of
         current function.  */
-      x = DECL_RTL (t);
-      RTX_FLAG (x, used) = 1;
+      if (mode_mem_attrs[(int) DECL_MODE (t)])
+       {
+         /* NB: Don't call make_decl_rtl when mode_mem_attrs isn't
+            initialized.  -save-temps won't initialize mode_mem_attrs
+            and make_decl_rtl will fail.  */
+         x = DECL_RTL (t);
+         RTX_FLAG (x, used) = 1;
+       }
 
       stack_chk_guard_decl = t;
     }
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-1.C b/gcc/testsuite/g++.target/i386/ssp-global-1.C
new file mode 100644 (file)
index 0000000..5f4d64e
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do run { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+extern "C" void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-2.C b/gcc/testsuite/g++.target/i386/ssp-global-2.C
new file mode 100644 (file)
index 0000000..e0e2e7d
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+extern char *__stack_chk_guard; /* { dg-error "conflicting declaration 'char. __stack_chk_guard'" } */
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-3.C b/gcc/testsuite/g++.target/i386/ssp-global-3.C
new file mode 100644 (file)
index 0000000..cc842b3
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+extern char __stack_chk_guard; /* { dg-error "conflicting declaration 'char __stack_chk_guard'" } */
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-hidden-1.C b/gcc/testsuite/g++.target/i386/ssp-global-hidden-1.C
new file mode 100644 (file)
index 0000000..dbb5732
--- /dev/null
@@ -0,0 +1,45 @@
+/* { dg-do run { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -fstack-protector-all -mstack-protector-guard=global -save-temps" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+__attribute__ ((visibility ("hidden")))
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+extern "C" void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+  /* { dg-final { scan-assembler ".quad        3280087301477736604" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
+  /* { dg-final { scan-assembler ".long        -584267481" { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-hidden-2.C b/gcc/testsuite/g++.target/i386/ssp-global-hidden-2.C
new file mode 100644 (file)
index 0000000..9fd3b1d
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -fstack-protector-all -mstack-protector-guard=global" } */
+
+#include <stdint.h>
+
+extern uintptr_t __stack_chk_guard;
+__attribute__ ((visibility ("hidden")))
+extern uintptr_t __stack_chk_guard;
+
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
diff --git a/gcc/testsuite/g++.target/i386/ssp-global-hidden-3.C b/gcc/testsuite/g++.target/i386/ssp-global-hidden-3.C
new file mode 100644 (file)
index 0000000..e7b297f
--- /dev/null
@@ -0,0 +1,46 @@
+/* { dg-do run { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -mstack-protector-guard=global -save-temps" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+__attribute__ ((visibility ("hidden")))
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+extern "C" void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+__attribute__ ((optimize ("stack-protector-all")))
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+  /* { dg-final { scan-assembler ".quad        3280087301477736604" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
+  /* { dg-final { scan-assembler ".long        -584267481" { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-2.c b/gcc/testsuite/gcc.target/i386/ssp-global-2.c
new file mode 100644 (file)
index 0000000..760991f
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do run { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-3.c b/gcc/testsuite/gcc.target/i386/ssp-global-3.c
new file mode 100644 (file)
index 0000000..b276e3f
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+extern char *__stack_chk_guard; /* { dg-error "conflicting types for '__stack_chk_guard';" } */
+
+char
+foo (void)
+{
+  return *__stack_chk_guard;
+}
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-4.c b/gcc/testsuite/gcc.target/i386/ssp-global-4.c
new file mode 100644 (file)
index 0000000..cf375b7
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
+
+extern char __stack_chk_guard; /* { dg-error "conflicting types for '__stack_chk_guard';" } */
+
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-hidden-1.c b/gcc/testsuite/gcc.target/i386/ssp-global-hidden-1.c
new file mode 100644 (file)
index 0000000..dbccfb1
--- /dev/null
@@ -0,0 +1,45 @@
+/* { dg-do run { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -fstack-protector-all -mstack-protector-guard=global -save-temps" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+__attribute__ ((visibility ("hidden")))
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+  /* { dg-final { scan-assembler ".quad        3280087301477736604" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
+  /* { dg-final { scan-assembler ".long        -584267481" { target { ! lp64 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-hidden-2.c b/gcc/testsuite/gcc.target/i386/ssp-global-hidden-2.c
new file mode 100644 (file)
index 0000000..9fd3b1d
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -fstack-protector-all -mstack-protector-guard=global" } */
+
+#include <stdint.h>
+
+extern uintptr_t __stack_chk_guard;
+__attribute__ ((visibility ("hidden")))
+extern uintptr_t __stack_chk_guard;
+
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/ssp-global-hidden-3.c b/gcc/testsuite/gcc.target/i386/ssp-global-hidden-3.c
new file mode 100644 (file)
index 0000000..d7ff2a2
--- /dev/null
@@ -0,0 +1,46 @@
+/* { dg-do run { target { fstack_protector && fpic } } } */
+/* { dg-options "-O2 -fPIC -mstack-protector-guard=global -save-temps" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+__attribute__ ((visibility ("hidden")))
+#ifdef __LP64__
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
+#else
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
+#endif
+
+void
+__stack_chk_fail (void)
+{
+  exit (0); /* pass */
+}
+
+__attribute__ ((noipa))
+void
+smash (char *p, int i)
+{
+  p[i] = 42;
+}
+
+__attribute__ ((optimize ("stack-protector-all")))
+int
+main (void)
+{
+  char foo[255];
+
+   /* smash stack */
+  for (int i = 0; i <= 400; i++)
+    smash (foo, i);
+
+  return 1;
+}
+
+/* { dg-final { scan-hidden "__stack_chk_guard" } } */
+/* { dg-final { scan-assembler "__stack_chk_guard\\(%rip\\)" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOTPCREL" { target { ! ia32 } } } } */
+  /* { dg-final { scan-assembler ".quad        3280087301477736604" { target { lp64 } } } } */
+/* { dg-final { scan-assembler "__stack_chk_guard@GOTOFF" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "__stack_chk_guard@GOT\\(" { target ia32 } } } */
+  /* { dg-final { scan-assembler ".long        -584267481" { target { ! lp64 } } } } */
index 85a288c781c9d18b197fadd61e226c38b8699d98..760991f82bf593a584b62f4d6165f2832f385824 100644 (file)
@@ -1,12 +1,13 @@
 /* { dg-do run { target fstack_protector } } */
 /* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=global" } */
 
+#include <stdint.h>
 #include <stdlib.h>
 
 #ifdef __LP64__
-const unsigned long int __stack_chk_guard = 0x2d853605a4d9a09cUL;
+uintptr_t __stack_chk_guard = 0x2d853605a4d9a09cUL;
 #else
-const unsigned long int __stack_chk_guard = 0xdd2cc927UL;
+uintptr_t __stack_chk_guard = 0xdd2cc927UL;
 #endif
 
 void