[llvm-commits] [llvm] r162131 - /llvm/trunk/lib/CodeGen/StackProtector.cpp

Bill Wendling wendling at apple.com
Sun Aug 19 21:16:49 PDT 2012


On Aug 19, 2012, at 6:43 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Bill,
> 
>> Implement stack protectors for structures with character arrays in them.
>> <rdar://problem/10545247>
>> 
>> +      // If we're on a non-Darwin platform or we're inside of a structure, don't
>> +      // add stack protectors unless the array is a character array.
>> +      if (InStruct || !Trip.isOSDarwin())
>> +          return false;
> 
> why do you treat Darwin specially here?

Because we want to protect all array types on Darwin, not just char arrays. However, the default gcc behavior is to protect just char arrays with stack protectors. We don't want to have non-Darwin platforms diverge from gcc's behavior here.

> Also, why do you care whether there is
> an array or not, isn't it only the amount of memory allocated by the alloca that
> matters?
> 
No. We are protecting only arrays with stack protectors.

-bw




More information about the llvm-commits mailing list