[PATCH] D35558: Use sys::Memory::AllocateRWX for JIT code
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 27 12:38:00 PDT 2017
lhames added a comment.
Ok - I've finally had a chance to read AllocateRWX (sorry - it has been a busy week) and it does indeed try to allocate RWX pages, at least on Darwin and Linux. I assume the 'PROT_MPROTECT(PROT_EXEC)' bit for NetBSD is the W^X extension you referenced earlier.
The proper API for existing JIT use-cases should consist of two parts: allocateFutureExecutablePage(...) which should allocate RW- pages on all platforms (as well as marking the page as 'future-executable' for NetBSD), and makePageExecutable(...) which should toggle from RW- to R-X mode on all platforms.
More information about the llvm-commits