From 83afbbfb6837d4a8432212697412eee31f079051 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sun, 19 Aug 2018 23:58:12 +0000 Subject: [PATCH] - fix building with GCC 8 --- gcc8.patch | 148 ++++++++++++++++++++++++++++++++++++++++++++ kernel-vanilla.spec | 4 ++ 2 files changed, 152 insertions(+) create mode 100644 gcc8.patch diff --git a/gcc8.patch b/gcc8.patch new file mode 100644 index 0000000..cf6dd3f --- /dev/null +++ b/gcc8.patch @@ -0,0 +1,148 @@ +diff -ur linux-4.14.orig/scripts/gcc-plugins/gcc-common.h linux-4.14/scripts/gcc-plugins/gcc-common.h +--- linux-4.14.orig/scripts/gcc-plugins/gcc-common.h 2018-08-19 21:29:20.298229612 +0000 ++++ linux-4.14/scripts/gcc-plugins/gcc-common.h 2018-08-19 21:33:02.789227107 +0000 +@@ -97,6 +97,10 @@ + #include "predict.h" + #include "ipa-utils.h" + ++#if BUILDING_GCC_VERSION >= 8000 ++#include "stringpool.h" ++#endif ++ + #if BUILDING_GCC_VERSION >= 4009 + #include "attribs.h" + #include "varasm.h" +diff -ur linux-4.14.orig/scripts/gcc-plugins/latent_entropy_plugin.c linux-4.14/scripts/gcc-plugins/latent_entropy_plugin.c +--- linux-4.14.orig/scripts/gcc-plugins/latent_entropy_plugin.c 2018-08-19 21:29:20.301229612 +0000 ++++ linux-4.14/scripts/gcc-plugins/latent_entropy_plugin.c 2018-08-19 21:50:23.229215392 +0000 +@@ -262,10 +262,17 @@ + .decl_required = true, + .type_required = false, + .function_type_required = false, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = false, + .handler = handle_latent_entropy_attribute, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = false +-#endif ++ .handler = handle_latent_entropy_attribute, ++ .affects_type_identity = false, ++#else ++ .handler = handle_latent_entropy_attribute, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static void register_attributes(void *event_data __unused, void *data __unused) +diff -ur linux-4.14.orig/scripts/gcc-plugins/randomize_layout_plugin.c linux-4.14/scripts/gcc-plugins/randomize_layout_plugin.c +--- linux-4.14.orig/scripts/gcc-plugins/randomize_layout_plugin.c 2018-08-19 21:29:20.303229612 +0000 ++++ linux-4.14/scripts/gcc-plugins/randomize_layout_plugin.c 2018-08-19 21:55:33.710211897 +0000 +@@ -589,10 +589,17 @@ + // need type declaration + .type_required = true, + .function_type_required = false, +- .handler = handle_randomize_layout_attr, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = true, ++ .handler = handle_randomize_layout_attr, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = true +-#endif ++ .handler = handle_randomize_layout_attr, ++ .affects_type_identity = true, ++#else ++ .handler = handle_randomize_layout_attr, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static struct attribute_spec no_randomize_layout_attr = { +@@ -604,10 +611,17 @@ + // need type declaration + .type_required = true, + .function_type_required = false, +- .handler = handle_randomize_layout_attr, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = true, ++ .handler = handle_randomize_layout_attr, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = true +-#endif ++ .handler = handle_randomize_layout_attr, ++ .affects_type_identity = true, ++#else ++ .handler = handle_randomize_layout_attr, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static struct attribute_spec randomize_considered_attr = { +@@ -619,10 +633,17 @@ + // need type declaration + .type_required = true, + .function_type_required = false, +- .handler = handle_randomize_considered_attr, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = false, ++ .handler = handle_randomize_considered_attr, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = false +-#endif ++ .handler = handle_randomize_considered_attr, ++ .affects_type_identity = false, ++#else ++ .handler = handle_randomize_considered_attr, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static struct attribute_spec randomize_performed_attr = { +@@ -634,10 +655,17 @@ + // need type declaration + .type_required = true, + .function_type_required = false, +- .handler = handle_randomize_performed_attr, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = false, ++ .handler = handle_randomize_performed_attr, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = false +-#endif ++ .handler = handle_randomize_performed_attr, ++ .affects_type_identity = false, ++#else ++ .handler = handle_randomize_performed_attr, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static void register_attributes(void *event_data, void *data) +diff -ur linux-4.14.orig/scripts/gcc-plugins/structleak_plugin.c linux-4.14/scripts/gcc-plugins/structleak_plugin.c +--- linux-4.14.orig/scripts/gcc-plugins/structleak_plugin.c 2018-08-19 21:29:20.304229612 +0000 ++++ linux-4.14/scripts/gcc-plugins/structleak_plugin.c 2018-08-19 21:51:31.790214620 +0000 +@@ -64,10 +64,17 @@ + .decl_required = false, + .type_required = false, + .function_type_required = false, +- .handler = handle_user_attribute, ++#if BUILDING_GCC_VERSION >= 8000 ++ .affects_type_identity = true, ++ .handler = handle_user_attribute, ++#else + #if BUILDING_GCC_VERSION >= 4007 +- .affects_type_identity = true +-#endif ++ .handler = handle_user_attribute, ++ .affects_type_identity = true, ++#else ++ .handler = handle_user_attribute, ++#endif /* >= 4007 */ ++#endif /* >= 8000 */ + }; + + static void register_attributes(void *event_data, void *data) diff --git a/kernel-vanilla.spec b/kernel-vanilla.spec index e20fd1b..6f3a2be 100644 --- a/kernel-vanilla.spec +++ b/kernel-vanilla.spec @@ -39,6 +39,8 @@ Source3: kernel.make Source10: kernel-vanilla-x86.config Source11: kernel-vanilla-x86_64.config +Patch0: gcc8.patch + URL: http://www.kernel.org/ BuildRequires: binutils >= 3:2.18 BuildRequires: /sbin/depmod @@ -340,6 +342,8 @@ cd linux-%{basever} %{__xz} -dc %{SOURCE1} | patch -p1 -s %endif +%patch0 -p1 + # Fix EXTRAVERSION in main Makefile sed -i 's#EXTRAVERSION =.*#EXTRAVERSION = %{?alt_kernel:-%{alt_kernel}}#g' Makefile -- 2.44.0