http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59061

--- Comment #7 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
> > Clang supports -fsanitize=leak which simply links a standalone lsan library
> > (no instrumentation at compile time required). 
> > Perhaps gcc can add such option too. 
> 
> I agree that such an option would be useful (see also below).

I am not an expert in the gcc build system so this will have to be done by
someone else. Also, I am heavily frightened by the amount of differences 
between the clang and gcc builds of libsanitizer. On my...
The only good solution I see will hardly be accepted by the gcc community
(which is: export compiler-rt as is, with all of its build and test system,
anything else is going to increase the maintenance cost).

> For now, I put '-fsanitize=address' for the link step only, which has the
> same effect. 

It has a bit different effect because asan's allocator has greater memory
footprint compared to a plain lsan's allocator. 
But -fsanitize=leak as a separate entity is not on top of our priorities.
It works, but we don't test it on anything large. 

> 
> Additionally, it seems important to have -g -fno-omit-frame-pointer in the
> options. Maybe gcc should add these options for best 'user experience', for
> example as part of -fsanitize=address/leak. Power users can always override
> with -fsanitize=leak -fomit-frame-pointer.

-g: please no. -g incurs very large compile-time and binary size overhead.
we need something like -gmlt (in google's gcc branch, not sure if it's
available in trunk) or clang's -gline-tables-only. 

-fno-omit-frame-pointer: that may or may not be a good idea, I don't know.

If we do any of these flags as default for -fsanitize=x,
it would be nice to have the same defaults in clang.

Reply via email to