[PATCH] D80791: [AArch64] Generate .note.gnu.property based on module flags.

Szabolcs Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 07:48:43 PDT 2020


The 08/10/2020 10:03, Momchil Velikov via Phabricator wrote:
> chill added a comment.
> 
> In D80791#2196598 <https://reviews.llvm.org/D80791#2196598>, @nsz wrote:
> 
> > the assumption is that the intended branch protection is implied via cmdline flags for the tu and function attributes are only used in source code for some hack.
> 
> I don't share this assumption. I find it just as valid to control the PAC/BTI with things like:
> 
>   #ifdef ENABLE_BTI
>   #define BTI_FUNC __attribute__((target("branch-protection=bti")))
>   #else
>   #define BTI_FUNC
>   
>   BTI_FUNC void foo() { ...
>   BTI_FUNC int bar() { ...
> 
> without using any command-line option other than `-DENABLE_BTI=1`.
> 

i think that cannot work.

the implementation is free to inject arbitrary code into
user code so if the user does not tell the implementation
that it wants the entire tu to be bti safe then non-bti
code can end up in there. (e.g. ctor of an instrumentation
that is not realated to any particular function with the
bti marking)

> 
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D80791/new/
> 
> https://reviews.llvm.org/D80791
> 

-- 


More information about the cfe-commits mailing list