]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Come up with stack_protector enum.
authorMartin Liska <mliska@suse.cz>
Fri, 15 May 2020 12:51:24 +0000 (14:51 +0200)
committerMartin Liska <mliska@suse.cz>
Thu, 22 Oct 2020 08:06:06 +0000 (10:06 +0200)
gcc/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

* cfgexpand.c: Move the enum to ...
* coretypes.h (enum stack_protector): ... here.
* function.c (assign_parm_adjust_stack_rtl): Use the stack_protector
enum.

gcc/c-family/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

* c-cppbuiltin.c (c_cpp_builtins): Use the stack_protector enum.

gcc/c-family/c-cppbuiltin.c
gcc/cfgexpand.c
gcc/coretypes.h
gcc/function.c

index 74ecca8de8e08610c43249047e0be1a3bab6eb2e..e5ebb79e22a2635c1540e598e295026c1bb7d73a 100644 (file)
@@ -1427,13 +1427,13 @@ c_cpp_builtins (cpp_reader *pfile)
   /* Make the choice of the stack protector runtime visible to source code.
      The macro names and values here were chosen for compatibility with an
      earlier implementation, i.e. ProPolice.  */
-  if (flag_stack_protect == 4)
+  if (flag_stack_protect == SPCT_FLAG_EXPLICIT)
     cpp_define (pfile, "__SSP_EXPLICIT__=4");
-  if (flag_stack_protect == 3)
+  if (flag_stack_protect == SPCT_FLAG_STRONG)
     cpp_define (pfile, "__SSP_STRONG__=3");
-  if (flag_stack_protect == 2)
+  if (flag_stack_protect == SPCT_FLAG_ALL)
     cpp_define (pfile, "__SSP_ALL__=2");
-  else if (flag_stack_protect == 1)
+  else if (flag_stack_protect == SPCT_FLAG_DEFAULT)
     cpp_define (pfile, "__SSP__=1");
 
   if (flag_openacc)
index 1eaa1da11b9714dacfc51f3ffb774a62500bfa6c..2ac9aef389aacfda8637796f3b6980d21a1a151b 100644 (file)
@@ -1762,13 +1762,6 @@ clear_tree_used (tree block)
     clear_tree_used (t);
 }
 
-enum {
-  SPCT_FLAG_DEFAULT = 1,
-  SPCT_FLAG_ALL = 2,
-  SPCT_FLAG_STRONG = 3,
-  SPCT_FLAG_EXPLICIT = 4
-};
-
 /* Examine TYPE and determine a bit mask of the following features.  */
 
 #define SPCT_HAS_LARGE_CHAR_ARRAY      1
index 6b6cfcdf210d94e8d08bb0f117eb54392fc11073..81a1b594dcd52d8eacb96826c185be3aae0dfce7 100644 (file)
@@ -219,6 +219,14 @@ enum profile_reproducibility {
     PROFILE_REPRODUCIBILITY_MULTITHREADED
 };
 
+/* Type of -fstack-protector-*.  */
+enum stack_protector {
+  SPCT_FLAG_DEFAULT = 1,
+  SPCT_FLAG_ALL = 2,
+  SPCT_FLAG_STRONG = 3,
+  SPCT_FLAG_EXPLICIT = 4
+};
+
 /* Types of unwind/exception handling info that can be generated.  */
 
 enum unwind_info_type
index c6129593b9bdaa862ac4f1a5c70e964572bcb75c..f903a1e2474d5b40a5ec9745c73e0ce3c0a667a1 100644 (file)
@@ -2846,7 +2846,7 @@ assign_parm_adjust_stack_rtl (struct assign_parm_data_one *data)
   /* If stack protection is in effect for this function, don't leave any
      pointers in their passed stack slots.  */
   else if (crtl->stack_protect_guard
-          && (flag_stack_protect == 2
+          && (flag_stack_protect == SPCT_FLAG_ALL
               || data->arg.pass_by_reference
               || POINTER_TYPE_P (data->nominal_type)))
     stack_parm = NULL;