[PATCH] D45303: shadowcallstack: Make runtime tests compatible with aarch64.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 6 14:51:37 PDT 2018


pcc added inline comments.


================
Comment at: compiler-rt/test/shadowcallstack/minimal_runtime.h:28
+#elif defined(__aarch64__)
+  __asm__ __volatile__("mov x18, %0" ::"r"(stack));
+#else
----------------
eugenis wrote:
> Why do you need anything above this line to not use libc? Why does it matter if they clobber x18 before it is set? It looks like scs_mmap_anon, for example, could be just libc mmap.
Hmm, I think you're right. I will check whether that works. 

I guess my only concern would be that these functions could somehow depend on having used the regular libc entry point, but it's hard to see how that could happen in practice.

That said, it occurred to me that we can avoid defining our own entry point just by defining `main` in this function and having it initialize the SCS and call an `scs_main` function which would be provided by the test. That would also work on x86 so we could avoid having two code paths. What do you think?


https://reviews.llvm.org/D45303





More information about the llvm-commits mailing list