[llvm-commits] [llvm-gcc-4.2] r52268 - in /llvm-gcc-4.2/trunk/gcc: c-cppbuiltin.c cfgexpand.c common.opt config/rs6000/rs6000.h function.c toplev.c

Devang Patel dpatel at apple.com
Fri Jun 13 17:50:28 PDT 2008


Author: dpatel
Date: Fri Jun 13 19:50:28 2008
New Revision: 52268

URL: http://llvm.org/viewvc/llvm-project?rev=52268&view=rev
Log:
Undo previous -fstack-protector patch.

Modified:
    llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c
    llvm-gcc-4.2/trunk/gcc/cfgexpand.c
    llvm-gcc-4.2/trunk/gcc/common.opt
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
    llvm-gcc-4.2/trunk/gcc/function.c
    llvm-gcc-4.2/trunk/gcc/toplev.c

Modified: llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c Fri Jun 13 19:50:28 2008
@@ -629,14 +629,10 @@
   /* 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.  */
-  /* LLVM LOCAL begin stack protector */
-#if 0
   if (flag_stack_protect == 2)
     cpp_define (pfile, "__SSP_ALL__=2");
   else if (flag_stack_protect == 1)
     cpp_define (pfile, "__SSP__=1");
-#endif
-  /* LLVM LOCAL end stack protector */
 
   if (flag_openmp)
     cpp_define (pfile, "_OPENMP=200505");

Modified: llvm-gcc-4.2/trunk/gcc/cfgexpand.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cfgexpand.c?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cfgexpand.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cfgexpand.c Fri Jun 13 19:50:28 2008
@@ -697,12 +697,8 @@
 {
   /* If stack protection is enabled, *all* stack variables must be deferred,
      so that we can re-order the strings to the top of the frame.  */
-  /* LLVM LOCAL begin stack protector */
-#if 0
   if (flag_stack_protect)
     return true;
-#endif
-  /* LLVM LOCAL end stack protector */
 
   /* Variables in the outermost scope automatically conflict with
      every other variable.  The only reason to want to defer them
@@ -821,8 +817,6 @@
 #define SPCT_HAS_ARRAY			4
 #define SPCT_HAS_AGGREGATE		8
 
-/* LLVM LOCAL begin stack protector */
-#if 0
 static unsigned int
 stack_protect_classify_type (tree type)
 {
@@ -952,8 +946,6 @@
   expand_one_stack_var (guard);
   cfun->stack_protect_guard = guard;
 }
-#endif
-/* LLVM LOCAL end stack protector */
 
 /* Expand all variables used in the function.  */
 
@@ -1028,14 +1020,10 @@
 	 reflect this.  */
       add_alias_set_conflicts ();
 
-/* LLVM LOCAL begin stack protector */
-#if 0
       /* If stack protection is enabled, we don't share space between
 	 vulnerable data and non-vulnerable data.  */
       if (flag_stack_protect)
 	add_stack_protection_conflicts ();
-#endif
-/* LLVM LOCAL end stack protector */
 
       /* Now that we have collected all stack variables, and have computed a
 	 minimal interference graph, attempt to save some stack space.  */
@@ -1048,15 +1036,11 @@
      stack guard: protect-all, alloca used, protected decls present.  */
   /* APPLE LOCAL begin CW asm */
   /* Don't create a guard for iasm functions.  */
-  /* LLVM LOCAL begin stack protector */
-#if 0
   if ((flag_stack_protect == 2
       || (flag_stack_protect
 	   && (current_function_calls_alloca || has_protected_decls)))
       && !cfun->iasm_asm_function)
     create_stack_guard ();
-#endif
-  /* LLVM LOCAL end stack protector */
   /* APPLE LOCAL end CW asm */
 
   /* Assign rtl to each variable based on these partitions.  */
@@ -1067,8 +1051,6 @@
       /* ??? We could probably integrate this into the qsort we did
 	 earlier, such that we naturally see these variables first,
 	 and thus naturally allocate things in the right order.  */
-  /* LLVM LOCAL begin stack protector */
-#if 0
       if (has_protected_decls)
 	{
 	  /* Phase 1 contains only character arrays.  */
@@ -1078,8 +1060,7 @@
 	  if (flag_stack_protect == 2)
 	    expand_stack_vars (stack_protect_decl_phase_2);
 	}
-#endif
-  /* LLVM LOCAL end stack protector */
+
       expand_stack_vars (NULL);
 
       /* Free up stack variable graph data.  */
@@ -1634,8 +1615,6 @@
   expand_used_vars ();
 
   /* Honor stack protection warnings.  */
-  /* LLVM LOCAL begin stack protector */
-#if 0
   if (warn_stack_protect)
     {
       if (current_function_calls_alloca)
@@ -1644,8 +1623,6 @@
 	warning (0, "not protecting function: no buffer at least %d bytes long",
 		 (int) PARAM_VALUE (PARAM_SSP_BUFFER_SIZE));
     }
-#endif
-  /* LLVM LOCAL end stack protector */
 
   /* Set up parameters and prepare for return, for the function.  */
   expand_function_start (current_function_decl);

Modified: llvm-gcc-4.2/trunk/gcc/common.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/common.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/common.opt Fri Jun 13 19:50:28 2008
@@ -121,11 +121,9 @@
 Common Var(warn_shadow)
 Warn when one local variable shadows another
 
-; LLVM LOCAL begin stack protector
-; Wstack-protector
-; Common Var(warn_stack_protect)
-; Warn when not issuing stack smashing protection for some reason
-; LLVM LOCAL end stack protector
+Wstack-protector
+Common Var(warn_stack_protect)
+Warn when not issuing stack smashing protection for some reason
 
 Wstrict-aliasing
 Common
@@ -1000,15 +998,13 @@
 Common RejectNegative Joined
 -fstack-limit-symbol=<name>	Trap if the stack goes past symbol <name>
 
-; LLVM LOCAL begin stack protector
-; fstack-protector
-; Common Report Var(flag_stack_protect, 1)
-; Use propolice as a stack protection method
-; 
-; fstack-protector-all
-; Common Report RejectNegative Var(flag_stack_protect, 2) VarExists
-; Use a stack protection method for every function
-; LLVM LOCAL end stack protector
+fstack-protector
+Common Report Var(flag_stack_protect, 1)
+Use propolice as a stack protection method
+
+fstack-protector-all
+Common Report RejectNegative Var(flag_stack_protect, 2) VarExists
+Use a stack protection method for every function
 
 fstrength-reduce
 Common

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Fri Jun 13 19:50:28 2008
@@ -1212,7 +1212,10 @@
 
    On the RS/6000, we grow upwards, from the area after the outgoing
    arguments.  */
-#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0)
+/* LLVM LOCAL begin stack protector */
+#define FRAME_GROWS_DOWNWARD 0
+/* LLVM LOCAL end stack protector */
+
 
 /* Size of the outgoing register save area */
 #define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX			\

Modified: llvm-gcc-4.2/trunk/gcc/function.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.c?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/function.c (original)
+++ llvm-gcc-4.2/trunk/gcc/function.c Fri Jun 13 19:50:28 2008
@@ -2462,10 +2462,9 @@
 
   /* If stack protection is in effect for this function, don't leave any
      pointers in their passed stack slots.  */
-  /* LLVM LOCAL. 
-     Remove flag_stack_protector == 2 check */
   else if (cfun->stack_protect_guard
-	   && (data->passed_pointer
+	   && (flag_stack_protect == 2
+	       || data->passed_pointer
 	       || POINTER_TYPE_P (data->nominal_type)))
     stack_parm = NULL;
 

Modified: llvm-gcc-4.2/trunk/gcc/toplev.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=52268&r1=52267&r2=52268&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/toplev.c (original)
+++ llvm-gcc-4.2/trunk/gcc/toplev.c Fri Jun 13 19:50:28 2008
@@ -2015,8 +2015,6 @@
   cl_pf_opts_cooked = cl_pf_opts;
   /* APPLE LOCAL end optimization pragmas 3124235/3420242 */
 
-/* LLVM LOCAL begin stack protector */
-#if 0
   /* Targets must be able to place spill slots at lower addresses.  If the
      target already uses a soft frame pointer, the transition is trivial.  */
   if (!FRAME_GROWS_DOWNWARD && flag_stack_protect)
@@ -2026,8 +2024,6 @@
     }
   if (!flag_stack_protect)
     warn_stack_protect = 0;
-#endif
-/* LLVM LOCAL end stack protector */
 
   /* ??? Unwind info is not correct around the CFG unless either a frame
      pointer is present or A_O_A is set.  Fixing this requires rewriting





More information about the llvm-commits mailing list