From: Greg Kroah-Hartman Date: Mon, 11 Apr 2022 12:55:41 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.9.310~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff86b202dc3d8fedfcdd88741af8170c9eafdc80;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch --- diff --git a/queue-5.4/series b/queue-5.4/series index 366b3935f5f..dd37c8adba8 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -455,3 +455,5 @@ arm64-patch_text-fixup-last-cpu-should-be-master.patch ata-sata_dwc_460ex-fix-crash-due-to-oob-write.patch perf-qcom_l2_pmu-fix-an-incorrect-null-check-on-list-iterator.patch irqchip-gic-v3-fix-gicr_ctlr.rwp-polling.patch +tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch +tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch diff --git a/queue-5.4/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch b/queue-5.4/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch new file mode 100644 index 00000000000..b690ffa8fcb --- /dev/null +++ b/queue-5.4/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch @@ -0,0 +1,133 @@ +From 41caff459a5b956b3e23ba9ca759dd0629ad3dda Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 5 Apr 2022 10:33:21 -0300 +Subject: tools build: Filter out options and warnings not supported by clang + +From: Arnaldo Carvalho de Melo + +commit 41caff459a5b956b3e23ba9ca759dd0629ad3dda upstream. + +These make the feature check fail when using clang, so remove them just +like is done in tools/perf/Makefile.config to build perf itself. + +Adding -Wno-compound-token-split-by-macro to tools/perf/Makefile.config +when building with clang is also necessary to avoid these warnings +turned into errors (-Werror): + + CC /tmp/build/perf/util/scripting-engines/trace-event-perl.o + In file included from util/scripting-engines/trace-event-perl.c:35: + In file included from /usr/lib64/perl5/CORE/perl.h:4085: + In file included from /usr/lib64/perl5/CORE/hv.h:659: + In file included from /usr/lib64/perl5/CORE/hv_func.h:34: + In file included from /usr/lib64/perl5/CORE/sbox32_hash.h:4: + /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] + ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /usr/lib64/perl5/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' + #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \ + ^~~~~~~~~~ + /usr/lib64/perl5/CORE/perl.h:737:29: note: expanded from macro 'STMT_START' + # define STMT_START (void)( /* gcc supports "({ STATEMENTS; })" */ + ^ + /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: '{' token is here + ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' + #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \ + ^ + /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] + ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /usr/lib64/perl5/CORE/zaphod32_hash.h:87:41: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' + v ^= (v>>23); \ + ^ + /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: ')' token is here + ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /usr/lib64/perl5/CORE/zaphod32_hash.h:88:3: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' + } STMT_END + ^~~~~~~~ + /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END' + # define STMT_END ) + ^ + +Please refer to the discussion on the Link: tag below, where Nathan +clarifies the situation: + + +acme> And then get to the problems at the end of this message, which seem +acme> similar to the problem described here: +acme> +acme> From Nathan Chancellor <> +acme> Subject [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO +acme> +acme> https://lkml.org/lkml/2020/9/1/135 +acme> +acme> So perhaps in this case its better to disable that +acme> -Werror,-Wcompound-token-split-by-macro when building with clang? + +Yes, I think that is probably the best solution. As far as I can tell, +at least in this file and context, the warning appears harmless, as the +"create a GNU C statement expression from two different macros" is very +much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS. +The warning is fixed in upstream Perl by just avoiding creating GNU C +statement expressions using STMT_START and STMT_END: + + https://github.com/Perl/perl5/issues/18780 + https://github.com/Perl/perl5/pull/18984 + +If I am reading the source code correctly, an alternative to disabling +the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it +seems like that might end up impacting more than just this site, +according to the issue discussion above. + + +Based-on-a-patch-by: Sedat Dilek +Tested-by: Sedat Dilek # Debian/Selfmade LLVM-14 (x86-64) +Cc: Adrian Hunter +Cc: Fangrui Song +Cc: Florian Fainelli +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: John Keeping +Cc: Leo Yan +Cc: Michael Petlan +Cc: Namhyung Kim +Cc: Nathan Chancellor +Cc: Nick Desaulniers +Link: http://lore.kernel.org/lkml/YkxWcYzph5pC1EK8@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/build/feature/Makefile | 7 +++++++ + tools/perf/Makefile.config | 3 +++ + 2 files changed, 10 insertions(+) + +--- a/tools/build/feature/Makefile ++++ b/tools/build/feature/Makefile +@@ -207,6 +207,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(P + PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` + FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) + ++ifeq ($(CC_NO_CLANG), 0) ++ PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) ++ PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) ++ PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) ++ FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro ++endif ++ + $(OUTPUT)test-libperl.bin: + $(BUILD) $(FLAGS_PERL_EMBED) + +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -706,6 +706,9 @@ else + LDFLAGS += $(PERL_EMBED_LDFLAGS) + EXTLIBS += $(PERL_EMBED_LIBADD) + CFLAGS += -DHAVE_LIBPERL_SUPPORT ++ ifeq ($(CC_NO_CLANG), 0) ++ CFLAGS += -Wno-compound-token-split-by-macro ++ endif + $(call detected,CONFIG_LIBPERL) + endif + endif diff --git a/queue-5.4/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch b/queue-5.4/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch new file mode 100644 index 00000000000..c8b542901a5 --- /dev/null +++ b/queue-5.4/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch @@ -0,0 +1,48 @@ +From 541f695cbcb6932c22638b06e0cbe1d56177e2e9 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Mon, 4 Apr 2022 17:28:48 -0300 +Subject: tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts + +From: Arnaldo Carvalho de Melo + +commit 541f695cbcb6932c22638b06e0cbe1d56177e2e9 upstream. + +Just like its done for ldopts and for both in tools/perf/Makefile.config. + +Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using: + + $(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS)) + +And we need to do it to allow for building with versions of clang where +some gcc options selected by distros are not available. + +Tested-by: Sedat Dilek # Debian/Selfmade LLVM-14 (x86-64) +Cc: Adrian Hunter +Cc: Fangrui Song +Cc: Florian Fainelli +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: John Keeping +Cc: Leo Yan +Cc: Michael Petlan +Cc: Namhyung Kim +Cc: Nathan Chancellor +Cc: Nick Desaulniers +Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/build/feature/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/build/feature/Makefile ++++ b/tools/build/feature/Makefile +@@ -204,7 +204,7 @@ strip-libs = $(filter-out -l%,$(1)) + PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) + PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) + PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) +-PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` ++PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) + FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) + + ifeq ($(CC_NO_CLANG), 0)