r299921 - [lsan] Enable LSan on arm Linux, clang part
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 5 11:06:07 PDT 2017
On Mon, Jun 5, 2017 at 10:28 AM Maxim Ostapenko <chefmax7 at gmail.com> wrote:
> On 05/06/17 20:16, David Blaikie wrote:
> > This change seemed to be buggy (& I assume missing test coverage to
> > demonstrate that). Galina fixed it in
> > http://llvm.org/viewvc/llvm-project?rev=304663&view=rev based on a
> > compiler warning.
>
> Oh, right, I've missed that. Sorry!
>
> >
> > Can you add test coverage to this code to exercise these untested
> > codepaths?
>
> But doesn't https://reviews.llvm.org/rL299921 introduce testcases for
> arm, thumb, armeb and thumbeb targets to clang driver?
Right, but none of the checks were being done - it was just always true.
The test coverage that's missing is something that would cause the 'if' on
line 877 in that patch to return false. So something that isn't x86_64,
isn't mips64, isn't aarch64, and isn't arm (so, maybe PPC? for example).
That test would demonstrate that lsan is still enabled in that case when it
shouldn't be, because the 'IsArmArch' is always true.
> Or perhaps I'm
> missing something?
>
> -Maxim
>
> >
> > On Tue, Apr 11, 2017 at 12:34 AM Maxim Ostapenko via cfe-commits
> > <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
> >
> > Author: chefmax
> > Date: Tue Apr 11 02:22:11 2017
> > New Revision: 299921
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=299921&view=rev
> > Log:
> > [lsan] Enable LSan on arm Linux, clang part
> >
> > This is a compiler part of https://reviews.llvm.org/D29586. Enable
> > LSan on arm Linux.
> >
> > Differential Revision: https://reviews.llvm.org/D31760
> >
> > Modified:
> > cfe/trunk/lib/Driver/ToolChains/Linux.cpp
> > cfe/trunk/test/Driver/fsanitize.c
> >
> > Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
> > URL:
> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=299921&r1=299920&r2=299921&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
> > +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Tue Apr 11 02:22:11
> 2017
> > @@ -864,6 +864,9 @@ SanitizerMask Linux::getSupportedSanitiz
> > getTriple().getArch() ==
> > llvm::Triple::ppc64le;
> > const bool IsAArch64 = getTriple().getArch() ==
> > llvm::Triple::aarch64 ||
> > getTriple().getArch() ==
> > llvm::Triple::aarch64_be;
> > + const bool IsArmArch = getTriple().getArch() ==
> > llvm::Triple::arm ||
> > + llvm::Triple::thumb ||
> > llvm::Triple::armeb ||
> > + llvm::Triple::thumbeb;
> > SanitizerMask Res = ToolChain::getSupportedSanitizers();
> > Res |= SanitizerKind::Address;
> > Res |= SanitizerKind::KernelAddress;
> > @@ -871,7 +874,7 @@ SanitizerMask Linux::getSupportedSanitiz
> > Res |= SanitizerKind::SafeStack;
> > if (IsX86_64 || IsMIPS64 || IsAArch64)
> > Res |= SanitizerKind::DataFlow;
> > - if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86)
> > + if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86 || IsArmArch)
> > Res |= SanitizerKind::Leak;
> > if (IsX86_64 || IsMIPS64 || IsAArch64 || IsPowerPC64)
> > Res |= SanitizerKind::Thread;
> >
> > Modified: cfe/trunk/test/Driver/fsanitize.c
> > URL:
> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=299921&r1=299920&r2=299921&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/Driver/fsanitize.c (original)
> > +++ cfe/trunk/test/Driver/fsanitize.c Tue Apr 11 02:22:11 2017
> > @@ -237,6 +237,30 @@
> > // RUN: %clang -target i686-linux-gnu -fsanitize=address,leak
> > -fno-sanitize=address %s -### 2>&1 | FileCheck %s
> > --check-prefix=CHECK-SANA-SANL-NO-SANA-X86
> > // CHECK-SANA-SANL-NO-SANA-X86: "-fsanitize=leak"
> >
> > +// RUN: %clang -target arm-linux-gnu -fsanitize=leak %s -### 2>&1
> > | FileCheck %s --check-prefix=CHECK-SANL-ARM
> > +// CHECK-SANL-ARM: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target arm-linux-gnu -fsanitize=address,leak
> > -fno-sanitize=address %s -### 2>&1 | FileCheck %s
> > --check-prefix=CHECK-SANA-SANL-NO-SANA-ARM
> > +// CHECK-SANA-SANL-NO-SANA-ARM: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target thumb-linux -fsanitize=leak %s -### 2>&1 |
> > FileCheck %s --check-prefix=CHECK-SANL-THUMB
> > +// CHECK-SANL-THUMB: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target thumb-linux -fsanitize=address,leak
> > -fno-sanitize=address %s -### 2>&1 | FileCheck %s
> > --check-prefix=CHECK-SANA-SANL-NO-SANA-THUMB
> > +// CHECK-SANA-SANL-NO-SANA-THUMB: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target armeb-linux-gnu -fsanitize=leak %s -###
> > 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-ARMEB
> > +// CHECK-SANL-ARMEB: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target armeb-linux-gnu -fsanitize=address,leak
> > -fno-sanitize=address %s -### 2>&1 | FileCheck %s
> > --check-prefix=CHECK-SANA-SANL-NO-SANA-ARMEB
> > +// CHECK-SANA-SANL-NO-SANA-ARMEB: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target thumbeb-linux -fsanitize=leak %s -### 2>&1
> > | FileCheck %s --check-prefix=CHECK-SANL-THUMBEB
> > +// CHECK-SANL-THUMBEB: "-fsanitize=leak"
> > +
> > +// RUN: %clang -target thumbeb-linux -fsanitize=address,leak
> > -fno-sanitize=address %s -### 2>&1 | FileCheck %s
> > --check-prefix=CHECK-SANA-SANL-NO-SANA-THUMBEB
> > +// CHECK-SANA-SANL-NO-SANA-THUMBEB: "-fsanitize=leak"
> > +
> > // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -###
> > 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN
> > // CHECK-MSAN: "-fno-assume-sane-operator-new"
> > // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s
> > -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170605/7458198d/attachment-0001.html>
More information about the cfe-commits
mailing list