From abf1dd54ac05f5b2d34d750027fa083b870e069e Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sat, 20 Oct 2018 15:09:18 +0100 Subject: [PATCH] add patch fixing GCC 4.2.4 build while GCC 4.2.1 is particularly interesting because it is the last GPL2 licensed GCC, 4.2.4 is the last release that doesn't require 3rd party libraries (GMP, MPC, MPFR), which makes the build way less complex and slow. plus it's still reasonable modern to support all compiler features used by the linux kernel (last time i checked). patch taken from sabotage linux. --- patches/gcc-4.2.4-toplev.diff | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 patches/gcc-4.2.4-toplev.diff diff --git a/patches/gcc-4.2.4-toplev.diff b/patches/gcc-4.2.4-toplev.diff new file mode 100644 index 0000000..bcbbf1f --- /dev/null +++ b/patches/gcc-4.2.4-toplev.diff @@ -0,0 +1,51 @@ +--- gcc-4.2.4.orig/gcc/toplev.h ++++ gcc-4.2.4/gcc/toplev.h +@@ -150,6 +150,7 @@ + /* Return true iff flags are set as if -ffast-math. */ + extern bool fast_math_flags_set_p (void); + ++#if GCC_VERSION < 3004 + /* Return log2, or -1 if not exact. */ + extern int exact_log2 (unsigned HOST_WIDE_INT); + +@@ -157,7 +158,7 @@ + extern int floor_log2 (unsigned HOST_WIDE_INT); + + /* Inline versions of the above for speed. */ +-#if GCC_VERSION >= 3004 ++#else /* GCC_VERSION >= 3004 */ + # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG + # define CLZ_HWI __builtin_clzl + # define CTZ_HWI __builtin_ctzl +@@ -169,13 +170,13 @@ + # define CTZ_HWI __builtin_ctz + # endif + +-extern inline int ++static inline int + floor_log2 (unsigned HOST_WIDE_INT x) + { + return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1; + } + +-extern inline int ++static inline int + exact_log2 (unsigned HOST_WIDE_INT x) + { + return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1; +--- gcc-4.2.4.orig/gcc/toplev.c ++++ gcc-4.2.4/gcc/toplev.c +@@ -526,11 +526,7 @@ + return atoi (p); + } + +-/* When compiling with a recent enough GCC, we use the GNU C "extern inline" +- for floor_log2 and exact_log2; see toplev.h. That construct, however, +- conflicts with the ISO C++ One Definition Rule. */ +- +-#if GCC_VERSION < 3004 || !defined (__cplusplus) ++#if GCC_VERSION < 3004 + + /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. + If X is 0, return -1. */ + -- 2.11.4.GIT