Re: [clang] 80ed75e - Revert "[NFC] Fix typos"

2021-08-16 Thread Kostya Kortchinsky via cfe-commits
Apologies.
As explained in another thread, this was a mistake of mine as I reverted 2
CLs instead of 1 (mine).
This was resolved with the original author.
My own CL ended up breaking some 32-bit builders.

On Mon, Aug 16, 2021 at 1:22 PM David Blaikie  wrote:

> Please include in the commit message a reason for a revert.
>
> On Mon, Aug 16, 2021 at 11:14 AM Kostya Kortchinsky via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>> Author: Kostya Kortchinsky
>> Date: 2021-08-16T11:13:05-07:00
>> New Revision: 80ed75e7fb45f9f5fc84ca7cbe258be036015384
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/80ed75e7fb45f9f5fc84ca7cbe258be036015384
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/80ed75e7fb45f9f5fc84ca7cbe258be036015384.diff
>>
>> LOG: Revert "[NFC] Fix typos"
>>
>> This reverts commit b7425e956be60a73004d7ae5bb37da85872c29fb.
>>
>> Added:
>>
>>
>> Modified:
>> clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
>> clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
>> compiler-rt/test/profile/Linux/instrprof-cs.c
>> llvm/include/llvm/Transforms/Instrumentation.h
>> llvm/lib/ProfileData/SampleProfReader.cpp
>>
>> Removed:
>>
>>
>>
>>
>> 
>> diff  --git
>> a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
>> b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
>> index a13de306eac84..175dfcef0df45 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
>> @@ -6,7 +6,7 @@
>>  //
>>
>>  
>> //===--===//
>>  //
>> -//  This file defines a CheckObjCInstMethSignature, a flow-insensitive
>> check
>> +//  This file defines a CheckObjCInstMethSignature, a flow-insenstive
>> check
>>  //  that determines if an Objective-C class interface incorrectly
>> redefines
>>  //  the method signature in a subclass.
>>  //
>>
>> diff  --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
>> b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
>> index dcca8be55e337..90c5583d89691 100644
>> --- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
>> +++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
>> @@ -6,7 +6,7 @@
>>  //
>>
>>  
>> //===--===//
>>  //
>> -//  This file defines a CheckNSError, a flow-insensitive check
>> +//  This file defines a CheckNSError, a flow-insenstive check
>>  //  that determines if an Objective-C class interface correctly returns
>>  //  a non-void return type.
>>  //
>>
>> diff  --git a/compiler-rt/test/profile/Linux/instrprof-cs.c
>> b/compiler-rt/test/profile/Linux/instrprof-cs.c
>> index 0ad6f0350c560..d825525a532db 100644
>> --- a/compiler-rt/test/profile/Linux/instrprof-cs.c
>> +++ b/compiler-rt/test/profile/Linux/instrprof-cs.c
>> @@ -8,7 +8,7 @@
>>  // RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s
>>  // RUN: %run %t.gen.cis
>>  // RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw
>> -// Check context insensitive profile
>> +// Check context insenstive profile
>>  // RUN: %clang_profuse=%t.cis.profdata  -O2 -emit-llvm -S %s -o - |
>> FileCheck %s --check-prefix=CIS
>>  int g1 = 1;
>>  int volatile g2 = 2;
>>
>> diff  --git a/llvm/include/llvm/Transforms/Instrumentation.h
>> b/llvm/include/llvm/Transforms/Instrumentation.h
>> index 0c822999aecf3..03108bacb0da5 100644
>> --- a/llvm/include/llvm/Transforms/Instrumentation.h
>> +++ b/llvm/include/llvm/Transforms/Instrumentation.h
>> @@ -78,7 +78,7 @@ struct GCOVOptions {
>>  ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
>> GCOVOptions::getDefault());
>>
>> -// PGO Instrumention. Parameter IsCS indicates if this is the context
>> sensitive
>> +// PGO Instrumention. Parameter IsCS indicates if this is the context
>> senstive
>>  // instrumentation.
>>  ModulePass *createPGOInstrumentationGenLegacyPass(bool IsCS = false);
>>  ModulePass *
>> @@ -138,7 +138,7 @@ struct InstrProfOptions {
>>  };
>>
>>  /// Insert frontend instrumentation based profiling. Parameter IsCS
>> indicates if
>> -// this is the

[clang] 80ed75e - Revert "[NFC] Fix typos"

2021-08-16 Thread Kostya Kortchinsky via cfe-commits

Author: Kostya Kortchinsky
Date: 2021-08-16T11:13:05-07:00
New Revision: 80ed75e7fb45f9f5fc84ca7cbe258be036015384

URL: 
https://github.com/llvm/llvm-project/commit/80ed75e7fb45f9f5fc84ca7cbe258be036015384
DIFF: 
https://github.com/llvm/llvm-project/commit/80ed75e7fb45f9f5fc84ca7cbe258be036015384.diff

LOG: Revert "[NFC] Fix typos"

This reverts commit b7425e956be60a73004d7ae5bb37da85872c29fb.

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
compiler-rt/test/profile/Linux/instrprof-cs.c
llvm/include/llvm/Transforms/Instrumentation.h
llvm/lib/ProfileData/SampleProfReader.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
index a13de306eac84..175dfcef0df45 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
@@ -6,7 +6,7 @@
 //
 
//===--===//
 //
-//  This file defines a CheckObjCInstMethSignature, a flow-insensitive check
+//  This file defines a CheckObjCInstMethSignature, a flow-insenstive check
 //  that determines if an Objective-C class interface incorrectly redefines
 //  the method signature in a subclass.
 //

diff  --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
index dcca8be55e337..90c5583d89691 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -6,7 +6,7 @@
 //
 
//===--===//
 //
-//  This file defines a CheckNSError, a flow-insensitive check
+//  This file defines a CheckNSError, a flow-insenstive check
 //  that determines if an Objective-C class interface correctly returns
 //  a non-void return type.
 //

diff  --git a/compiler-rt/test/profile/Linux/instrprof-cs.c 
b/compiler-rt/test/profile/Linux/instrprof-cs.c
index 0ad6f0350c560..d825525a532db 100644
--- a/compiler-rt/test/profile/Linux/instrprof-cs.c
+++ b/compiler-rt/test/profile/Linux/instrprof-cs.c
@@ -8,7 +8,7 @@
 // RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s
 // RUN: %run %t.gen.cis
 // RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw
-// Check context insensitive profile
+// Check context insenstive profile
 // RUN: %clang_profuse=%t.cis.profdata  -O2 -emit-llvm -S %s -o - | FileCheck 
%s --check-prefix=CIS
 int g1 = 1;
 int volatile g2 = 2;

diff  --git a/llvm/include/llvm/Transforms/Instrumentation.h 
b/llvm/include/llvm/Transforms/Instrumentation.h
index 0c822999aecf3..03108bacb0da5 100644
--- a/llvm/include/llvm/Transforms/Instrumentation.h
+++ b/llvm/include/llvm/Transforms/Instrumentation.h
@@ -78,7 +78,7 @@ struct GCOVOptions {
 ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
GCOVOptions::getDefault());
 
-// PGO Instrumention. Parameter IsCS indicates if this is the context sensitive
+// PGO Instrumention. Parameter IsCS indicates if this is the context senstive
 // instrumentation.
 ModulePass *createPGOInstrumentationGenLegacyPass(bool IsCS = false);
 ModulePass *
@@ -138,7 +138,7 @@ struct InstrProfOptions {
 };
 
 /// Insert frontend instrumentation based profiling. Parameter IsCS indicates 
if
-// this is the context sensitive instrumentation.
+// this is the context senstive instrumentation.
 ModulePass *createInstrProfilingLegacyPass(
 const InstrProfOptions &Options = InstrProfOptions(), bool IsCS = false);
 

diff  --git a/llvm/lib/ProfileData/SampleProfReader.cpp 
b/llvm/lib/ProfileData/SampleProfReader.cpp
index a801ca1ef36d7..6058eddb13dc7 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -53,7 +53,7 @@ using namespace sampleprof;
 // For ext-binary format profiles, the flag is set in the summary.
 static cl::opt ProfileIsFSDisciminator(
 "profile-isfs", cl::Hidden, cl::init(false),
-cl::desc("Profile uses flow sensitive discriminators"));
+cl::desc("Profile uses flow senstive discriminators"));
 
 /// Dump the function profile for \p FName.
 ///



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 41751b6 - [Clang][ASan] Correct AsanDtorKindToString to return non-void in default case

2021-02-25 Thread Kostya Kortchinsky via cfe-commits

Author: Kostya Kortchinsky
Date: 2021-02-25T15:32:18-08:00
New Revision: 41751b637317bd9c97b0506ba77075694cd2d9cf

URL: 
https://github.com/llvm/llvm-project/commit/41751b637317bd9c97b0506ba77075694cd2d9cf
DIFF: 
https://github.com/llvm/llvm-project/commit/41751b637317bd9c97b0506ba77075694cd2d9cf.diff

LOG: [Clang][ASan] Correct AsanDtorKindToString to return non-void in default 
case

Post D96572, a warning started showing up for me:
`clang/lib/Basic/Sanitizers.cpp:73:1: warning: control reaches end of non-void 
function [-Wreturn-type]`

So this adds a default to the case to return invalid, which seems appropriate,
and appears to correct the issue.

Differential Revision: https://reviews.llvm.org/D97496

Added: 


Modified: 
clang/lib/Basic/Sanitizers.cpp

Removed: 




diff  --git a/clang/lib/Basic/Sanitizers.cpp b/clang/lib/Basic/Sanitizers.cpp
index f4cd841b91dce..d8de850485eb4 100644
--- a/clang/lib/Basic/Sanitizers.cpp
+++ b/clang/lib/Basic/Sanitizers.cpp
@@ -70,6 +70,7 @@ StringRef AsanDtorKindToString(llvm::AsanDtorKind kind) {
   case llvm::AsanDtorKind::Invalid:
 return "invalid";
   }
+  return "invalid";
 }
 
 llvm::AsanDtorKind AsanDtorKindFromString(StringRef kindStr) {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r336202 - [Driver] Add PPC64 as supported for Scudo

2018-07-03 Thread Kostya Kortchinsky via cfe-commits
Author: cryptoad
Date: Tue Jul  3 07:39:29 2018
New Revision: 336202

URL: http://llvm.org/viewvc/llvm-project?rev=336202&view=rev
Log:
[Driver] Add PPC64 as supported for Scudo

Summary:
Scudo works on PPC64 as is, so mark the architecture as supported for it. This
will also require a change to config-ix.cmake on the compiler-rt side.

Update the tests accordingly.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48833

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=336202&r1=336201&r2=336202&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Tue Jul  3 07:39:29 2018
@@ -931,7 +931,8 @@ SanitizerMask Linux::getSupportedSanitiz
 Res |= SanitizerKind::Efficiency;
   if (IsX86 || IsX86_64)
 Res |= SanitizerKind::Function;
-  if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86 || IsMIPS || IsArmArch)
+  if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86 || IsMIPS || IsArmArch ||
+  IsPowerPC64)
 Res |= SanitizerKind::Scudo;
   if (IsX86_64 || IsAArch64) {
 Res |= SanitizerKind::HWAddress;

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=336202&r1=336201&r2=336202&view=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Tue Jul  3 07:39:29 2018
@@ -670,6 +670,8 @@
 // RUN: %clang -target mips64el-unknown-linux-gnu -fsanitize=scudo %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO
 // RUN: %clang -target mips-unknown-linux-gnu -fsanitize=scudo %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-SCUDO
 // RUN: %clang -target mipsel-unknown-linux-gnu -fsanitize=scudo %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-SCUDO
+// RUN: %clang -target powerpc64-unknown-linux -fsanitize=scudo %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-SCUDO
+// RUN: %clang -target powerpc64le-unknown-linux -fsanitize=scudo %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-SCUDO
 // CHECK-SCUDO: "-fsanitize=scudo"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-SCUDO-PIE


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r335620 - [Driver] Do not add -lpthread & -lrt with -static-libsan on Android

2018-06-26 Thread Kostya Kortchinsky via cfe-commits
Author: cryptoad
Date: Tue Jun 26 09:14:35 2018
New Revision: 335620

URL: http://llvm.org/viewvc/llvm-project?rev=335620&view=rev
Log:
[Driver] Do not add -lpthread & -lrt with -static-libsan on Android

Summary:
I am not sure anyone has tried to compile an application with sanitizers on
Android with `-static-libsan`, and a recent NDK, but it fails with:
```
.../i686-linux-android/bin/ld.gold: error: cannot find -lpthread
.../i686-linux-android/bin/ld.gold: error: cannot find -lrt
```
My understanding is that both are included in Bionic and as such are not needed,
and actually error out.

So remove the addition of those two in `linkSanitizerRuntimeDeps` when dealing
with Android, and update the tests.

I am unfamiliar with the evolution of the NDK and I am not sure if this has
always been the case or if this is somewhat of a recent evolution. I'll let
Android people chime in.

Reviewers: eugenis, pirama, srhines

Reviewed By: eugenis, srhines

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48570

Modified:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=335620&r1=335619&r2=335620&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Tue Jun 26 09:14:35 2018
@@ -564,8 +564,9 @@ void tools::linkSanitizerRuntimeDeps(con
   // Force linking against the system libraries sanitizers depends on
   // (see PR15823 why this is necessary).
   CmdArgs.push_back("--no-as-needed");
-  // There's no libpthread or librt on RTEMS.
-  if (TC.getTriple().getOS() != llvm::Triple::RTEMS) {
+  // There's no libpthread or librt on RTEMS & Android.
+  if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
+  !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
 if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
   CmdArgs.push_back("-lrt");

Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=335620&r1=335619&r2=335620&view=diff
==
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Tue Jun 26 09:14:35 2018
@@ -153,7 +153,8 @@
 //
 // CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
-// CHECK-ASAN-ANDROID-STATICLIBASAN: "-lpthread"
+// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
+// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
@@ -175,7 +176,8 @@
 //
 // CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN: 
libclang_rt.ubsan_standalone-arm-android.a"
-// CHECK-UBSAN-ANDROID-STATICLIBASAN: "-lpthread"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
 
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -735,7 +737,8 @@
 // CHECK-SCUDO-ANDROID-STATIC: "-pie"
 // CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" 
"{{.*}}libclang_rt.scudo-arm-android.a" "--no-whole-archive"
 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
-// CHECK-SCUDO-ANDROID-STATIC: "-lpthread"
+// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
+// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r335352 - [Driver] Make scudo compatible with -fsanitize-minimal-runtime

2018-06-22 Thread Kostya Kortchinsky via cfe-commits
Author: cryptoad
Date: Fri Jun 22 07:31:30 2018
New Revision: 335352

URL: http://llvm.org/viewvc/llvm-project?rev=335352&view=rev
Log:
[Driver] Make scudo compatible with -fsanitize-minimal-runtime

Summary:
This is the clang side of the change, there is a compiler-rt counterpart.

Scudo works with UBSan using `-fsanitize=scudo,integer` for example, and to do
so it embeds UBSan runtime. This makes it not compatible with the UBSan minimal
runtime, but this is something we want for production purposes.

The idea is to have a Scudo minimal runtime on the compiler-rt side that will
not embed UBSan. This is basically the runtime that is currently in use for
Fuchsia, without coverage, stacktraces or symbolization. With this, Scudo
becomes compatible with `-fsanitize-minimal-runtime`.

If this approach is suitable, I'll add the tests as well, otherwise I am open
to other options.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D48373

Modified:
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/test/Driver/fsanitize.c
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=335352&r1=335351&r2=335352&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Fri Jun 22 07:31:30 2018
@@ -45,7 +45,7 @@ enum : SanitizerMask {
   Nullability | LocalBounds | CFI,
   TrappingDefault = CFI,
   CFIClasses = CFIVCall | CFINVCall | CFIDerivedCast | CFIUnrelatedCast,
-  CompatibleWithMinimalRuntime = TrappingSupported,
+  CompatibleWithMinimalRuntime = TrappingSupported | Scudo,
 };
 
 enum CoverageFeature {
@@ -179,7 +179,8 @@ static SanitizerMask parseSanitizeTrapAr
 bool SanitizerArgs::needsUbsanRt() const {
   // All of these include ubsan.
   if (needsAsanRt() || needsMsanRt() || needsHwasanRt() || needsTsanRt() ||
-  needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() || needsScudoRt())
+  needsDfsanRt() || needsLsanRt() || needsCfiDiagRt() ||
+  (needsScudoRt() && !requiresMinimalRuntime()))
 return false;
 
   return (Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) ||

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=335352&r1=335351&r2=335352&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Fri Jun 22 07:31:30 2018
@@ -593,14 +593,17 @@ collectSanitizerRuntimes(const ToolChain
 HelperStaticRuntimes.push_back("asan-preinit");
 }
 if (SanArgs.needsUbsanRt()) {
-  if (SanArgs.requiresMinimalRuntime()) {
+  if (SanArgs.requiresMinimalRuntime())
 SharedRuntimes.push_back("ubsan_minimal");
-  } else {
+  else
 SharedRuntimes.push_back("ubsan_standalone");
-  }
 }
-if (SanArgs.needsScudoRt())
-  SharedRuntimes.push_back("scudo");
+if (SanArgs.needsScudoRt()) {
+  if (SanArgs.requiresMinimalRuntime())
+SharedRuntimes.push_back("scudo_minimal");
+  else
+SharedRuntimes.push_back("scudo");
+}
 if (SanArgs.needsHwasanRt())
   SharedRuntimes.push_back("hwasan");
   }
@@ -666,9 +669,15 @@ collectSanitizerRuntimes(const ToolChain
   if (SanArgs.needsEsanRt())
 StaticRuntimes.push_back("esan");
   if (SanArgs.needsScudoRt()) {
-StaticRuntimes.push_back("scudo");
-if (SanArgs.linkCXXRuntimes())
-  StaticRuntimes.push_back("scudo_cxx");
+if (SanArgs.requiresMinimalRuntime()) {
+  StaticRuntimes.push_back("scudo_minimal");
+  if (SanArgs.linkCXXRuntimes())
+StaticRuntimes.push_back("scudo_cxx_minimal");
+} else {
+  StaticRuntimes.push_back("scudo");
+  if (SanArgs.linkCXXRuntimes())
+StaticRuntimes.push_back("scudo_cxx");
+}
   }
 }
 

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=335352&r1=335351&r2=335352&view=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Fri Jun 22 07:31:30 2018
@@ -674,6 +674,14 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo,undefined %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO-UBSAN
 // CHECK-SCUDO-UBSAN: "-fsanitize={{.*}}scudo"
 
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo 
-fsanitize-minimal-runtime %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SCUDO-MINIMAL
+// CHECK-SCUDO-MINIMAL: "-fsanitize=scudo"
+// CHECK-SCUDO-MINIMAL: "-fsani

r317337 - [Driver] Add Scudo as a possible -fsanitize= option

2017-11-03 Thread Kostya Kortchinsky via cfe-commits
Author: cryptoad
Date: Fri Nov  3 10:04:13 2017
New Revision: 317337

URL: http://llvm.org/viewvc/llvm-project?rev=317337&view=rev
Log:
[Driver] Add Scudo as a possible -fsanitize= option

Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.

In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.

Reviewers: eugenis, kcc, alekseyshl

Reviewed By: eugenis, alekseyshl

Subscribers: llvm-commits, srhines

Differential Revision: https://reviews.llvm.org/D39334

Modified:
cfe/trunk/include/clang/Basic/Sanitizers.def
cfe/trunk/include/clang/Driver/SanitizerArgs.h
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/Driver/fsanitize.c
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/include/clang/Basic/Sanitizers.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Sanitizers.def?rev=317337&r1=317336&r2=317337&view=diff
==
--- cfe/trunk/include/clang/Basic/Sanitizers.def (original)
+++ cfe/trunk/include/clang/Basic/Sanitizers.def Fri Nov  3 10:04:13 2017
@@ -135,6 +135,9 @@ SANITIZER("efficiency-working-set", Effi
 SANITIZER_GROUP("efficiency-all", Efficiency,
 EfficiencyCacheFrag | EfficiencyWorkingSet)
 
+// Scudo hardened allocator
+SANITIZER("scudo", Scudo)
+
 // Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
 // can be used to disable all the sanitizers.
 SANITIZER_GROUP("all", All, ~0ULL)

Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=317337&r1=317336&r2=317337&view=diff
==
--- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Fri Nov  3 10:04:13 2017
@@ -72,6 +72,7 @@ class SanitizerArgs {
   bool needsEsanRt() const {
 return Sanitizers.hasOneOf(SanitizerKind::Efficiency);
   }
+  bool needsScudoRt() const { return Sanitizers.has(SanitizerKind::Scudo); }
 
   bool requiresPIE() const;
   bool needsUnwindTables() const;

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=317337&r1=317336&r2=317337&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Fri Nov  3 10:04:13 2017
@@ -30,7 +30,7 @@ enum : SanitizerMask {
   NeedsUbsanCxxRt = Vptr | CFI,
   NotAllowedWithTrap = Vptr,
   NotAllowedWithMinimalRuntime = Vptr,
-  RequiresPIE = DataFlow,
+  RequiresPIE = DataFlow | Scudo,
   NeedsUnwindTables = Address | Thread | Memory | DataFlow,
   SupportsCoverage = Address | KernelAddress | Memory | Leak | Undefined |
  Integer | Nullability | DataFlow | Fuzzer | FuzzerNoLink,
@@ -173,7 +173,7 @@ static SanitizerMask parseSanitizeTrapAr
 bool SanitizerArgs::needsUbsanRt() const {
   // All of these include ubsan.
   if (needsAsanRt() || needsMsanRt() || needsTsanRt() || needsDfsanRt() ||
-  needsLsanRt() || needsCfiDiagRt())
+  needsLsanRt() || needsCfiDiagRt() || needsScudoRt())
 return false;
 
   return (Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) ||
@@ -370,17 +370,14 @@ SanitizerArgs::SanitizerArgs(const ToolC
 
   // Warn about incompatible groups of sanitizers.
   std::pair IncompatibleGroups[] = {
-  std::make_pair(Address, Thread), std::make_pair(Address, Memory),
-  std::make_pair(Thread, Memory), std::make_pair(Leak, Thread),
-  std::make_pair(Leak, Memory), std::make_pair(KernelAddress, Address),
-  std::make_pair(KernelAddress, Leak),
-  std::make_pair(KernelAddress, Thread),
-  std::make_pair(KernelAddress, Memory),
-  std::make_pair(Efficiency, Address),
-  std::make_pair(Efficiency, Leak),
-  std::make_pair(Efficiency, Thread),
-  std::make_pair(Efficiency, Memory),
-  std::make_pair(Efficiency, KernelAddress)};
+  std::make_pair(Address, Thread | Memory),
+  std::make_pair(Thread, Memory),
+  std::make_pair(Leak, Thread | Memory),
+  std::make_pair(KernelAddress, Address| Leak | Thread | Memory),
+  std::make_pair(Efficiency, Address | Leak | Thread | Memory |
+ KernelAddress),
+  std::make_pair(Scudo, Address | L

r291598 - [Driver] Add openSuse AArch64 Triple

2017-01-10 Thread Kostya Kortchinsky via cfe-commits
Author: cryptoad
Date: Tue Jan 10 15:13:08 2017
New Revision: 291598

URL: http://llvm.org/viewvc/llvm-project?rev=291598&view=rev
Log:
[Driver] Add openSuse AArch64 Triple

Summary:
openSuse has AArch64 support, with images running on the Raspberry Pi 3.
The libraries and headers live under the aarch64-suse-linux subdirectory,
which is currently not in the AArch64 triples list. Address this by adding
the corresponding string to AArch64Triples.

Reviewers: chandlerc, bruno, bkramer, rengolin

Subscribers: aemerson, rengolin, cfe-commits

Differential Revision: https://reviews.llvm.org/D28238

Added:
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crt1.o
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crti.o
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crtn.o
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/

cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/

cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/

cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtbegin.o

cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtend.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=291598&r1=291597&r2=291598&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Jan 10 15:13:08 2017
@@ -1531,7 +1531,7 @@ bool Generic_GCC::GCCInstallationDetecto
   static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
   static const char *const AArch64Triples[] = {
   "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-linux-android",
-  "aarch64-redhat-linux"};
+  "aarch64-redhat-linux", "aarch64-suse-linux"};
   static const char *const AArch64beLibDirs[] = {"/lib"};
   static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
  "aarch64_be-linux-gnu"};

Added: cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crt1.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crt1.o?rev=291598&view=auto
==
(empty)

Added: cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crti.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crti.o?rev=291598&view=auto
==
(empty)

Added: cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crtn.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crtn.o?rev=291598&view=auto
==
(empty)

Added: 
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtbegin.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtbegin.o?rev=291598&view=auto
==
(empty)

Added: 
cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtend.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtend.o?rev=291598&view=auto
==
(empty)

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=291598&r1=291597&r2=291598&view=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Tue Jan 10 15:13:08 2017
@@ -618,6 +618,26 @@
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
 //
+// Check openSuse Leap 42.2 on AArch64
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
+// RUN