[PATCH] D87581: [RISCV][ASAN] instrumentation pass now uses proper shadow offset
Anatoly Parshincev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 12 18:20:28 PDT 2020
EccoTheDolphin created this revision.
Herald added subscribers: llvm-commits, evandro, luismarques, sameer.abuasal, s.egerton, lenary, Jim, benna, psnobl, PkmX, rogfer01, shiva0217, kito-cheng, simoncook, hiraditya.
Herald added a project: LLVM.
EccoTheDolphin requested review of this revision.
[10/11] of commits implementing asan port of RISCV
Depends On D87580 <https://reviews.llvm.org/D87580>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87581
Files:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -105,6 +105,7 @@
static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37;
static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36;
+static const uint64_t kRiscv64_ShadowOffset64 = 0x20000000;
static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46;
static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30;
@@ -447,6 +448,7 @@
bool IsMIPS64 = TargetTriple.isMIPS64();
bool IsArmOrThumb = TargetTriple.isARM() || TargetTriple.isThumb();
bool IsAArch64 = TargetTriple.getArch() == Triple::aarch64;
+ bool IsRISCV64 = TargetTriple.getArch() == Triple::riscv64;
bool IsWindows = TargetTriple.isOSWindows();
bool IsFuchsia = TargetTriple.isOSFuchsia();
bool IsMyriad = TargetTriple.getVendor() == llvm::Triple::Myriad;
@@ -515,6 +517,8 @@
Mapping.Offset = kDynamicShadowSentinel;
else if (IsAArch64)
Mapping.Offset = kAArch64_ShadowOffset64;
+ else if (IsRISCV64)
+ Mapping.Offset = kRiscv64_ShadowOffset64;
else
Mapping.Offset = kDefaultShadowOffset64;
}
@@ -533,6 +537,7 @@
// we could OR the constant in a single instruction, but it's more
// efficient to load it once and use indexed addressing.
Mapping.OrShadowOffset = !IsAArch64 && !IsPPC64 && !IsSystemZ && !IsPS4CPU &&
+ !IsRISCV64 &&
!(Mapping.Offset & (Mapping.Offset - 1)) &&
Mapping.Offset != kDynamicShadowSentinel;
bool IsAndroidWithIfuncSupport =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87581.291436.patch
Type: text/x-patch
Size: 1854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200913/4773e2e6/attachment.bin>
More information about the llvm-commits
mailing list