From fd4370288585433efee74c7b8bea88bb3f9e589c Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 16 Jul 2019 20:18:55 +0200 Subject: [PATCH] higan: add a patch to prevent elfv2 ppc64(le) crashes [ci skip] --- srcpkgs/higan/patches/ppc64-no-asm.patch | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 srcpkgs/higan/patches/ppc64-no-asm.patch diff --git a/srcpkgs/higan/patches/ppc64-no-asm.patch b/srcpkgs/higan/patches/ppc64-no-asm.patch new file mode 100644 index 00000000000..e2a58d5f3df --- /dev/null +++ b/srcpkgs/higan/patches/ppc64-no-asm.patch @@ -0,0 +1,26 @@ +Higan's ppc code assumes big endian, so fall back to sjlj for that. ELFv2 big +endian just needs a small patch to function. + +--- libco/libco.c ++++ libco/libco.c +@@ -9,7 +9,7 @@ + #include "amd64.c" + #elif defined(__arm__) + #include "arm.c" +- #elif defined(_ARCH_PPC) ++ #elif defined(_ARCH_PPC) && !defined(__LITTLE_ENDIAN__) + #include "ppc.c" + #elif defined(_WIN32) + #include "fiber.c" +--- libco/ppc.c ++++ libco/ppc.c +@@ -36,7 +36,8 @@ static thread_local cothread_t co_active_handle = 0; + + /* whether function calls are indirect through a descriptor, or are directly to function */ + #ifndef LIBCO_PPCDESC +- #if !_CALL_SYSV && (_CALL_AIX || _CALL_AIXDESC || LIBCO_PPC64) ++ #if !_CALL_SYSV && (_CALL_AIX || _CALL_AIXDESC || \ ++ (LIBCO_PPC64 && (!defined(_CALL_ELF) || _CALL_ELF == 1))) + #define LIBCO_PPCDESC 1 + #endif + #endif