From 060a0cf338d6024eee37cc344c224fe3bcb78e81 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 20 Oct 2023 16:07:58 +0200 Subject: Initial commit --- ...-behavioral-changing-fix-in-gcc-cp-rtti.c.patch | 46 ++++ ...ent-out-M4-m4-not-needed-in-gmp-configure.patch | 35 +++ ...fns-fix-mismatch-in-gnu_inline-attributes.patch | 62 ++++++ ...onfigure-to-comply-with-newer-c-standards.patch | 234 +++++++++++++++++++++ etc/patches/gcc-4.7.4/various-fixes/series | 4 + 5 files changed, 381 insertions(+) create mode 100644 etc/patches/gcc-4.7.4/various-fixes/0001-non-behavioral-changing-fix-in-gcc-cp-rtti.c.patch create mode 100644 etc/patches/gcc-4.7.4/various-fixes/0002-comment-out-M4-m4-not-needed-in-gmp-configure.patch create mode 100644 etc/patches/gcc-4.7.4/various-fixes/0003-cfns-fix-mismatch-in-gnu_inline-attributes.patch create mode 100644 etc/patches/gcc-4.7.4/various-fixes/0004-fix-gmp-configure-to-comply-with-newer-c-standards.patch create mode 100644 etc/patches/gcc-4.7.4/various-fixes/series (limited to 'etc/patches/gcc-4.7.4/various-fixes') diff --git a/etc/patches/gcc-4.7.4/various-fixes/0001-non-behavioral-changing-fix-in-gcc-cp-rtti.c.patch b/etc/patches/gcc-4.7.4/various-fixes/0001-non-behavioral-changing-fix-in-gcc-cp-rtti.c.patch new file mode 100644 index 0000000..9d32ef4 --- /dev/null +++ b/etc/patches/gcc-4.7.4/various-fixes/0001-non-behavioral-changing-fix-in-gcc-cp-rtti.c.patch @@ -0,0 +1,46 @@ +From 8dfe03984e5c8060b5baabd19478db9f89bc43d0 Mon Sep 17 00:00:00 2001 +From: Oliver Reiche +Date: Thu, 29 Jun 2023 15:47:17 +0200 +Subject: [PATCH 1/4] Non-behavioral changing fix in gcc/cp/rtti.c + +... to fix an infinite loop that occurs in the "cc1plus" +binary, if it was compiled with TinyCC version 0.9.27. Upon +closer inspection, the loop was infinitely executing the +lines 814, 820, and 823 of the following snippet: + +--- +812: function(...) { +813: while (true) { +814: if (...) +... +820: else if (...) +... +822: else +823: return ...; +824: } +--- + +Presumably, TinyCC somehow generates instructions that are +not able to exit the function from the return-statement +inside the while loop. The solution is a non-behavioral +changing fix: insert a break-statement in line 823 and +thereby move the return-statement outside the while loop. +--- + gcc/cp/rtti.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c +index 30383ed18..faf639115 100644 +--- a/gcc/cp/rtti.c ++++ b/gcc/cp/rtti.c +@@ -820,6 +820,7 @@ target_incomplete_p (tree type) + else if (TREE_CODE (type) == POINTER_TYPE) + type = TREE_TYPE (type); + else ++ break; + return !COMPLETE_OR_VOID_TYPE_P (type); + } + +-- +2.30.2 + diff --git a/etc/patches/gcc-4.7.4/various-fixes/0002-comment-out-M4-m4-not-needed-in-gmp-configure.patch b/etc/patches/gcc-4.7.4/various-fixes/0002-comment-out-M4-m4-not-needed-in-gmp-configure.patch new file mode 100644 index 0000000..eccb90a --- /dev/null +++ b/etc/patches/gcc-4.7.4/various-fixes/0002-comment-out-M4-m4-not-needed-in-gmp-configure.patch @@ -0,0 +1,35 @@ +From 220a31382c25e511b30ef675711d9bcd057c1083 Mon Sep 17 00:00:00 2001 +From: Oliver Reiche +Date: Thu, 29 Jun 2023 15:47:27 +0200 +Subject: [PATCH 2/4] Comment out M4=m4-not-needed in gmp/configure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Backport from GMP 5.0.2 + Mercurial changeset IDs: d32fa7b198d3 and 2b1c397a9463 + +Co-authored-by: Niels Möller +Co-authored-by: Torbjorn Granlund +--- + gmp/configure | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gmp/configure b/gmp/configure +index c72990c07..c5f247948 100755 +--- a/gmp/configure ++++ b/gmp/configure +@@ -28982,8 +28982,8 @@ echo "${ECHO_T}$gmp_cv_m4_m4wrap_spurious" >&6 + echo "define(,<$gmp_cv_m4_m4wrap_spurious>)" >> $gmp_tmpconfigm4 + + +-else +- M4=m4-not-needed ++#else ++# M4=m4-not-needed + fi + + # Only do the GMP_ASM checks if there's a .S or .asm wanting them. +-- +2.30.2 + diff --git a/etc/patches/gcc-4.7.4/various-fixes/0003-cfns-fix-mismatch-in-gnu_inline-attributes.patch b/etc/patches/gcc-4.7.4/various-fixes/0003-cfns-fix-mismatch-in-gnu_inline-attributes.patch new file mode 100644 index 0000000..217ff88 --- /dev/null +++ b/etc/patches/gcc-4.7.4/various-fixes/0003-cfns-fix-mismatch-in-gnu_inline-attributes.patch @@ -0,0 +1,62 @@ +From 45decf6322dedb510df1886da5b8419aecef52c5 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Thu, 29 Jun 2023 16:02:23 +0200 +Subject: [PATCH 3/4] cfns: fix mismatch in gnu_inline attributes + +Since the 3.0.3 release of gperf (made in May 2007), the generated func +has had the gnu_inline attribute applied to it. The gcc source however +has not been updated to include that which has lead to a mismatch. + +In practice, this hasn't been an issue for two reasons: +(1) Before gcc-5, the default standard was (gnu) C89, and gcc does not +warn or throw an error in this mode. +(2) Starting with gcc-4.8, the compiler driver used to build gcc was +changed to C++, and g++ does not warn or throw an error in this mode. + +This error does show up though when using gcc-5 to build gcc-4.7 or +older as then the default is (gnu) C11 and the C compiler driver is +used. That failure looks like: +In file included from .../gcc-4.7.4/gcc/cp/except.c:990:0: +cfns.gperf: At top level: +cfns.gperf:101:1: error: 'gnu_inline' attribute present on 'libc_name_p' +cfns.gperf:26:14: error: but not here + +Whether the compiler should always emit this error regardless of the +active standard or compiler driver is debatable (I think it should be +consistent -- either always do it or never do it). +--- + gcc/cp/cfns.gperf | 3 +++ + gcc/cp/cfns.h | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf +index ef1ed083d..ba0c487a6 100644 +--- a/gcc/cp/cfns.gperf ++++ b/gcc/cp/cfns.gperf +@@ -22,6 +22,9 @@ __inline + static unsigned int hash (const char *, unsigned int); + #ifdef __GNUC__ + __inline ++#ifdef __GNUC_STDC_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif + #endif + const char * libc_name_p (const char *, unsigned int); + %} +diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h +index 62cdfab93..2fb9b4632 100644 +--- a/gcc/cp/cfns.h ++++ b/gcc/cp/cfns.h +@@ -53,6 +53,9 @@ __inline + static unsigned int hash (const char *, unsigned int); + #ifdef __GNUC__ + __inline ++#ifdef __GNUC_STDC_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif + #endif + const char * libc_name_p (const char *, unsigned int); + /* maximum key range = 391, duplicates = 0 */ +-- +2.30.2 + diff --git a/etc/patches/gcc-4.7.4/various-fixes/0004-fix-gmp-configure-to-comply-with-newer-c-standards.patch b/etc/patches/gcc-4.7.4/various-fixes/0004-fix-gmp-configure-to-comply-with-newer-c-standards.patch new file mode 100644 index 0000000..1360b06 --- /dev/null +++ b/etc/patches/gcc-4.7.4/various-fixes/0004-fix-gmp-configure-to-comply-with-newer-c-standards.patch @@ -0,0 +1,234 @@ +From 7a642773c924589eeee2ca1be4615b35c12c6f5e Mon Sep 17 00:00:00 2001 +From: Oliver Reiche +Date: Tue, 17 Oct 2023 14:59:32 +0200 +Subject: [PATCH 4/4] Fix GMP configure to comply with newer C standards + +--- + configure | 68 +++++++++++++++++++++++-------------------------------- + 1 file changed, 28 insertions(+), 40 deletions(-) + +diff --git a/gmp/configure b/gmp/configure +index c72990c..c13bea9 100755 +--- a/gmp/configure ++++ b/gmp/configure +@@ -7752,7 +7752,7 @@ cat >conftest.c <conftest.c <conftest.c <conftest.c <