[PATCH] D78650: [MC][AArch64] Fail if x18 is reserved and used

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 13:03:23 PDT 2020


efriedma added a comment.

The "reserved" bit means that the compiler isn't supposed to use it as a general-purpose register, not that the code isn't allowed to touch it at all.  Take, for example, the use of x18 on Android.  x18 is reserved there, but the compiler actually uses the register in some cases: when shadow-call-stack is enabled, x18 points to the address of the shadow stack, and the compiler uses it to lower the prologue/epilogue of functions.  So with this change, code on Android fails to compile with -save-temps.

If you have some policy that assembly in certain files isn't allowed to access x18, you need to enforce that some other way.  We could add a new mechanism to enforce it at compile-time, I guess, but I'm not sure it would carry its weight.  Like you noted, it's straightforward to scan the generated binary for instructions that reference x18.


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

https://reviews.llvm.org/D78650





More information about the llvm-commits mailing list