|
15 | 15 | //
|
16 | 16 | //===----------------------------------------------------------------------===
|
17 | 17 |
|
| 18 | +#include "llvm/IR/InlineAsm.h" |
| 19 | +#include "llvm/IR/LLVMContext.h" |
18 | 20 | #include "llvm/Linker.h"
|
19 | 21 | #include "llvm/PassManager.h"
|
20 | 22 | #include "llvm/IR/InlineAsm.h"
|
@@ -152,7 +154,9 @@ class RustMCJITMemoryManager : public JITMemoryManager {
|
152 | 154 | unsigned SectionID);
|
153 | 155 |
|
154 | 156 | 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); |
156 | 160 |
|
157 | 161 | virtual void *getPointerToNamedFunction(const std::string &Name,
|
158 | 162 | bool AbortOnFailure = true);
|
@@ -240,18 +244,24 @@ bool RustMCJITMemoryManager::loadCrate(const char* file, std::string* err) {
|
240 | 244 | }
|
241 | 245 |
|
242 | 246 | uint8_t *RustMCJITMemoryManager::allocateDataSection(uintptr_t Size,
|
243 |
| - unsigned Alignment, |
244 |
| - unsigned SectionID) { |
| 247 | + unsigned Alignment, |
| 248 | + unsigned SectionID, |
| 249 | + bool isReadOnly) { |
245 | 250 | if (!Alignment)
|
246 | 251 | Alignment = 16;
|
247 | 252 | uint8_t *Addr = (uint8_t*)calloc((Size + Alignment - 1)/Alignment, Alignment);
|
248 | 253 | AllocatedDataMem.push_back(sys::MemoryBlock(Addr, Size));
|
249 | 254 | return Addr;
|
250 | 255 | }
|
251 | 256 |
|
| 257 | +bool RustMCJITMemoryManager::applyPermissions(std::string *Str) { |
| 258 | + // Empty. |
| 259 | + return true; |
| 260 | +} |
| 261 | + |
252 | 262 | uint8_t *RustMCJITMemoryManager::allocateCodeSection(uintptr_t Size,
|
253 |
| - unsigned Alignment, |
254 |
| - unsigned SectionID) { |
| 263 | + unsigned Alignment, |
| 264 | + unsigned SectionID) { |
255 | 265 | if (!Alignment)
|
256 | 266 | Alignment = 16;
|
257 | 267 | unsigned NeedAllocate = Alignment * ((Size + Alignment - 1)/Alignment + 1);
|
@@ -485,13 +495,12 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
|
485 | 495 | }
|
486 | 496 |
|
487 | 497 | extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) {
|
488 |
| - |
489 | 498 | SMDiagnostic d;
|
490 | 499 | Module *m = ParseAssemblyFile(Filename, d, getGlobalContext());
|
491 | 500 | if (m) {
|
492 | 501 | return wrap(m);
|
493 | 502 | } else {
|
494 |
| - LLVMRustError = d.getMessage().data(); |
| 503 | + LLVMRustError = d.getMessage().str().c_str(); |
495 | 504 | return NULL;
|
496 | 505 | }
|
497 | 506 | }
|
|
0 commit comments