summaryrefslogtreecommitdiff
path: root/community/rubinius/llvm34.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/rubinius/llvm34.patch')
-rw-r--r--community/rubinius/llvm34.patch182
1 files changed, 182 insertions, 0 deletions
diff --git a/community/rubinius/llvm34.patch b/community/rubinius/llvm34.patch
new file mode 100644
index 000000000..ca8f2d289
--- /dev/null
+++ b/community/rubinius/llvm34.patch
@@ -0,0 +1,182 @@
+diff --git i/vm/llvm/disassembler.cpp w/vm/llvm/disassembler.cpp
+index 79c74ff..b3ea424 100644
+--- i/vm/llvm/disassembler.cpp
++++ w/vm/llvm/disassembler.cpp
+@@ -46,20 +46,27 @@ namespace rubinius {
+ #if RBX_LLVM_API_VER > 300
+ llvm::TargetOptions options;
+ options.NoFramePointerElim = true;
++#if RBX_LLVM_API_VER < 304
+ options.NoFramePointerElimNonLeaf = true;
++#endif
+ target_machine = target->createTargetMachine(host, llvm::sys::getHostCPUName(), "", options);
+ #else
+ target_machine = target->createTargetMachine(host, llvm::sys::getHostCPUName(), "");
+ #endif
+
+ sub_target = target->createMCSubtargetInfo(host, llvm::sys::getHostCPUName(), "");
+- asm_info = target->createMCAsmInfo(host);
+
+ #if RBX_LLVM_API_VER > 300
+ instr_info = target->createMCInstrInfo();
+ reg_info = target->createMCRegInfo(host);
+ #endif
+
++#if RBX_LLVM_API_VER > 303
++ asm_info = target->createMCAsmInfo(*reg_info, host);
++#else
++ asm_info = target->createMCAsmInfo(host);
++#endif
++
+ if(asm_info) {
+ disassembler = target->createMCDisassembler(*sub_target);
+ memory_object = new JITMemoryObject((const uint8_t*)buffer, (uint64_t) size);
+diff --git i/vm/llvm/jit_builder.cpp w/vm/llvm/jit_builder.cpp
+index 652350f..c479aab 100644
+--- i/vm/llvm/jit_builder.cpp
++++ w/vm/llvm/jit_builder.cpp
+@@ -56,12 +56,21 @@ namespace jit {
+ "", "rubinius", true, "", 0);
+ DIFile file = debug_builder().createFile(file_str, "");
+
++#if RBX_LLVM_API_VER > 303
++ DIType dummy_return_type = debug_builder().createNullPtrType();
++ Value* dummy_signature[] = {
++ &*dummy_return_type,
++ };
++ DICompositeType dummy_subroutine_type = debug_builder().createSubroutineType(file,
++ debug_builder().getOrCreateArray(dummy_signature));
++#else
+ DIType dummy_return_type = debug_builder().createNullPtrType("dummy type");
+ Value* dummy_signature[] = {
+ &*dummy_return_type,
+ };
+ DIType dummy_subroutine_type = debug_builder().createSubroutineType(file,
+ debug_builder().getOrCreateArray(dummy_signature));
++#endif
+
+ #if RBX_LLVM_API_VER > 300
+ DISubprogram subprogram = debug_builder().createFunction(file, "", "",
+diff --git i/vm/llvm/jit_context.cpp w/vm/llvm/jit_context.cpp
+index e555adb..594a63a 100644
+--- i/vm/llvm/jit_context.cpp
++++ w/vm/llvm/jit_context.cpp
+@@ -84,7 +84,9 @@ namespace rubinius {
+ #if RBX_LLVM_API_VER > 300
+ llvm::TargetOptions opts;
+ opts.NoFramePointerElim = true;
++#if RBX_LLVM_API_VER < 304
+ opts.NoFramePointerElimNonLeaf = true;
++#endif
+ opts.JITEmitDebugInfo = true;
+
+ factory.setTargetOptions(opts);
+diff --git i/vm/llvm/jit_memory_manager.hpp w/vm/llvm/jit_memory_manager.hpp
+index 8a58a09..7205f89 100644
+--- i/vm/llvm/jit_memory_manager.hpp
++++ w/vm/llvm/jit_memory_manager.hpp
+@@ -202,7 +202,7 @@ namespace jit {
+
+ public:
+ RubiniusJITMemoryManager();
+- ~RubiniusJITMemoryManager();
++ virtual ~RubiniusJITMemoryManager();
+
+ /// allocateNewSlab - Allocates a new MemoryBlock and remembers it as the
+ /// last slab it allocated, so that subsequent allocations follow it.
+@@ -356,8 +356,13 @@ namespace jit {
+ }
+
+ /// allocateCodeSection - Allocate memory for a code section.
++#if RBX_LLVM_API_VER > 303
++ virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
++ unsigned SectionID, StringRef SectionName) {
++#else
+ uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID) {
++#endif
+ utilities::thread::SpinLock::LockGuard guard(lock_);
+ // Grow the required block size to account for the block header
+ Size += sizeof(*CurBlock);
+@@ -397,11 +402,21 @@ namespace jit {
+ }
+
+ /// allocateDataSection - Allocate memory for a data section.
+- uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+- unsigned SectionID) {
++ /// TODO: currently IsReadOnly is ignored.
++#if RBX_LLVM_API_VER > 303
++ virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
++ unsigned SectionID, StringRef SectionName,
++ bool IsReadOnly) {
+ utilities::thread::SpinLock::LockGuard guard(lock_);
+ return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
+ }
++#else
++ uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
++ unsigned SectionID, bool IsReadOnly) {
++ utilities::thread::SpinLock::LockGuard guard(lock_);
++ return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
++ }
++#endif
+
+ /// startExceptionTable - Use startFunctionBody to allocate memory for the
+ /// function's exception table.
+@@ -495,7 +510,7 @@ namespace jit {
+ , GOTBase(NULL)
+ {}
+
+- ~RubiniusRequestJITMemoryManager() {
++ virtual ~RubiniusRequestJITMemoryManager() {
+ if(GOTBase) delete[] GOTBase;
+ }
+
+@@ -504,17 +519,32 @@ namespace jit {
+ return mgr_->getPointerToNamedFunction(Name, AbortOnFailure);
+ }
+
++#if RBX_LLVM_API_VER >= 304
++ virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
++ unsigned SectionID, StringRef SectionName) {
++ return mgr_->allocateCodeSection(Size, Alignment, SectionID,
++ SectionName);
++ }
++#else
+ uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID) {
+ return mgr_->allocateCodeSection(Size, Alignment, SectionID);
+ }
++#endif
+
+ /// allocateDataSection - Allocate memory for a data section.
+-#if RBX_LLVM_API_VER >= 303
++#if RBX_LLVM_API_VER >= 304
++ virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
++ unsigned SectionID, StringRef SectionName,
++ bool IsReadOnly) {
++ return mgr_->allocateDataSection(Size, Alignment, SectionID,
++ SectionName, IsReadOnly);
++ }
++#elif RBX_LLVM_API_VER >= 303
+ uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID, bool IsReadOnly) {
+- // TODO: currently IsReadOnly is ignored.
+- return mgr_->allocateDataSection(Size, Alignment, SectionID);
++ return mgr_->allocateDataSection(Size, Alignment, SectionID,
++ IsReadOnly);
+ }
+ #else
+ uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+@@ -601,6 +631,12 @@ namespace jit {
+ void resetGeneratedFunction() {
+ GeneratedFunction = NULL;
+ }
++
++#if RBX_LLVM_API_VER > 303
++ virtual bool finalizeMemory(std::string* ErrMsg = 0) {
++ return false;
++ }
++#endif
+ };
+
+