-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- a/FEXCore/include/FEXCore/Utils/AllocatorHooks.h | ||
+++ b/FEXCore/include/FEXCore/Utils/AllocatorHooks.h | ||
@@ -34,6 +34,15 @@ | ||
FEX_DEFAULT_VISIBILITY JEMALLOC_NOTHROW extern void *je_aligned_alloc(size_t a, size_t s); | ||
#undef JEMALLOC_NOTHROW | ||
#endif | ||
+ | ||
+#if defined(__ANDROID__) && __ANDROID_API__ < 26 | ||
+static void *aligned_alloc(size_t align, size_t size) | ||
+{ | ||
+ void *result = NULL; | ||
+ posix_memalign(&result, align, size); | ||
+ return result; | ||
+} | ||
+#endif | ||
} | ||
|
||
namespace FEXCore::Allocator { |
11 changes: 11 additions & 0 deletions
11
tur-multilib/hangover-libfexcore/0002-remove-workaround-for-memory_resource.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/FEXCore/Source/Utils/Allocator/IntrusiveArenaAllocator.h | ||
+++ b/FEXCore/Source/Utils/Allocator/IntrusiveArenaAllocator.h | ||
@@ -9,7 +9,7 @@ | ||
|
||
#include <bitset> | ||
#include <cstddef> | ||
-#ifdef TERMUX_BUILD | ||
+#if 0 | ||
#ifdef __has_include | ||
#if __has_include(<memory_resource>) | ||
#error Termux <experimental/memory_resource> workaround can be removed |
20 changes: 20 additions & 0 deletions
20
tur-multilib/hangover-libfexcore/0003-do-not-use-preserve_all-attr.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
https://github.com/llvm/llvm-project/issues/58145 | ||
|
||
--- a/FEXCore/CMakeLists.txt | ||
+++ b/FEXCore/CMakeLists.txt | ||
@@ -26,6 +26,7 @@ | ||
include(CheckIncludeFileCXX) | ||
include(CheckCXXSourceCompiles) | ||
|
||
+if(NOT ENABLE_TERMUX_BUILD) | ||
set(CMAKE_REQUIRED_FLAGS "-std=c++11 -Wattributes -Werror=attributes") | ||
check_cxx_source_compiles( | ||
" | ||
@@ -40,6 +41,7 @@ | ||
if (HAS_CLANG_PRESERVE_ALL) | ||
message(STATUS "Has clang::preserve_all") | ||
endif () | ||
+endif() | ||
|
||
if (EXISTS ${CMAKE_CURRENT_DIR}/External/vixl/) | ||
# Useful to have for freestanding libFEXCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/Source/Tools/FEXLoader/ELFCodeLoader.h | ||
+++ b/Source/Tools/FEXLoader/ELFCodeLoader.h | ||
@@ -37,6 +37,11 @@ | ||
#include <sys/personality.h> | ||
#include <sys/random.h> | ||
|
||
+#if defined __ANDROID__ && __ANDROID_API__ < 28 | ||
+#include <syscall.h> | ||
+#define getrandom(buf,buflen,flags) syscall(SYS_getrandom,buf,buflen,flags) | ||
+#endif | ||
+ | ||
#define PAGE_START(x) ((x) & ~(uintptr_t)(4095)) | ||
#define PAGE_OFFSET(x) ((x) & 4095) | ||
#define PAGE_ALIGN(x) (((x) + 4095) & ~(uintptr_t)(4095)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/Source/Tools/FEXLoader/VDSO_Emulation.cpp | ||
+++ b/Source/Tools/FEXLoader/VDSO_Emulation.cpp | ||
@@ -253,7 +253,11 @@ | ||
int rv; | ||
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV); | ||
|
||
+#ifndef __ANDROID__ | ||
int Result = ::getcpu(args->cpu, args->node); | ||
+#else | ||
+ int Result = ::syscall(SYS_getcpu, args->cpu, args->node, nullptr); | ||
+#endif | ||
args->rv = SyscallRet(Result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- a/Source/Tools/FEXLoader/VDSO_Emulation.cpp | ||
+++ b/Source/Tools/FEXLoader/VDSO_Emulation.cpp | ||
@@ -18,6 +18,10 @@ | ||
#include <sys/time.h> | ||
#include <unistd.h> | ||
|
||
+#ifndef ELF32_ST_VISIBILITY | ||
+#define ELF32_ST_VISIBILITY(o) ((o) & 0x3) | ||
+#endif | ||
+ | ||
namespace FEX::VDSO { | ||
FEXCore::Context::VDSOSigReturn VDSOPointers{}; | ||
namespace VDSOHandlers { |
22 changes: 22 additions & 0 deletions
22
tur-multilib/hangover-libfexcore/0007-unqualified-id.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- a/Source/Tools/FEXLoader/LinuxSyscalls/SignalDelegator.cpp | ||
+++ b/Source/Tools/FEXLoader/LinuxSyscalls/SignalDelegator.cpp | ||
@@ -896,7 +896,9 @@ | ||
|
||
// 32-bit Guest can provide its own restorer or we need to provide our own. | ||
// On a real host this restorer will live in VDSO. | ||
+#ifndef SA_RESTORER | ||
constexpr uint32_t SA_RESTORER = 0x04000000; | ||
+#endif | ||
const bool HasRestorer = (GuestAction->sa_flags & SA_RESTORER) == SA_RESTORER; | ||
if (HasRestorer) { | ||
guest_uctx->pretcode = (uint32_t)(uint64_t)GuestAction->restorer; | ||
@@ -1109,7 +1111,9 @@ | ||
|
||
// 32-bit Guest can provide its own restorer or we need to provide our own. | ||
// On a real host this restorer will live in VDSO. | ||
+#ifndef SA_RESTORER | ||
constexpr uint32_t SA_RESTORER = 0x04000000; | ||
+#endif | ||
const bool HasRestorer = (GuestAction->sa_flags & SA_RESTORER) == SA_RESTORER; | ||
if (HasRestorer) { | ||
guest_uctx->pretcode = (uint32_t)(uint64_t)GuestAction->restorer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
TERMUX_PKG_HOMEPAGE=https://github.com/AndreRH/FEX | ||
TERMUX_PKG_DESCRIPTION="x86 and x86-64 Linux emulator library for Hangover" | ||
TERMUX_PKG_LICENSE="MIT" | ||
TERMUX_PKG_MAINTAINER="@termux-user-repository" | ||
TERMUX_PKG_VERSION=8.17 | ||
TERMUX_PKG_SRCURL=git+https://github.com/AndreRH/FEX | ||
TERMUX_PKG_GIT_BRANCH="hangover-8.17" | ||
TERMUX_PKG_DEPENDS="libandroid-shmem, libc++" | ||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo | ||
-DBUILD_TESTS=OFF | ||
-DENABLE_LTO=OFF | ||
-DENABLE_JEMALLOC=OFF | ||
-DENABLE_JEMALLOC_GLIBC_ALLOC=OFF | ||
-DENABLE_OFFLINE_TELEMETRY=OFF | ||
-DENABLE_TERMUX_BUILD=True | ||
-DTUNE_CPU=generic | ||
-DTUNE_ARCH=armv8-a | ||
" | ||
TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686, x86_64" | ||
|
||
TERMUX_PKG_HOSTBUILD=true | ||
|
||
termux_step_post_get_source() { | ||
# Remove this marker all the time | ||
rm -rf $TERMUX_HOSTBUILD_MARKER | ||
} | ||
|
||
_setup_llvm_mingw_toolchain() { | ||
# LLVM-mingw's version number must not be the same as the NDK's. | ||
local _llvm_mingw_version=16 | ||
local _version="20230614" | ||
local _url="https://github.com/mstorsjo/llvm-mingw/releases/download/$_version/llvm-mingw-$_version-ucrt-ubuntu-20.04-x86_64.tar.xz" | ||
local _path="$TERMUX_PKG_CACHEDIR/$(basename $_url)" | ||
local _sha256sum=9ae925f9b205a92318010a396170e69f74be179ff549200e8122d3845ca243b8 | ||
termux_download $_url $_path $_sha256sum | ||
local _extract_path="$TERMUX_PKG_CACHEDIR/llvm-mingw-toolchain-$_llvm_mingw_version" | ||
if [ ! -d "$_extract_path" ]; then | ||
mkdir -p "$_extract_path"-tmp | ||
tar -C "$_extract_path"-tmp --strip-component=1 -xf "$_path" | ||
mv "$_extract_path"-tmp "$_extract_path" | ||
fi | ||
export PATH="$PATH:$_extract_path/bin" | ||
} | ||
|
||
termux_step_host_build() { | ||
termux_setup_cmake | ||
|
||
# Setup llvm-mingw toolchain | ||
_setup_llvm_mingw_toolchain | ||
|
||
# Make fex wow64 dlls | ||
cmake -DCMAKE_TOOLCHAIN_FILE=$TERMUX_PKG_SRCDIR/toolchain_mingw.cmake \ | ||
-DENABLE_JEMALLOC=0 -DENABLE_JEMALLOC_GLIBC_ALLOC=0 \ | ||
-DMINGW_TRIPLE=aarch64-w64-mingw32 \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DBUILD_TESTS=False \ | ||
-DENABLE_ASSERTIONS=False \ | ||
$TERMUX_PKG_SRCDIR | ||
|
||
make -j $TERMUX_MAKE_PROCESSES -k wow64fex || bash | ||
} | ||
|
||
termux_step_pre_configure() { | ||
find $TERMUX_PKG_SRCDIR -name '*.h' -o -name '*.c' -o -name '*.cpp' | \ | ||
xargs -n 1 sed -i -e 's:"/tmp:"'$TERMUX_PREFIX'/tmp:g' | ||
} | ||
|
||
termux_step_make() { | ||
ninja -j $TERMUX_MAKE_PROCESSES -k 0 FEXCore_shared || bash | ||
} | ||
|
||
termux_step_make_install() { | ||
# Install libfexcore | ||
cp $TERMUX_PKG_BUILDDIR/FEXCore/Source/libFEXCore.so $TERMUX_PREFIX/lib/ | ||
|
||
# Install WOW64Fex | ||
mkdir -p $TERMUX_PREFIX/lib/wine/aarch64-windows | ||
cp $TERMUX_PKG_HOSTBUILD_DIR/Bin/libwow64fex.dll $TERMUX_PREFIX/lib/wine/aarch64-windows/ | ||
} |
3 changes: 3 additions & 0 deletions
3
tur-multilib/hangover-libfexcore/hangover-libwow64fex.subpackage.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
TERMUX_SUBPKG_INCLUDE="$TERMUX_PREFIX/lib/wine/aarch64-windows/libwow64fex.dll" | ||
TERMUX_SUBPKG_DESCRIPTION=" x86 and x86-64 Linux emulator library for Hangover" | ||
TERMUX_SUBPKG_DEPEND_ON_PARENT=no |