This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Support -fsanitize=leak
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>, Dodji Seketeli <dseketel at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Nov 2013 13:15:02 +0100
- Subject: Re: [PATCH] Support -fsanitize=leak
- Authentication-results: sourceware.org; auth=none
- References: <20131115194138 dot GQ892 at tucnak dot redhat dot com>
On Fri, Nov 15, 2013 at 08:41:38PM +0100, Jakub Jelinek wrote:
> Hi!
>
> This patch adds support for -fsanitize=leak and -static-liblsan options.
> If combined with -fsanitize=address, it does nothing, otherwise it links
> in liblsan, a new shared+static library (on x86_64-linux only so far,
> the code isn't 32-bit ready apparently).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2013-11-14 Jakub Jelinek <jakub@redhat.com>
>
> PR sanitizer/59061
> * common.opt (static-liblsan): Add.
> * config/gnu-user.h (STATIC_LIBLSAN_LIBS, STATIC_LIBUBSAN_LIBS):
> Define.
> * flag-types.h (enum sanitize_code): Add SANITIZE_LEAK. Renumber
> SANITIZE_SHIFT, SANITIZE_DIVIDE, SANITIZE_UNREACHABLE, SANITIZE_VLA.
> * opts.c (common_handle_option): Handle -fsanitize=leak.
> * gcc.c (ADD_STATIC_LIBLSAN_LIBS, LIBLSAN_SPEC): Define.
> (LIBUBSAN_SPEC): Don't test LIBUBSAN_EARLY_SPEC.
> (LIBUBSAN_EARLY_SPEC): Remove.
> (SANITIZER_EARLY_SPEC): Don't do anything for libubsan.
> (SANITIZER_SPEC): Add -fsanitize=leak handling.
> (sanitize_spec_function): Handle %sanitize(leak).
>
> * configure.tgt: Set LSAN_SUPPORTED=yes for x86_64-linux.
> * configure.ac (LSAN_SUPPORTED): New AM_CONDITIONAL.
> * lsan/Makefile.am (toolexeclib_LTLIBRARIES, lsan_files,
> liblsan_la_SOURCES, liblsan_la_LIBADD, liblsan_la_LDFLAGS): Add.
> * lsan/Makefile.in: Regenerated.
Looks good to me. Moreover, it fixes the bootstrap-ubsan failure when
building fixincl - I guess the gnu-user.h hunk was missing. Thanks.
Marek