This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Change -faddress-sanitizer to -fsanitize=address
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- Cc: Wei Mi <wmi at google dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, David Li <davidxl at google dot com>, Diego Novillo <dnovillo at google dot com>, Kostya Serebryany <kcc at google dot com>, Dodji Seketeli <dseketel at redhat dot com>
- Date: Mon, 19 Nov 2012 19:57:45 +0100
- Subject: Re: [PATCH] Change -faddress-sanitizer to -fsanitize=address
- References: <CA+4CFy5cJHSuHhX7YgaekGA7oGejmcRs9FNDzs4DghytbX-vzQ@mail.gmail.com> <CAGQ9bdzth+mrs4H11vWntVeYtqywdsUmebf379KU5fMGd=SfeQ@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Nov 19, 2012 at 10:26:26PM +0400, Konstantin Serebryany wrote:
> Clang also supports the no- form (-fno-sanitize=address).
> We probably want it here too, but preferably as a separate patch.
> (or is it automatically implemented via some internal magic?)
So, how does it work in clang?
Does -fsanitize=address -fsanitize=thread enable both asan and tsan,
or just tsan? Does -fsanitize=thread -fno-sanitize=address enable tsan or
not? If -fsanitize=thread doesn't disable ASAN, then you can't
use the same flag variable for both, you need flag_asan and flag_tsan
as before on the compiler side, and just fsanitize=address and
fsanitize=thread in common.opt, without RejectNegative, and with appropriate
Var(flag_asan) resp. Var(flag_tsan).
> On Mon, Nov 19, 2012 at 10:14 PM, Wei Mi <firstname.lastname@example.org> wrote:
> > Hi,
> > This patch is to change -faddress-sanitizer to -fsanitize=address. Ok for trunk?
> > 2012-11-19 Wei Mi <email@example.com>
> > * cfgexpand.c (partition_stack_vars): Change flag_asan to
> > flag_sanitize.
> > (expand_stack_vars): Likewise.
> > (defer_stack_allocation): Likewise.
> > (expand_used_vars): Likewise.
> > * varasm.c (assemble_noswitch_variable): Likewise.
> > (assemble_variable): Likewise.
> > (place_block_symbol): Likewise.
> > * asan.c (gate_asan): Likewise.
> > (gate_asan_O0): Likewise.
> > * toplev.c (compile_file): Likewise.
> > (process_options): Likewise.
> > * common.opt: Change faddress-sanitizer to fsanitize=address.
> > * gcc.c (LINK_COMMAND_SPEC): Likewise.
> > * testsuite/lib/asan-dg.exp
> > (check_effective_target_faddress_sanitizer): Likewise.
> > (asan_init): Likewise.
> > * flag-types.h (sanitize_type): New enum type.
> > * doc/invoke.texi (-fsanitize=[address|thread]): Document.
> > Thanks,
> > Wei.