This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Use libbacktrace as libsanitizer's symbolizer
- From: Ian Lance Taylor <iant at google dot com>
- To: Alexey Samsonov <samsonov at google dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Konstantin Serebryany <kcc at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Nov 2013 10:27:06 -0800
- Subject: Re: [PATCH] Use libbacktrace as libsanitizer's symbolizer
- Authentication-results: sourceware.org; auth=none
- References: <20131118133930 dot GA892 at tucnak dot redhat dot com> <CAGSYnCMV=Sa6sNq5W-WcB-+iH_f3wwcQyBZ8HMEKsEW7VamHxA at mail dot gmail dot com> <CAGSYnCOs6BHEqfhoBdpF0AEODHhbhLENyWGy_DrObVnUv+js2g at mail dot gmail dot com> <20131118162342 dot GH892 at tucnak dot redhat dot com> <CAGSYnCPcGeYB7EEw=jAFf6h-gc2wJi0hqeZLDPEfmKOjq3FWAA at mail dot gmail dot com> <20131119153350 dot GW892 at tucnak dot redhat dot com> <20131119164221 dot GZ892 at tucnak dot redhat dot com> <CAGSYnCNYcAfhN6k-JFkBbnub2U6=x_VYCuH2K7VhSUf7HZ2FCQ at mail dot gmail dot com>
On Fri, Nov 22, 2013 at 10:19 AM, Alexey Samsonov <firstname.lastname@example.org> wrote:
> On Tue, Nov 19, 2013 at 8:42 PM, Jakub Jelinek <email@example.com> wrote:
>> On Tue, Nov 19, 2013 at 04:33:50PM +0100, Jakub Jelinek wrote:
>> > I will try.
>> Ok, here it is (untested though, because libsanitizer in gcc is older and I
>> don't have spare cycles to play with llvm).
>> Guess you need to write it up into compiler-rt buildsystem somehow,
>> and for testing add
>> -DSANITIZER_LIBBACKTRACE -I..../srcdir_of_libbacktrace -I..../builddir_of_libbacktrace -L..../builddir_of_libbacktrace/.libs -lbacktrace
>> This is against current libbacktrace (r205028 or later, before that
>> the syminfo callbacks had one less argument).
> Do you have an idea of how the libbacktrace symbolizer should look to
> the end user (if the static runtime was built with
> -DSANITIZER_LIBBACKTRACE)? I see the following options, none of which
> looks nice:
> 1) Force the user to provide -L/path/to/libbacktrace -lbacktrace at
> link time (otherwise one will see link errors like "undefined symbol:
> backtrace_create_state"). Certainly this is a bad user experience.
> 2) Make -fsanitize=address link flag imply "-lbacktrace" as we do for
> libpthread, librt etc. But libbacktrace may not be installed in the
> 3) Pull libbacktrace.a inside libasan.a. This means we should teach
> the build system to merge two archives (or have access to backtrace
> sources at build time and recompile them ourselves). This is doable,
> but kind of ugly and leads to funny consequences - we'll fail to build
> libbacktrace itself with ASan (or, arguably, any program which uses
> I ask this because I'm slightly afraid libbacktrace symbolizer will be
> pretty undertested in the llvm tree and we may break it without
> noticing. Building it is not a problem, but making all the tests "just
> work" with it is harder.
Personally, I would recommend that you simply copy the libbacktrace
sources into your sources. It's less than 7000 lines of C code. You
can update the sources periodically as needed. In other words, pretty
much how the sanitizer code is handled, only in the other direction.
Note that libbacktrace is not currently installed, so you can't expect
-lbacktrace to work in general if you don't include the sources.