Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jul 2017 00:08:25 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r445552 - in head/emulators/rpcs3: . files
Message-ID:  <201707120008.v6C08PZf059325@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Wed Jul 12 00:08:24 2017
New Revision: 445552
URL: https://svnweb.freebsd.org/changeset/ports/445552

Log:
  emulators/rpcs3: work around LLVM recompiler crash
  
  Assertion failed: ((Type == ELF::R_X86_64_32 && (Value <= UINT32_MAX)) || (Type == ELF::R_X86_64_32S && ((int64_t)Value <= INT32_MAX && (int64_t)Value >= INT32_MIN))), function resolveX86_64Relocation, file /usr/ports/devel/llvm40/work/llvm-4.0.1.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp, line 287.

Added:
  head/emulators/rpcs3/files/patch-Utilities_JIT.cpp
     - copied, changed from r445550, head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp
Modified:
  head/emulators/rpcs3/Makefile

Modified: head/emulators/rpcs3/Makefile
==============================================================================
--- head/emulators/rpcs3/Makefile	Wed Jul 12 00:06:23 2017	(r445551)
+++ head/emulators/rpcs3/Makefile	Wed Jul 12 00:08:24 2017	(r445552)
@@ -4,6 +4,7 @@ PORTNAME=	rpcs3
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.0.2-423
 DISTVERSIONSUFFIX=	-g34709eb3
+PORTREVISION=	1
 CATEGORIES=	emulators
 
 MAINTAINER=	jbeich@FreeBSD.org

Copied and modified: head/emulators/rpcs3/files/patch-Utilities_JIT.cpp (from r445550, head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp)
==============================================================================
--- head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp	Tue Jul 11 21:43:28 2017	(r445550, copy source)
+++ head/emulators/rpcs3/files/patch-Utilities_JIT.cpp	Wed Jul 12 00:08:24 2017	(r445552)
@@ -1,35 +1,35 @@
---- Common/MemoryUtil.cpp.orig	2015-11-19 15:07:48 UTC
-+++ Common/MemoryUtil.cpp
-@@ -32,6 +32,10 @@
- #include <mach/vm_param.h>
+--- Utilities/JIT.cpp.orig	2017-07-10 15:42:02 UTC
++++ Utilities/JIT.cpp
+@@ -31,6 +31,10 @@
+ #include <Windows.h>
  #endif
  
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 +#include <sys/resource.h>
 +#endif
 +
- #ifndef _WIN32
- #include <unistd.h>
- #endif
-@@ -149,6 +153,21 @@ void *AllocateExecutableMemory(size_t si
- 			map_hint = (char*)round_page(&hint_location) - 0x20000000; // 0.5gb lower than our approximate location
- 		else
- 			map_hint = (char*)0x20000000; // 0.5GB mark in memory
+ #include "JIT.h"
+ 
+ // Memory manager mutex
+@@ -45,6 +49,21 @@ static void* const s_memory = []() -> void*
+ 	llvm::InitializeNativeTarget();
+ 	llvm::InitializeNativeTargetAsmPrinter();
+ 	LLVMLinkInMCJIT();
 +
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-+		// XXX Fix maximum data segment size (data + BSS + heap) to 256 MB.
-+		// This allows avoiding calling mmap(2) with MAP_FIXED.
-+		// On FreeBSD, without lowering this limit, calling mmap(2)
-+		// without MAP_FIXED will result in getting an address just
-+		// beyond maximum data segment size which will be far beyond
-+		// the desired 2 GB.
-+		struct rlimit limit;
-+		limit.rlim_cur = 0x10000000; // 256 MB
-+		limit.rlim_max = 0x10000000;
-+		if(setrlimit(RLIMIT_DATA, &limit) != 0) {
-+		        PanicAlert("Failed to lower maximum data segment size");
-+		}
++	// XXX Fix maximum data segment size (data + BSS + heap) to 256 MB.
++	// This allows avoiding calling mmap(2) with MAP_FIXED.
++	// On FreeBSD, without lowering this limit, calling mmap(2)
++	// without MAP_FIXED will result in getting an address just
++	// beyond maximum data segment size which will be far beyond
++	// the desired 2 GB.
++	struct rlimit limit;
++	limit.rlim_cur = 0x10000000; // 256 MB
++	limit.rlim_max = 0x10000000;
++	if(setrlimit(RLIMIT_DATA, &limit) != 0) {
++		LOG_ERROR(GENERAL, "LLVM: Failed to lower maximum data segment size");
++	}
 +#endif
- 	}
- 	else if ((uintptr_t) map_hint > 0xFFFFFFFFULL)
+ 
+ 	for (u64 addr = 0x10000000; addr <= 0x80000000 - s_memory_size; addr += 0x1000000)
  	{



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707120008.v6C08PZf059325>