From 6adbc526edefc3dd00332922be259e9728ca3de7 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Fri, 5 Apr 2019 14:27:31 +0000
Subject: user/dosbox: fix build on pmmx with GCC 8

---
 user/dosbox/APKBUILD        |  6 ++++--
 user/dosbox/gcc8-pmmx.patch | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 user/dosbox/gcc8-pmmx.patch

(limited to 'user')

diff --git a/user/dosbox/APKBUILD b/user/dosbox/APKBUILD
index 0b9418d50..e8674b531 100644
--- a/user/dosbox/APKBUILD
+++ b/user/dosbox/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Horst Burkhardt <horst@adelielinux.org>
 pkgname=dosbox
 pkgver=0.82.7
-pkgrel=1
+pkgrel=2
 pkgdesc="Emulator for MS-DOS games"
 url="https://github.com/joncampbell123/dosbox-x/"
 arch="all !s390x"
@@ -15,6 +15,7 @@ source="https://github.com/joncampbell123/dosbox-x/archive/dosbox-x-wip-20180513
 	asmfix.patch
 	posix-headers.patch
 	constness.patch
+	gcc8-pmmx.patch
 	"
 builddir="$srcdir/dosbox-x-dosbox-x-wip-20180513-1316"
 
@@ -40,4 +41,5 @@ sha512sums="38b7423b695f3b0dfd26f8c8913f26afba73ea6235bb205ec3a5d7f08ef3c74a9b6c
 daf0efea03d6295f5a20d8d197f7d0ba38e0608edcfe8be19fc6091b783885d523557674f0f7df83b88186b77794723106cf7a0e02125d2cc75ecfd7d51fa91d  porttalk-fix.patch
 266ede57d21030f7752287f18660b47e9185a9aef9d022337dded9c9ce93e572691b41aca878f8a28c67bf5d217c7e84912336c21aacf594085dc31d99862ebf  asmfix.patch
 462e84d5bac8fb2c1317b303d1bdda72a50e9eedfb5251450cb8d0f98f4297d6a483eb2c95624cbc8d25e917788032dd1e7d8b0d06d82dad6600f8bd6eec85f4  posix-headers.patch
-775d8f209ea04a81fda5c3dcf8186b529248befb962019c66e60344a5e07c95462f9cc4acf0f82c44635fc86f1b4817030792a1900d36e6d911b6f782722f320  constness.patch"
+775d8f209ea04a81fda5c3dcf8186b529248befb962019c66e60344a5e07c95462f9cc4acf0f82c44635fc86f1b4817030792a1900d36e6d911b6f782722f320  constness.patch
+0e23ccef2c238583b1fbbf598da95f6e5f805edef37bd08d0d0c4a69e92f11b935b94dd3a8d889dc9587ec264b8540169b2858116f20d8467c345a179893090d  gcc8-pmmx.patch"
diff --git a/user/dosbox/gcc8-pmmx.patch b/user/dosbox/gcc8-pmmx.patch
new file mode 100644
index 000000000..3b86802ed
--- /dev/null
+++ b/user/dosbox/gcc8-pmmx.patch
@@ -0,0 +1,32 @@
+From 771f1c8304253fcb95aef54da739f43712aea726 Mon Sep 17 00:00:00 2001
+From: Jonathan Campbell <jonathan@castus.tv>
+Date: Sun, 20 May 2018 19:30:58 -0700
+Subject: [PATCH] Suddenly MinGW GCC 7.3.0 does not allow the dynamic core to
+ declare EBP clobbered. Fix dynamic core entry appropriately
+
+---
+ src/cpu/core_dyn_x86/risc_x86.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h
+index dea5ae0ca..d2a847a4f 100644
+--- a/src/cpu/core_dyn_x86/risc_x86.h
++++ b/src/cpu/core_dyn_x86/risc_x86.h
+@@ -130,13 +130,15 @@ static BlockReturn gen_runcode(Bit8u * code) {
+ #else
+ 	register Bit32u tempflags=reg_flags & FMASK_TEST;
+ 	__asm__ volatile (
++		"pushl %%ebp							\n"
+-		"call 1f ; 1: addl $run_return_adress-.,(%%esp)			\n"
++ 		"pushl $(run_return_adress)					\n"
+ 		"pushl  %2							\n"
+ 		"jmp  *%3							\n"
+ 		"run_return_adress:						\n"
++		"popl %%ebp							\n"
+ 		:"=a" (retval), "=c" (tempflags)
+ 		:"r" (tempflags),"r" (code)
+-		:"%edx","%ebx","%edi","%esi","%ebp","cc","memory"
++		:"%edx","%ebx","%edi","%esi"/*,"%ebp"*/,"cc","memory" /* NTS: GCC 7.3.0 MinGW suddenly will not allow this code to declare EBP clobbered */
+ 	);
+ 	reg_flags=(reg_flags & ~FMASK_TEST) | (tempflags & FMASK_TEST);
+ #endif
-- 
cgit v1.2.3-70-g09d2