games-emulation/pcsx2: tweak for gcc-8
authorSergei Trofimovich <slyfox@gentoo.org>
Mon, 23 Jul 2018 06:16:50 +0000 (07:16 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Mon, 23 Jul 2018 06:17:09 +0000 (07:17 +0100)
It's a backport of upstream commit 171e7f016dc9e132f9faf40a22f0312d45d356a5
"common: Work around GCC8 _xgetbv bug"

Bug: https://gcc.gnu.org/PR85684
Package-Manager: Portage-2.3.43, Repoman-2.3.10

games-emulation/pcsx2/files/pcsx2-1.4.0-xgetbv.patch [new file with mode: 0644]
games-emulation/pcsx2/pcsx2-1.4.0.ebuild

diff --git a/games-emulation/pcsx2/files/pcsx2-1.4.0-xgetbv.patch b/games-emulation/pcsx2/files/pcsx2-1.4.0-xgetbv.patch
new file mode 100644 (file)
index 0000000..e90b0df
--- /dev/null
@@ -0,0 +1,26 @@
+From 171e7f016dc9e132f9faf40a22f0312d45d356a5 Mon Sep 17 00:00:00 2001
+From: Jonathan Li <jonathan.li@hotmail.co.uk>
+Date: Fri, 11 May 2018 01:42:27 +0100
+Subject: [PATCH] common: Work around GCC8 _xgetbv bug
+
+clang and earlier GCC versions do not provide the _xgetbv intrinsic.
+GCC8 does, but unfortunately it's broken.
+(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684).
+
+Re-use our _xgetbv implementation to avoid the bug, but rename it to
+avoid compilation errors as well.
+---
+ common/include/x86emitter/x86_intrin.h | 7 ++++---
+ common/src/x86emitter/cpudetect.cpp    | 2 +-
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+--- a/common/include/intrin_x86.h
++++ b/common/include/intrin_x86.h
+@@ -107 +107 @@ static __inline__ __attribute__((always_inline)) void __cpuidex(int CPUInfo[], c
+-static __inline__ __attribute__((always_inline)) unsigned long long _xgetbv(unsigned int index)
++static __inline__ __attribute__((always_inline)) unsigned long long _xgetbv_pcsx2(unsigned int index)
+--- a/common/src/x86emitter/cpudetect.cpp
++++ b/common/src/x86emitter/cpudetect.cpp
+@@ -273 +276 @@ void x86capabilities::Identify()
+-              if((_xgetbv(0) & 6) == 6) // XFEATURE_ENABLED_MASK[2:1] = '11b' (XMM state and YMM state are enabled by OS).
++              if((_xgetbv_pcsx2(0) & 6) == 6) // XFEATURE_ENABLED_MASK[2:1] = '11b' (XMM state and YMM state are enabled by OS).
index cfd1606f91af678baf32e2616f5c75ba67666698..ac18cbd565e4d486fdcb01070658d493d1438169 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=5
@@ -43,7 +43,10 @@ DEPEND="${RDEPEND}
 
 S="${WORKDIR}/${PN}-${MY_PV}"
 
-PATCHES=( "${FILESDIR}"/${P}-gcc5.patch )
+PATCHES=(
+       "${FILESDIR}"/${P}-gcc5.patch
+       "${FILESDIR}"/${P}-xgetbv.patch
+)
 
 clean_locale() {
        rm -R "${S}"/locales/"${1}" || die