Skip to content

Commit 1a25347

Browse files
MaskRaytstellar
authored andcommitted
[Driver] Support -fsanitize=shadow-call-stack on aarch64_be
Fixes https://bugs.llvm.org/show_bug.cgi?id=46076 Reviewed By: nickdesaulniers, pcc Differential Revision: https://reviews.llvm.org/D80647 (cherry picked from commit a2a3e9f)
1 parent be4501f commit 1a25347

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
454454
<< lastArgumentForMask(D, Args, Kinds & NeedsLTO) << "-flto";
455455
}
456456

457-
if ((Kinds & SanitizerKind::ShadowCallStack) &&
458-
TC.getTriple().getArch() == llvm::Triple::aarch64 &&
457+
if ((Kinds & SanitizerKind::ShadowCallStack) && TC.getTriple().isAArch64() &&
459458
!llvm::AArch64::isX18ReservedByDefault(TC.getTriple()) &&
460459
!Args.hasArg(options::OPT_ffixed_x18)) {
461460
D.Diag(diag::err_drv_argument_only_allowed_with)

clang/test/Driver/fsanitize.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,10 @@
809809
// CHECK-SCS-MINIMAL: "-fsanitize=shadow-call-stack"
810810
// CHECK-SCS-MINIMAL: "-fsanitize-minimal-runtime"
811811

812+
// RUN: %clang -target aarch64 -fsanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s --check-prefix=AARCH64-SCS
813+
// RUN: %clang -target aarch64_be -fsanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s --check-prefix=AARCH64-SCS
814+
// AARCH64-SCS: "-fsanitize=shadow-call-stack"
815+
812816
// RUN: %clang -target aarch64-linux-gnu -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO
813817
// RUN: %clang -target arm-linux-androideabi -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO
814818
// RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO

0 commit comments

Comments
 (0)