This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support -fsanitize=leak


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]