forked from OSchip/llvm-project
parent
82e8d07b02
commit
db18f328d7
|
|
@ -91,12 +91,12 @@ LTOModule* LTOModule::makeLTOModule(const char* path, std::string& errMsg)
|
|||
return makeLTOModule(buffer.get(), errMsg);
|
||||
}
|
||||
|
||||
|
||||
/// makeBuffer - create a MemoryBuffer from a memory range.
|
||||
/// MemoryBuffer requires the byte past end of the buffer to be a zero.
|
||||
/// We might get lucky and already be that way, otherwise make a copy.
|
||||
/// Also if next byte is on a different page, don't assume it is readable.
|
||||
MemoryBuffer* LTOModule::makeBuffer(const void* mem, size_t length)
|
||||
{
|
||||
// MemoryBuffer requires the byte past end of the buffer to be a zero.
|
||||
// We might get lucky and already be that way, otherwise make a copy.
|
||||
// Also if next byte is on a different page, don't assume it is readable.
|
||||
const char* startPtr = (char*)mem;
|
||||
const char* endPtr = startPtr+length;
|
||||
if ( (((uintptr_t)endPtr & (sys::Process::GetPageSize()-1)) == 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue