Skip to content

Commit be58f60

Browse files
committed
---
yaml --- r: 72125 b: refs/heads/dist-snap c: af42d37 h: refs/heads/master i: 72123: 0adf2c2 v: v3
1 parent 4d459e5 commit be58f60

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: f903ae9e72ec02539373da22fd4d025422af7554
10+
refs/heads/dist-snap: af42d37547c15732a7c9d358c0a14967aef75e96
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/rustllvm/RustWrapper.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
//
1616
//===----------------------------------------------------------------------===
1717

18+
#include "llvm/IR/InlineAsm.h"
19+
#include "llvm/IR/LLVMContext.h"
1820
#include "llvm/Linker.h"
1921
#include "llvm/PassManager.h"
2022
#include "llvm/IR/InlineAsm.h"
@@ -152,7 +154,9 @@ class RustMCJITMemoryManager : public JITMemoryManager {
152154
unsigned SectionID);
153155

154156
virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
155-
unsigned SectionID);
157+
unsigned SectionID, bool isReadOnly);
158+
159+
virtual bool applyPermissions(std::string *Str);
156160

157161
virtual void *getPointerToNamedFunction(const std::string &Name,
158162
bool AbortOnFailure = true);
@@ -240,18 +244,24 @@ bool RustMCJITMemoryManager::loadCrate(const char* file, std::string* err) {
240244
}
241245

242246
uint8_t *RustMCJITMemoryManager::allocateDataSection(uintptr_t Size,
243-
unsigned Alignment,
244-
unsigned SectionID) {
247+
unsigned Alignment,
248+
unsigned SectionID,
249+
bool isReadOnly) {
245250
if (!Alignment)
246251
Alignment = 16;
247252
uint8_t *Addr = (uint8_t*)calloc((Size + Alignment - 1)/Alignment, Alignment);
248253
AllocatedDataMem.push_back(sys::MemoryBlock(Addr, Size));
249254
return Addr;
250255
}
251256

257+
bool RustMCJITMemoryManager::applyPermissions(std::string *Str) {
258+
// Empty.
259+
return true;
260+
}
261+
252262
uint8_t *RustMCJITMemoryManager::allocateCodeSection(uintptr_t Size,
253-
unsigned Alignment,
254-
unsigned SectionID) {
263+
unsigned Alignment,
264+
unsigned SectionID) {
255265
if (!Alignment)
256266
Alignment = 16;
257267
unsigned NeedAllocate = Alignment * ((Size + Alignment - 1)/Alignment + 1);
@@ -485,13 +495,12 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
485495
}
486496

487497
extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) {
488-
489498
SMDiagnostic d;
490499
Module *m = ParseAssemblyFile(Filename, d, getGlobalContext());
491500
if (m) {
492501
return wrap(m);
493502
} else {
494-
LLVMRustError = d.getMessage().data();
503+
LLVMRustError = d.getMessage().str().c_str();
495504
return NULL;
496505
}
497506
}

0 commit comments

Comments
 (0)