[llvm] [hwasan] Add intrinsics for fixed shadow on Aarch64 (PR #89319)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 16:49:27 PDT 2024


================
@@ -625,14 +634,34 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) {
                                      .addImm(4)
                                      .addImm(55),
                                  *STI);
-    OutStreamer->emitInstruction(
-        MCInstBuilder(AArch64::LDRBBroX)
-            .addReg(AArch64::W16)
-            .addReg(IsShort ? AArch64::X20 : AArch64::X9)
-            .addReg(AArch64::X16)
-            .addImm(0)
-            .addImm(0),
-        *STI);
+
+    if (IsFixedShadow) {
+      std::optional<uint64_t> HwasanFixedShadowBase = getFixedShadowBase();
+
+      OutStreamer->emitInstruction(
+          MCInstBuilder(AArch64::MOVZXi)
+              .addReg(AArch64::X17)
+              .addImm(HwasanFixedShadowBase.value_or(0) >> 32)
----------------
fmayer wrote:

I don't understand `value_or(0)`. Shouldn't we crash instead?

https://github.com/llvm/llvm-project/pull/89319


More information about the llvm-commits mailing list