This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2] Implement no_sanitize function attribute
- From: Martin Liška <mliska at suse dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 31 May 2017 13:52:30 +0200
- Subject: Re: [PATCH v2] Implement no_sanitize function attribute
- Authentication-results: sourceware.org; auth=none
- References: <72103b1d-0119-f05d-043d-ca2edf242bf3@suse.cz> <beb96c01-d217-b126-baaa-bcf5682889f4@suse.cz> <20170531083543.GQ24023@tucnak> <83f8580a-03e1-81eb-3216-a1c998810b90@suse.cz> <20170531113321.GT24023@tucnak> <CAFiYyc1G6vsFQiGdreyrf9Vw+E0JuoQYGazXSrENaGzvhy+F=g@mail.gmail.com>
On 05/31/2017 01:46 PM, Richard Biener wrote:
> On Wed, May 31, 2017 at 1:33 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Wed, May 31, 2017 at 01:24:47PM +0200, Martin Liška wrote:
>>> On 05/31/2017 10:35 AM, Jakub Jelinek wrote:
>>>> On Wed, May 31, 2017 at 10:04:53AM +0200, Martin Liška wrote:
>>>>> diff --git a/gcc/common.opt b/gcc/common.opt
>>>>> index 13305558d2d..5e9942d5100 100644
>>>>> --- a/gcc/common.opt
>>>>> +++ b/gcc/common.opt
>>>>> @@ -222,9 +222,13 @@ bool flag_opts_finished
>>>>> Variable
>>>>> unsigned int flag_sanitize
>>>>>
>>>>> +###
>>>>> +Common RejectNegative Joined UInteger Var(flag_no_sanitize_fn) PerFunction
>>>>> +No sanitize flags for a function
>>>>
>>>> This looks weird, you are redefining the -### option which is normally
>>>> a driver option.
>>>
>>> I know. I was thinking that it's also a 'dummy' value.
>>
>> It is not.
>>
>>>> I would have thought you just want a Variable, like the one right below
>>>> this. Aren't all "Variable"s per-function?
>>>
>>> Unfortunately not. Well, probably adding new type 'PerFunctionVariable' would be
>>> solution. Then optc-save-gen.awk needs to be learned how to save/restore these variables.
>>>
>>> Is it the way we want to go?
>>
>> Yes. We already have TargetVariable. Or allow specifying
>> Variable PerFunction
>>
>> CCing Joseph as option handling maintainer.
>
> Just wanting to add that "ab-"using options/variables to implement
> what are really
> function attributes doesn't look very clean. Unless the plan is to get rid of
> function attributes in favor of per-function options.
Well, that was what I did in my original version of the patch. I basically transformed
all no_sanitize_address, no_sanitize_undefined and others to a single DECL_ATTRIBUTE
called 'no_sanitize' where I masked in integer all these. Feedback I was given by Jakub
recommended me to not to do it.
>
> I'll also note that eventually global variables may want to be no-sanitized
> (for asan maybe). And we don't (yet) have per-variable options.
Good remark.
Martin
>
> Richard.
>
>> Jakub