[llvm-commits] [llvm-gcc-4.2] r52263 - in /llvm-gcc-4.2/trunk/gcc: c-cppbuiltin.c cfgexpand.c common.opt function.c toplev.c

Devang Patel dpatel at apple.com
Fri Jun 13 16:05:04 PDT 2008


On Jun 13, 2008, at 3:27 PM, Dale Johannesen wrote:

>
> On Jun 13, 2008, at 3:24 PM, Devang Patel wrote:
>
>> Author: dpatel
>> Date: Fri Jun 13 17:24:02 2008
>> New Revision: 52263
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=52263&view=rev
>> Log:
>>
>> -fstack-protector is not supported.
>
> Shouldn't this be using #ifndef ENABLE_LLVM instead of #if 0?

I think so. I could not find easy way to do #ifndef in common.opt patch.
-
Devang

>> 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/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=52263&r1=52262&r2=52263&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c (original)
>> +++ llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c Fri Jun 13 17:24:02 2008
>> @@ -629,10 +629,14 @@
>>  /* 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=52263&r1=52262&r2=52263&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/cfgexpand.c (original)
>> +++ llvm-gcc-4.2/trunk/gcc/cfgexpand.c Fri Jun 13 17:24:02 2008
>> @@ -697,8 +697,12 @@
>> {
>>  /* 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
>> @@ -817,6 +821,8 @@
>> #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)
>> {
>> @@ -946,6 +952,8 @@
>>  expand_one_stack_var (guard);
>>  cfun->stack_protect_guard = guard;
>> }
>> +#endif
>> +/* LLVM LOCAL end stack protector */
>>
>> /* Expand all variables used in the function.  */
>>
>> @@ -1020,10 +1028,14 @@
>> 	 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.  */
>> @@ -1036,11 +1048,15 @@
>>     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.  */
>> @@ -1051,6 +1067,8 @@
>>      /* ??? 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.  */
>> @@ -1060,7 +1078,8 @@
>> 	  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.  */
>> @@ -1615,6 +1634,8 @@
>>  expand_used_vars ();
>>
>>  /* Honor stack protection warnings.  */
>> +  /* LLVM LOCAL begin stack protector */
>> +#if 0
>>  if (warn_stack_protect)
>>    {
>>      if (current_function_calls_alloca)
>> @@ -1623,6 +1644,8 @@
>> 	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=52263&r1=52262&r2=52263&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/common.opt (original)
>> +++ llvm-gcc-4.2/trunk/gcc/common.opt Fri Jun 13 17:24:02 2008
>> @@ -121,9 +121,11 @@
>> Common Var(warn_shadow)
>> Warn when one local variable shadows another
>>
>> -Wstack-protector
>> -Common Var(warn_stack_protect)
>> -Warn when not issuing stack smashing protection for some reason
>> +; 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
>>
>> Wstrict-aliasing
>> Common
>> @@ -998,13 +1000,15 @@
>> Common RejectNegative Joined
>> -fstack-limit-symbol=<name>	Trap if the stack goes past symbol <name>
>>
>> -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 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
>>
>> fstrength-reduce
>> Common
>>
>> 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=52263&r1=52262&r2=52263&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/function.c (original)
>> +++ llvm-gcc-4.2/trunk/gcc/function.c Fri Jun 13 17:24:02 2008
>> @@ -2462,9 +2462,10 @@
>>
>>  /* 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
>> -	   && (flag_stack_protect == 2
>> -	       || data->passed_pointer
>> +	   && (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=52263&r1=52262&r2=52263&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/toplev.c (original)
>> +++ llvm-gcc-4.2/trunk/gcc/toplev.c Fri Jun 13 17:24:02 2008
>> @@ -2015,6 +2015,8 @@
>>  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)
>> @@ -2024,6 +2026,8 @@
>>    }
>>  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
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list