From b6a09b8fbe446b9c9990065fabbd07deb4ef85f3 Mon Sep 17 00:00:00 2001 From: Pascal Jäger Date: Thu, 21 Sep 2023 14:05:54 +0200 Subject: app-emulation/softgun: fix build for clang16, lto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revbump EAPI bump Closes: https://bugs.gentoo.org/854534 Closes: https://bugs.gentoo.org/882583 Signed-off-by: Pascal Jäger Closes: https://github.com/gentoo/gentoo/pull/32967 Signed-off-by: Arthur Zamarin --- ....22-fix-declarations-with-type-mismatches.patch | 148 +++++++++++++++++++++ .../files/softgun-0.22-fix-implicit-int.patch | 33 +++++ app-emulation/softgun/softgun-0.22-r1.ebuild | 38 ++++++ 3 files changed, 219 insertions(+) create mode 100644 app-emulation/softgun/files/softgun-0.22-fix-declarations-with-type-mismatches.patch create mode 100644 app-emulation/softgun/files/softgun-0.22-fix-implicit-int.patch create mode 100644 app-emulation/softgun/softgun-0.22-r1.ebuild diff --git a/app-emulation/softgun/files/softgun-0.22-fix-declarations-with-type-mismatches.patch b/app-emulation/softgun/files/softgun-0.22-fix-declarations-with-type-mismatches.patch new file mode 100644 index 000000000000..25bf382eee56 --- /dev/null +++ b/app-emulation/softgun/files/softgun-0.22-fix-declarations-with-type-mismatches.patch @@ -0,0 +1,148 @@ +Subject: [PATCH] fix declarations with type mismatches + +Type mismatches between declarations prevent the compile from using LTO + +Bug: https://bugs.gentoo.org/854534 +Upstream: https://sourceforge.net/p/softgun/patches/5/ + +# Pascal Jäger (2023-09-21) + +--- a/m16c/idecode_m16c.c ++++ b/m16c/idecode_m16c.c +@@ -9,7 +9,7 @@ + #include "sglib.h" + + M16C_InstructionProc **iProcTab; +-M16C_Instruction **iTab; ++M16C_Instruction **iTabM16C; + + static M16C_Instruction instrlist[] = { + {0xfef0,0x76f0,"abs.size_dst",2 ,m16c_abs_size_dst}, +@@ -308,7 +308,7 @@ M16C_IDecoderNew() + int i,j; + int onecount1,onecount2; + iProcTab=(M16C_InstructionProc**)sg_calloc(0x10000*sizeof(M16C_InstructionProc*)); +- iTab=sg_calloc(0x10000*sizeof(M16C_Instruction*)); ++ iTabM16C=sg_calloc(0x10000*sizeof(M16C_Instruction*)); + fprintf(stderr,"Allocated M16C Instruction decoder table\n"); + for(j=0;instrlist[j].proc;j++) { + M16C_Instruction *instr = &instrlist[j]; +@@ -327,8 +327,8 @@ M16C_IDecoderNew() + } + #endif + if((i & instr->mask) == instr->icode) { +- if(iTab[i]) { +- M16C_Instruction *instr2 = iTab[i]; ++ if(iTabM16C[i]) { ++ M16C_Instruction *instr2 = iTabM16C[i]; + specmask1 = instr->mask; + specmask2 = instr2->mask; + onecount1 = SGLib_OnecountU32(instr->mask); +@@ -336,18 +336,18 @@ M16C_IDecoderNew() + fprintf(stderr,"Collission %s, %s\n",instr->name,instr2->name); + #if 0 + if(instr->len > instr2->len) { +- iTab[i] = instr; ++ iTabM16C[i] = instr; + iProcTab[i] = instr->proc; + } else if(instr2->len > instr->len) { +- iTab[i] = instr2; ++ iTabM16C[i] = instr2; + iProcTab[i] = instr2->proc; + } else + #endif + if(onecount1 > onecount2) { +- iTab[i] = instr; ++ iTabM16C[i] = instr; + iProcTab[i] = instr->proc; + } else if(onecount2 > onecount1) { +- iTab[i] = instr2; ++ iTabM16C[i] = instr2; + iProcTab[i] = instr2->proc; + } else { + fprintf(stderr,"Can not decide %s, %s\n",instr->name,instr2->name); +@@ -360,10 +360,10 @@ M16C_IDecoderNew() + specmask2 |= 0xff00; + } + if((specmask2 & specmask1) == specmask1) { +- iTab[i] = instr2; ++ iTabM16C[i] = instr2; + iProcTab[i] = instr2->proc; + } else if((specmask2 & specmask1) == specmask2) { +- iTab[i] = instr; ++ iTabM16C[i] = instr; + iProcTab[i] = instr->proc; + } else { + fprintf(stdout,"%04x: no instruction is more specific %s %s %04x %04x %d %d\n",i,instr->name,instr2->name,instr->icode,instr2->icode,instr->len,instr2->len); +@@ -371,13 +371,13 @@ M16C_IDecoderNew() + } + #endif + } else { +- iTab[i] = instr; ++ iTabM16C[i] = instr; + iProcTab[i] = instr->proc; + } + } + } +- if(iTab[i] == NULL) { +- iTab[i] = &undefined_instr; ++ if(iTabM16C[i] == NULL) { ++ iTabM16C[i] = &undefined_instr; + iProcTab[i] = (&undefined_instr)->proc; + } + } +--- a/m16c/idecode_m16c.h ++++ b/m16c/idecode_m16c.h +@@ -11,14 +11,14 @@ typedef struct M16C_Instruction { + } M16C_Instruction; + + extern M16C_InstructionProc **iProcTab; +-extern M16C_Instruction **iTab; ++extern M16C_Instruction **iTabM16C; + + void M16C_IDecoderNew(void); + + static inline M16C_Instruction * + M16C_InstructionFind(uint16_t icode) + { +- return iTab[icode]; ++ return iTabM16C[icode]; + } + static inline M16C_InstructionProc * + M16C_InstructionProcFind(uint16_t icode) +--- a/m16c/instructions_m16c.h ++++ b/m16c/instructions_m16c.h +@@ -160,7 +160,7 @@ void m16c_smovb_size(void); + void m16c_smovf_size(void); + void m16c_sstr_size(void); + void m16c_stc_srcdst(void); +-void m16c_stc_pcdst(void); ++void m16c_stc_pcdst(uint16_t icode); + void m16c_stctx_abs16abs20(void); + void m16c_ste_size_srcabs20(void); + void m16c_ste_size_srcdsp20(void); +--- a/ppc/mmu_ppc.c ++++ b/ppc/mmu_ppc.c +@@ -587,7 +587,7 @@ PPCMMU_Read8(uint32_t va) { + } + + void +-PPCMMU_Write64(uint32_t value,uint32_t va) { ++PPCMMU_Write64(uint64_t value,uint32_t va) { + uint32_t pa=translate_data(va); + Bus_Write64(value,pa); + } +--- a/printer/decompress.c ++++ b/printer/decompress.c +@@ -55,7 +55,7 @@ enum + eeCachedColor = 0x60 + }; + +-inline uint32_t get3pixel (uint8_t* src) ++static inline uint32_t get3pixel (uint8_t* src) + { + return (src[0] << 16) | (src[1] << 8) | (src[2]); + } +-- +2.41.0 + diff --git a/app-emulation/softgun/files/softgun-0.22-fix-implicit-int.patch b/app-emulation/softgun/files/softgun-0.22-fix-implicit-int.patch new file mode 100644 index 000000000000..b65ddaf660f3 --- /dev/null +++ b/app-emulation/softgun/files/softgun-0.22-fix-implicit-int.patch @@ -0,0 +1,33 @@ +Subject: [PATCH] fix implicit int declarations in function params + +Clang16 does not allow implicit integer declarations by default. + +Bug: https://bugs.gentoo.org/882583 +Upstream: https://sourceforge.net/p/softgun/patches/5/ + +# Pascal Jäger (2023-09-21) +--- a/arm/arm9cpu.h ++++ b/arm/arm9cpu.h +@@ -356,7 +356,7 @@ ARM_PostRestartIdecoder() { + } + + static inline void +-ARM_SigDebugMode(value) { ++ARM_SigDebugMode(uint32_t value) { + if(value) { + gcpu.signals_raw |= ARM_SIG_DEBUGMODE; + } else { +--- a/m32c/idecode_m32c.h ++++ b/m32c/idecode_m32c.h +@@ -84,7 +84,7 @@ M32C_InstructionProcFind(uint16_t icode) + #endif + + static inline int +-M32C_InstructionLen(icode) { ++M32C_InstructionLen(uint32_t icode) { + M32C_Instruction *instr = M32C_InstructionFind(icode); + return instr->len; + } +-- +2.41.0 + diff --git a/app-emulation/softgun/softgun-0.22-r1.ebuild b/app-emulation/softgun/softgun-0.22-r1.ebuild new file mode 100644 index 000000000000..653521bd5aa3 --- /dev/null +++ b/app-emulation/softgun/softgun-0.22-r1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs + +DESCRIPTION="ARM software emulator" +HOMEPAGE="https://softgun.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" + +DEPEND="media-libs/alsa-lib" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-0.22-make.patch + "${FILESDIR}"/${PN}-0.22-fix-implicit-int.patch + "${FILESDIR}"/${PN}-0.22-fix-declarations-with-type-mismatches.patch +) + +src_configure() { + append-cflags -fcommon + default +} + +src_compile() { + emake CC="$(tc-getCC)" +} + +src_install() { + dodir /usr/bin + emake install prefix="${D}/usr" + dodoc README configs/*.sg +} -- cgit v1.2.3-65-gdbad