Matthew Malcomson <matthew.malcom...@arm.com> writes:
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..a6a11866823ae8ba9c20b79ac068e84aa73e053d
> --- /dev/null
> +++ b/gcc/testsuite/lib/hwasan-dg.exp
> @@ -0,0 +1,121 @@
> +# Copyright (C) 2012-2019 Free Software Foundation, Inc.

2012-2020

> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with GCC; see the file COPYING3.  If not see
> +# <http://www.gnu.org/licenses/>.
> +
> +# Return 1 if compilation with -fsanitize=hwaddress is error-free for trivial
> +# code, 0 otherwise.
> +
> +load_lib asan-dg.exp

The “Return 1” comment is now misplaced.  However…

> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index 
> ceee78c26a9379f908659ae3d594bca104227d04..18b8c5a60a089fcac7bf2a41adcc373f995fca0f
>  100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -10633,6 +10633,30 @@ proc check_effective_target_movdir { } {
>      } "-mmovdiri -mmovdir64b" ]
>  }
>  
> +# Return 1 if compilation with -fsanitize=address is error-free for trivial
> +# code, 0 otherwise.
> +
> +proc check_effective_target_fsanitize_address {} {
> +    if ![check_no_compiler_messages fsanitize_address executable {
> +     int main (void) { return 0; }
> +    }] {
> +     return 0;
> +    }
> +
> +    # asan doesn't work if there's a ulimit on virtual memory.
> +    if ![is_remote target] {
> +     if [catch {exec sh -c "ulimit -v"} ulimit_v] {
> +         # failed to get ulimit
> +     } elseif [regexp {^[0-9]+$} $ulimit_v] {
> +         # ulimit -v gave a numeric limit
> +         warning "skipping asan tests due to ulimit -v"
> +         return 0;
> +     }
> +    }
> +
> +    return 1;
> +}
> +

Looking at this again, I realise I was wrong to say that the
effective_target routines should be here.  I guess this function was in
asan-dg.exp because it doesn't add any flags to ensure that the address
sanitiser is used.  Instead it relies on the harness to add the flags
first.

So could you put this back but add:

#
# NOTE: This function should only be used between calls to asan_init
# and asan_finish.  It is therefore defined here rather than in
# target-supports.exp.

Similarly for the hwasan routines, but with hwasan_init and hwasan_finish.

Sorry for the runaround.

OK with that change, no need for another review round.

Thanks,
Richard

Reply via email to