[cfe-dev] Addition of function parameter attribute to help __builtin_object_size

PaX Team via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 14 11:19:32 PDT 2015


On 14 Sep 2015 at 10:54, George Burgess IV via cfe-dev wrote:

> Hello friends,
> 
> I plan to add a function parameter attribute called carry_size (name
> suggestions welcome). The goal of this attribute is to help Clang/LLVM
> answer `__builtin_object_size(Ptr, Type)` calls when the object pointed to
> by Ptr isn't visible in the caller of __builtin_object_size.
> 
> An example of its use:
> #define CS(N) __attribute__((carry_size(N)))
> void __attribute__((noinline)) Func(void *const p CS(0)) {
>   printf("%d\n", __builtin_object_size(p, 0));
> }

i must be missing something here but why do you need a manually applied
attr at all when the compiler can just figure it out itself whenever it
sees a call to __builtin_object_size?




More information about the cfe-dev mailing list