diff mbox

Support -fsanitize=leak

Message ID 528C4890.9090406@samsung.com
State New
Headers show

Commit Message

Yury Gribov Nov. 20, 2013, 5:28 a.m. UTC
>> This patch adds support for -fsanitize=leak and -static-liblsan options.
>> ...
>
> Documentation?
>
> Ian

In case this is a prereq for commit, here is a simple addition to invoke.texi.

-Y

Comments

Marek Polacek Nov. 20, 2013, 7:20 a.m. UTC | #1
On Wed, Nov 20, 2013 at 09:28:48AM +0400, Yury Gribov wrote:
> >>This patch adds support for -fsanitize=leak and -static-liblsan options.
> >>...
> >
> >Documentation?
> >
> >Ian
> 
> In case this is a prereq for commit, here is a simple addition to invoke.texi.

Jakub already wrote the invoke.texi part:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02061.html

	Marek
Yury Gribov Nov. 20, 2013, 7:40 a.m. UTC | #2
> Jakub already wrote the invoke.texi part:
 > http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02061.html

Ah, thanks, I somehow missed it. When will this end up in trunk? I have 
a depending patch.

-Y
Jakub Jelinek Nov. 20, 2013, 8:05 a.m. UTC | #3
On Wed, Nov 20, 2013 at 11:40:14AM +0400, Yury Gribov wrote:
> > Jakub already wrote the invoke.texi part:
> > http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02061.html
> 
> Ah, thanks, I somehow missed it. When will this end up in trunk? I
> have a depending patch.

When it is reviewed.  I have various other pending asan patches:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02070.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02061.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01874.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01791.html
plus the libbacktrace symbolization in libsanitizer (but that depends
on upstream acceptance and because of the non-trivial changes in upstream
will need to wait for acceptance there plus another merge back).

Dodji, do you think you could review these soon?

	Jakub
diff mbox

Patch

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7074a48..960df85 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -454,7 +454,7 @@  Objective-C and Objective-C++ Dialects}.
 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
 -s  -static -static-libgcc -static-libstdc++ @gol
--static-libasan -static-libtsan -static-libubsan @gol
+-static-libasan -static-libtsan -static-libubsan -static-liblsan @gol
 -shared -shared-libgcc  -symbolic @gol
 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
 -u @var{symbol}}
@@ -5303,6 +5303,12 @@  While @option{-ftrapv} causes traps for signed overflows to be emitted,
 @option{-fsanitize=undefined} gives a diagnostic message.
 This currently works only for the C family of languages.
 
+@item -fsanitize=leak
+Enable LeakSanitizer, a memory leak detector working on top of AddressSanitizer.
+Heap allocations will be registered and used to detect and report leaks
+on program exit.
+See @uref{http://code.google.com/p/address-sanitizer/wiki/LeakSanitizer} for more details.
+
 @item -fdump-final-insns@r{[}=@var{file}@r{]}
 @opindex fdump-final-insns
 Dump the final internal representation (RTL) to @var{file}.  If the
@@ -10227,6 +10233,15 @@  option is not used, then this links against the shared version of
 driver to link @file{libubsan} statically, without necessarily linking
 other libraries statically.
 
+@item -static-liblsan
+When the @option{-fsanitize=leak} option is used to link a program,
+the GCC driver automatically links against @option{liblsan}.  If
+@file{liblsan} is available as a shared library, and the @option{-static}
+option is not used, then this links against the shared version of
+@file{liblsan}.  The @option{-static-liblsan} option directs the GCC
+driver to link @file{liblsan} statically, without necessarily linking
+other libraries statically.
+
 @item -static-libstdc++
 When the @command{g++} program is used to link a C++ program, it
 normally automatically links against @option{libstdc++}.  If