[PATCH] D100919: [AArch64] Support customizing stack protector guard

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 11 16:48:35 PDT 2021


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1917
+            .addDef(Reg)
+            .addImm(Options.StackProtectorGuardOffset >> 3);
+      else
----------------
dmgreen wrote:
> nickdesaulniers wrote:
> > dmgreen wrote:
> > > What is StackProtectorGuardOffset, and could is be out of range for the load? That is something that verify-machineinstrs won't currently check for.
> > It's passed from the front end; it's an offset added to the pointer load.  The Linux kernel uses a value in 1100-1200 range. GCC will let you use whatever large value and keep appending adds for constants greater than 32200: https://godbolt.org/z/1xhbEPbKG, but YAGNI.
> OK. It might be worth at least issuing a report_fatal_error if it is out of the range of the instructions handled here. Otherwise the error might be non-obvious, it just truncating the immediate during codegen.
Indeed, in particular it looks like the range of LDR is 0-32760 which is sufficient for the kernel, but the range for LDUR is only -256-255, which is not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100919/new/

https://reviews.llvm.org/D100919



More information about the cfe-commits mailing list