This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Implement Undefined Behavior Sanitizer
- From: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, richard <richard at metafoo dot co dot uk>
- Cc: Andrew Pinski <pinskia at gmail dot com>, Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 6 Jun 2013 12:55:17 +0400
- Subject: Re: [RFC] Implement Undefined Behavior Sanitizer
- References: <20130605175728 dot GD4160 at redhat dot com> <CA+=Sn1nFBaZdXj6X+EAc3gzd-Nvky=OGo2Ja-z37qmrV1txD-w at mail dot gmail dot com> <20130605192308 dot GW1493 at tucnak dot redhat dot com> <CA+=Sn1m881terhbJB8vMp9fu+U0FQb24B6AbX1dUqEyimEVDGA at mail dot gmail dot com> <CAGQ9bdxzDRYkKxy+T2V9zTgai8TatPXtQmBRMkArhN5f5CSS-w at mail dot gmail dot com> <20130606082107 dot GZ1493 at tucnak dot redhat dot com> <CA+=Sn1=E+L54V17H38sA3gcEBxH7L8LjHk_FTSHB2i_eqf6B1g at mail dot gmail dot com> <CAGQ9bdx+vJh49sQxmwm9T-TPX0pxpDnK52u0zG8YmbhAcH6wFA at mail dot gmail dot com> <20130606084453 dot GB1493 at tucnak dot redhat dot com>
On Thu, Jun 6, 2013 at 12:44 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jun 06, 2013 at 12:41:56PM +0400, Konstantin Serebryany wrote:
>> As for libstdc++, I completely agree, we don't want to depend on it,
>> and we don't.
>
> ubsan actually needs
> U _ZTIN10__cxxabiv117__class_type_infoE@@CXXABI_1.3
> U _ZTIN10__cxxabiv120__si_class_type_infoE@@CXXABI_1.3
> U _ZTIN10__cxxabiv121__vmi_class_type_infoE@@CXXABI_1.3
> U _ZTISt9type_info@@GLIBCXX_3.4
> U __dynamic_cast@@CXXABI_1.3
These things are needed only for the C++-specific undefined behavior checking.
At least, if I compile a C test using clang -fsanitize=undefined I
don't see any of these.
Richard, am I right?
> plus all the libs have:
> w __cxa_demangle@@CXXABI_1.3
This beast is declared as weak:
sanitizer_common/sanitizer_symbolizer_itanium.cc
extern "C" char *__cxa_demangle(const char *mangled, char *buffer,
size_t *length, int *status)
SANITIZER_WEAK_ATTRIBUTE;
If we have the C++ run-time linked-in, we can use __cxa_demangle.
If we don't have the C++ run-time, we most likely don't need
__cxa_demangle either.
You can confirm this by building some C program with "clang
-fsanitize=address" -- it will not depend on libc++.
--kcc
>
> Jakub