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

Duncan Sands baldrick at free.fr
Sun Aug 19 23:57:44 PDT 2012


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.

shouldn't this be governed by an option that clang (or whoever) sets?

>> 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.

OK, thanks for explaining.

By the way can you please take a look at PR9673 which is just teaching clang to
turn gcc's ssp-buffer-size option into LLVM's -stack-protector-buffer-size
(llvm-gcc has done this for ages).  This is important for Debian since there are
nearly 100 Debian packages which use ssp-buffer-size and are compiled with
-Werror.  They fail to compile due to clang warning "unused argument during
compilation" about ssp-buffer-size.

Ciao, Duncan.



More information about the llvm-commits mailing list