aboutsummaryrefslogtreecommitdiffstats
path: root/emulators/rpcs3
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2018-02-04 11:18:19 +0800
committerjbeich <jbeich@FreeBSD.org>2018-02-04 11:18:19 +0800
commit9c9c2fda7224d01cff94bbca316ac3d8197b0f44 (patch)
tree0c005e41ac88ad4bd1d24e2c81e8179275d6dd2d /emulators/rpcs3
parente5359a953b32055ab33ca0decb562b4143312d33 (diff)
downloadfreebsd-ports-gnome-9c9c2fda7224d01cff94bbca316ac3d8197b0f44.tar.gz
freebsd-ports-gnome-9c9c2fda7224d01cff94bbca316ac3d8197b0f44.tar.zst
freebsd-ports-gnome-9c9c2fda7224d01cff94bbca316ac3d8197b0f44.zip
emulators/rpcs3: switch to llvm50
LLVM PPU is still unstable on FreeBSD, so allow users to play with different versions of it. By default use the same version as Mesa. MFH: 2018Q1
Diffstat (limited to 'emulators/rpcs3')
-rw-r--r--emulators/rpcs3/Makefile5
-rw-r--r--emulators/rpcs3/files/patch-llvm6125
2 files changed, 129 insertions, 1 deletions
diff --git a/emulators/rpcs3/Makefile b/emulators/rpcs3/Makefile
index c0ca8daee93f..92e2ebabe46c 100644
--- a/emulators/rpcs3/Makefile
+++ b/emulators/rpcs3/Makefile
@@ -4,6 +4,7 @@ PORTNAME= rpcs3
DISTVERSIONPREFIX= v
DISTVERSION= 0.0.4-301
DISTVERSIONSUFFIX= -g55821041b
+PORTREVISION= 1
CATEGORIES= emulators
MAINTAINER= jbeich@FreeBSD.org
@@ -44,6 +45,7 @@ CMAKE_ON= CMAKE_SKIP_RPATH USE_SYSTEM_FFMPEG USE_SYSTEM_LIBPNG
CXXFLAGS+= -D_GLIBCXX_USE_C99 # XXX ports/193528
CXXFLAGS+= -Wno-macro-redefined # __STDC_*_MACROS sys/cdefs.h vs. llvm-config
LDFLAGS+= -Wl,--as-needed # GLU
+MESA_LLVM_VER?= 50
OPTIONS_DEFINE= ALSA EVDEV GDB LLVM PULSEAUDIO VULKAN
OPTIONS_DEFAULT=ALSA LLVM VULKAN
@@ -63,7 +65,8 @@ GDB_DESC= GDB remote stub (powerpc64 target)
GDB_CMAKE_BOOL= WITH_GDB
LLVM_DESC= LLVM-based PPU recompiler
-LLVM_BUILD_DEPENDS= llvm40>0:devel/llvm40
+LLVM_BUILD_DEPENDS= llvm${MESA_LLVM_VER}>0:devel/llvm${MESA_LLVM_VER}
+LLVM_CMAKE_ON= -DLLVM_DIR:PATH=${LOCALBASE}/llvm${MESA_LLVM_VER}/lib/cmake/llvm
LLVM_CMAKE_BOOL_OFF= WITHOUT_LLVM
PULSEAUDIO_LIB_DEPENDS= libpulse-simple.so:audio/pulseaudio
diff --git a/emulators/rpcs3/files/patch-llvm6 b/emulators/rpcs3/files/patch-llvm6
new file mode 100644
index 000000000000..a701e57e02bb
--- /dev/null
+++ b/emulators/rpcs3/files/patch-llvm6
@@ -0,0 +1,125 @@
+Based on https://github.com/hcorion/rpcs3/commit/017958c93018
+
+--- Utilities/JIT.cpp.orig 2018-02-02 08:17:12 UTC
++++ Utilities/JIT.cpp
+@@ -71,7 +71,7 @@ static void* s_next = s_memory;
+ #ifdef _WIN32
+ static std::deque<std::vector<RUNTIME_FUNCTION>> s_unwater;
+ static std::vector<std::vector<RUNTIME_FUNCTION>> s_unwind; // .pdata
+-#else
++#elif LLVM_VERSION_MAJOR < 5
+ static std::deque<std::tuple<u8*, u64, std::size_t>> s_unfire;
+ #endif
+
+@@ -107,12 +107,16 @@ extern void jit_finalize()
+ }
+ } mem;
+
++#if LLVM_VERSION_MAJOR < 5
+ for (auto&& t : s_unfire)
+ {
+ mem.deregisterEHFrames(std::get<0>(t), std::get<1>(t), std::get<2>(t));
+ }
+
+ s_unfire.clear();
++#else
++ mem.deregisterEHFrames();
++#endif // LLVM_VERSION_MAJOR < 5
+ #endif
+
+ utils::memory_decommit(s_memory, s_memory_size);
+@@ -286,14 +290,18 @@ struct MemoryManager : llvm::RTDyldMemoryManager
+ {
+ s_unwind.emplace_back(std::move(pdata));
+ }
+-#else
++#elif LLVM_VERSION_MAJOR < 5
+ s_unfire.push_front(std::make_tuple(addr, load_addr, size));
+ #endif
+
+ return RTDyldMemoryManager::registerEHFrames(addr, load_addr, size);
+ }
+
++#if LLVM_VERSION_MAJOR < 5
+ void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
++#else
++ virtual void deregisterEHFrames() override
++#endif
+ {
+ }
+ };
+@@ -380,7 +388,11 @@ class ObjectCache final : public llvm::ObjectCache (pu
+ {
+ if (fs::file cached{path, fs::read})
+ {
++#if LLVM_VERSION_MAJOR < 6
+ auto buf = llvm::MemoryBuffer::getNewUninitMemBuffer(cached.size());
++#else
++ auto buf = llvm::WritableMemoryBuffer::getNewUninitMemBuffer(cached.size());
++#endif
+ cached.read(const_cast<char*>(buf->getBufferStart()), buf->getBufferSize());
+ return buf;
+ }
+--- rpcs3/CMakeLists.txt.orig 2018-02-02 08:17:12 UTC
++++ rpcs3/CMakeLists.txt
+@@ -173,7 +173,7 @@ set(CMAKE_MODULE_PATH "${RPCS3_SRC_DIR}/cmake_modules"
+ find_package(OpenGL REQUIRED)
+ find_package(OpenAL REQUIRED)
+ if(NOT WITHOUT_LLVM)
+- find_package(LLVM 4.0 CONFIG)
++ find_package(LLVM CONFIG)
+ if(NOT LLVM_FOUND)
+ message("System LLVM was not found, LLVM will be built from the submodule.")
+
+--- rpcs3/Emu/Cell/PPUTranslator.cpp.orig 2018-02-02 08:17:12 UTC
++++ rpcs3/Emu/Cell/PPUTranslator.cpp
+@@ -16,7 +16,11 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Mod
+ , m_module(module)
+ , m_is_be(false)
+ , m_info(info)
++#if LLVM_VERSION_MAJOR < 5
+ , m_pure_attr(AttributeSet::get(m_context, AttributeSet::FunctionIndex, {Attribute::NoUnwind, Attribute::ReadNone}))
++#else
++ , m_pure_attr(AttributeList::get(m_context,AttributeList::FunctionIndex, AttrBuilder().addAttribute(Attribute::NoUnwind).addAttribute(Attribute::ReadNone)))
++#endif
+ {
+ // There is no weak linkage on JIT, so let's create variables with different names for each module part
+ const u32 gsuffix = m_info.name.empty() ? info.funcs[0].addr : info.funcs[0].addr - m_info.segs[0].addr;
+--- rpcs3/Emu/Cell/PPUTranslator.h.orig 2018-02-02 08:17:12 UTC
++++ rpcs3/Emu/Cell/PPUTranslator.h
+@@ -120,7 +120,11 @@ class PPUTranslator final //: public CPUTranslator
+ std::map<u64, const ppu_reloc*> m_relocs;
+
+ // Attributes for function calls which are "pure" and may be optimized away if their results are unused
++#if LLVM_VERSION_MAJOR < 5
+ const llvm::AttributeSet m_pure_attr;
++#else
++ const llvm::AttributeList m_pure_attr;
++#endif
+
+ // IR builder
+ llvm::IRBuilder<>* m_ir;
+@@ -404,7 +408,11 @@ class PPUTranslator final //: public CPUTranslator
+
+ // Call a function with attribute list
+ template<typename... Args>
++#if LLVM_VERSION_MAJOR < 5
+ llvm::CallInst* Call(llvm::Type* ret, llvm::AttributeSet attr, llvm::StringRef name, Args... args)
++#else
++ llvm::CallInst* Call(llvm::Type* ret, llvm::AttributeList attr, llvm::StringRef name, Args... args)
++#endif
+ {
+ // Call the function
+ return m_ir->CreateCall(m_module->getOrInsertFunction(name, llvm::FunctionType::get(ret, {args->getType()...}, false), attr), {args...});
+@@ -414,7 +422,11 @@ class PPUTranslator final //: public CPUTranslator
+ template<typename... Args>
+ llvm::CallInst* Call(llvm::Type* ret, llvm::StringRef name, Args... args)
+ {
++#if LLVM_VERSION_MAJOR < 5
+ return Call(ret, llvm::AttributeSet{}, name, args...);
++#else
++ return Call(ret, llvm::AttributeList{}, name, args...);
++#endif
+ }
+
+ // Handle compilation errors