From 0ba20cb7f23e1e47882f44add1a539db285fe604 Mon Sep 17 00:00:00 2001 From: Thorsten Leemhuis Date: Sat, 29 Jan 2022 10:35:52 +0100 Subject: add patch for gcc12 to compile on rawhide again --- gcc-12-subcmd-util.patch | 35 +++++++++++++++++++++++++++++++++++ kernel.spec | 10 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 gcc-12-subcmd-util.patch diff --git a/gcc-12-subcmd-util.patch b/gcc-12-subcmd-util.patch new file mode 100644 index 000000000..ac063292e --- /dev/null +++ b/gcc-12-subcmd-util.patch @@ -0,0 +1,35 @@ +From b3d2907a37c53f7379be8742bfbfe47aa2877bfc Mon Sep 17 00:00:00 2001 +From: "Justin M. Forbes" +Date: Thu, 27 Jan 2022 15:33:37 -0600 +Subject: [PATCH] Fix subcmd-util for gcc 12 + +Signed-off-by: Justin M. Forbes +--- + tools/lib/subcmd/subcmd-util.h | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h +index 794a375dad36..7009fc176636 100644 +--- a/tools/lib/subcmd/subcmd-util.h ++++ b/tools/lib/subcmd/subcmd-util.h +@@ -49,13 +49,12 @@ static NORETURN inline void die(const char *err, ...) + + static inline void *xrealloc(void *ptr, size_t size) + { +- void *ret = realloc(ptr, size); +- if (!ret && !size) +- ret = realloc(ptr, 1); ++ void *ret; ++ if (!size) ++ size = 1; ++ ret = realloc(ptr, size); + if (!ret) { + ret = realloc(ptr, size); +- if (!ret && !size) +- ret = realloc(ptr, 1); + if (!ret) + die("Out of memory, realloc failed"); + } +-- +2.34.1 + diff --git a/kernel.spec b/kernel.spec index ddd45e590..177137d2c 100755 --- a/kernel.spec +++ b/kernel.spec @@ -862,6 +862,11 @@ Source4002: gating.yaml Patch1: patch-%{patchversion}-redhat.patch %endif +# from kernel-ark +Patch2: gcc-12-subcmd-util.patch +# from https://lore.kernel.org/all/20220120233748.2062559-1-slyich@gmail.com/raw +Patch3: gcc-12-objtool-check.patch + # empty final patch to facilitate testing of kernel patches Patch999999: linux-kernel-test.patch @@ -1403,6 +1408,11 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch ApplyOptionalPatch linux-kernel-test.patch +%if 0%{?fedora} >= 36 +ApplyOptionalPatch gcc-12-subcmd-util.patch +ApplyOptionalPatch gcc-12-objtool-check.patch +%endif + # END OF PATCH APPLICATIONS # Any further pre-build tree manipulations happen here. -- cgit