diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-11-23 09:02:28 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2012-11-23 09:02:28 +0000 |
commit | f9fdfcb3126a9da979f6b57e2d09f18321276e0b (patch) | |
tree | 5b2104a30f7e40b8672e50934d6b8b9c1f75ec85 /gcc/c-family | |
parent | 4736ce04cdf3298c64006ea2a6cdeb9a8d19b374 (diff) |
PR sanitizer/55435
* c-common.c (handle_no_address_safety_analysis_attribute): New
function.
(c_common_attribute_table): Add no_address_safety_analysis.
* asan.c (gate_asan): Don't instrument functions with
no_address_safety_analysis attribute.
(gate_asan_O0): Use !optimize && gate_asan ().
* doc/extend.texi (no_address_safety_analysis): Document new
function attribute.
* c-c++-common/asan/attrib-1.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 22 |
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 29386629437..ce794a29273 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2012-11-23 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/55435 + * c-common.c (handle_no_address_safety_analysis_attribute): New + function. + (c_common_attribute_table): Add no_address_safety_analysis. + 2012-11-16 Simon Baldwin <simonb@google.com> * c.opt: Add f[no-]canonical-system-headers. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index fac71901e0f..0c9cccd3146 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -309,6 +309,8 @@ static tree handle_common_attribute (tree *, tree, tree, int, bool *); static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *); static tree handle_hot_attribute (tree *, tree, tree, int, bool *); static tree handle_cold_attribute (tree *, tree, tree, int, bool *); +static tree handle_no_address_safety_analysis_attribute (tree *, tree, tree, + int, bool *); static tree handle_noinline_attribute (tree *, tree, tree, int, bool *); static tree handle_noclone_attribute (tree *, tree, tree, int, bool *); static tree handle_leaf_attribute (tree *, tree, tree, int, bool *); @@ -711,6 +713,10 @@ const struct attribute_spec c_common_attribute_table[] = handle_cold_attribute, false }, { "hot", 0, 0, true, false, false, handle_hot_attribute, false }, + { "no_address_safety_analysis", + 0, 0, true, false, false, + handle_no_address_safety_analysis_attribute, + false }, { "warning", 1, 1, true, false, false, handle_error_attribute, false }, { "error", 1, 1, true, false, false, @@ -6482,6 +6488,22 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args), return NULL_TREE; } +/* Handle a "no_address_safety_analysis" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) +{ + if (TREE_CODE (*node) != FUNCTION_DECL) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Handle a "noinline" attribute; arguments as in struct attribute_spec.handler. */ |