From 5b993fd70d003fed37b56af006f059761b80ddef Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sat, 22 Mar 2008 02:59:54 +0000 Subject: [PATCH] Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself. llvm-svn: 48677 --- llvm/include/llvm/System/Memory.h | 8 ++++++++ llvm/lib/System/Unix/Memory.inc | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/System/Memory.h b/llvm/include/llvm/System/Memory.h index 8c1c37a07ccc..d692b95c271f 100644 --- a/llvm/include/llvm/System/Memory.h +++ b/llvm/include/llvm/System/Memory.h @@ -57,6 +57,14 @@ namespace sys { const MemoryBlock *NearBlock, std::string *ErrMsg = 0); + /// This method allocates a block of Read/Write memory. This memory + /// needs to have executable permissions set before it can be used + /// to execute JIT'ed code. + /// + /// On success, this returns a non-null memory block, otherwise it returns + /// a null memory block and fills in *ErrMsg. + /// + /// @brief Allocate Read/Write/Execute memory. static MemoryBlock AllocateRW(unsigned NumBytes, const MemoryBlock *NearBlock, std::string *ErrMsg = 0); diff --git a/llvm/lib/System/Unix/Memory.inc b/llvm/lib/System/Unix/Memory.inc index 164988793f74..e0bf8d8dfdf6 100644 --- a/llvm/lib/System/Unix/Memory.inc +++ b/llvm/lib/System/Unix/Memory.inc @@ -103,7 +103,7 @@ llvm::sys::Memory::AllocateRW(unsigned NumBytes, const MemoryBlock* NearBlock, flags, fd, 0); if (pa == MAP_FAILED) { if (NearBlock) //Try again without a near hint - return AllocateRWX(NumBytes, 0); + return AllocateRW(NumBytes, 0); MakeErrMsg(ErrMsg, "Can't allocate RWX Memory"); return MemoryBlock(); -- GitLab