linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Build perf with clang, failure with libperf
@ 2022-04-04 20:43 Arnaldo Carvalho de Melo
  2022-04-04 21:53 ` Nathan Chancellor
  0 siblings, 1 reply; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-04 20:43 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sedat Dilek, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

Hi,

	Trying to apply Sedat's patch something changed in my system,
and that patch wasn't enough, so I had to first apply this one:

commit 173b552663419f40bcd3cf9df4f68285cac72727
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 4 17:28:48 2022 -0300

    tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
    
    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.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Fangrui Song <maskray@google.com>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: John Keeping <john@metanate.com>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Sedat Dilek <sedat.dilek@gmail.com>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e2cb3..90774b60d31b2b8e 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -217,7 +217,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)
 
 $(OUTPUT)test-libperl.bin:

----------------------------------------------------- 8< -------------------

After this I go on filtering out some of the gcc options that clang
doesn't grok:

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 90774b60d31b2b8e..bbc5e263e02385ed 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
+PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
+PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
+PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
 $(OUTPUT)test-libperl.bin:

----------------------------------------------------- 8< -------------------

And then get to the problems at the end of this message, which seem
similar to the problem described here:
    
From	Nathan Chancellor <>
Subject	[PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO

https://lkml.org/lkml/2020/9/1/135

So perhaps in this case its better to disable that
-Werror,-Wcompound-token-split-by-macro when building with clang?

- Arnaldo

----------------------------------------------------- 8< -------------------

⬢[acme@toolbox perf]$ cat /tmp/build/perf/feature/test-libperl.make.output
In file included from test-libperl.c:3:
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     )
                        ^
In file included from test-libperl.c:3:
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:151:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:151:5: note: '{' token is here
    ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:151:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:151:5: note: ')' token is here
    ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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     )
                        ^
In file included from test-libperl.c:3:
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:152:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:152:5: note: '{' token is here
    ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:152:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:152:5: note: ')' token is here
    ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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     )
                        ^
In file included from test-libperl.c:3:
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:156:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) 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:156:5: note: '{' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
                                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
    v2 = ROTR32(v2, 7) ^ v0;   \
                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: note: ')' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
} STMT_END
  ^~~~~~~~
/usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
#   define STMT_END     )
                        ^
In file included from test-libperl.c:3:
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:157:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) 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:157:5: note: '{' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
                                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
    v2 = ROTR32(v2, 7) ^ v0;   \
                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: note: ')' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
} STMT_END
  ^~~~~~~~
/usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
#   define STMT_END     )
                        ^
In file included from test-libperl.c:3:
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:158:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) 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:158:5: note: '{' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
                                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
    v2 = ROTR32(v2, 7) ^ v0;   \
                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: note: ')' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
} STMT_END
  ^~~~~~~~
/usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
#   define STMT_END     )
                        ^
In file included from test-libperl.c:3:
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:159:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) 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:159:5: note: '{' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
#define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
                                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
    v2 = ROTR32(v2, 7) ^ v0;   \
                               ^
/usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: note: ')' token is here
    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
} STMT_END
  ^~~~~~~~
/usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
#   define STMT_END     )
                        ^
In file included from test-libperl.c:3:
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:162:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:162:5: note: '{' token is here
    ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:162:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:162:5: note: ')' token is here
    ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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     )
                        ^
In file included from test-libperl.c:3:
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:163:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:163:5: note: '{' token is here
    ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:163:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:163:5: note: ')' token is here
    ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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     )
                        ^
In file included from test-libperl.c:3:
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:164:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
    ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:164:5: note: '{' token is here
    ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
#define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
⬢[acme@toolbox perf]$

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-04 20:43 Build perf with clang, failure with libperf Arnaldo Carvalho de Melo
@ 2022-04-04 21:53 ` Nathan Chancellor
  2022-04-05 14:47   ` Arnaldo Carvalho de Melo
  2022-04-07 10:27   ` Sedat Dilek
  0 siblings, 2 replies; 21+ messages in thread
From: Nathan Chancellor @ 2022-04-04 21:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Sedat Dilek, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

Hi Arnaldo,

On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> Hi,
> 
> 	Trying to apply Sedat's patch something changed in my system,
> and that patch wasn't enough, so I had to first apply this one:
> 
> commit 173b552663419f40bcd3cf9df4f68285cac72727
> Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date:   Mon Apr 4 17:28:48 2022 -0300
> 
>     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
>     
>     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.
>     
>     Cc: Adrian Hunter <adrian.hunter@intel.com>
>     Cc: Fangrui Song <maskray@google.com>
>     Cc: Florian Fainelli <f.fainelli@gmail.com>
>     Cc: Ian Rogers <irogers@google.com>
>     Cc: Jiri Olsa <jolsa@kernel.org>
>     Cc: John Keeping <john@metanate.com>
>     Cc: Leo Yan <leo.yan@linaro.org>
>     Cc: Michael Petlan <mpetlan@redhat.com>
>     Cc: Namhyung Kim <namhyung@kernel.org>
>     Cc: Nathan Chancellor <nathan@kernel.org>
>     Cc: Nick Desaulniers <ndesaulniers@google.com>
>     Cc: Sedat Dilek <sedat.dilek@gmail.com>
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e2cb3..90774b60d31b2b8e 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -217,7 +217,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)
>  
>  $(OUTPUT)test-libperl.bin:
> 
> ----------------------------------------------------- 8< -------------------
> 
> After this I go on filtering out some of the gcc options that clang
> doesn't grok:
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
>  strip-libs = $(filter-out -l%,$(1))
>  
>  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
>  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
>  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
>  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
>  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
>  
>  $(OUTPUT)test-libperl.bin:
> 
> ----------------------------------------------------- 8< -------------------
> 
> And then get to the problems at the end of this message, which seem
> similar to the problem described here:
>     
> From	Nathan Chancellor <>
> Subject	[PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> 
> https://lkml.org/lkml/2020/9/1/135
> 
> So perhaps in this case its better to disable that
> -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.

Cheers,
Nathan

> ----------------------------------------------------- 8< -------------------
> 
> ⬢[acme@toolbox perf]$ cat /tmp/build/perf/feature/test-libperl.make.output
> In file included from test-libperl.c:3:
> 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     )
>                         ^
> In file included from test-libperl.c:3:
> 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:151:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:151:5: note: '{' token is here
>     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:151:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:151:5: note: ')' token is here
>     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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     )
>                         ^
> In file included from test-libperl.c:3:
> 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:152:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:152:5: note: '{' token is here
>     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:152:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:152:5: note: ')' token is here
>     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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     )
>                         ^
> In file included from test-libperl.c:3:
> 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:156:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) 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:156:5: note: '{' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
>                                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
>     v2 = ROTR32(v2, 7) ^ v0;   \
>                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: note: ')' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> } STMT_END
>   ^~~~~~~~
> /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> #   define STMT_END     )
>                         ^
> In file included from test-libperl.c:3:
> 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:157:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) 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:157:5: note: '{' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
>                                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
>     v2 = ROTR32(v2, 7) ^ v0;   \
>                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: note: ')' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> } STMT_END
>   ^~~~~~~~
> /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> #   define STMT_END     )
>                         ^
> In file included from test-libperl.c:3:
> 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:158:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) 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:158:5: note: '{' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
>                                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
>     v2 = ROTR32(v2, 7) ^ v0;   \
>                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: note: ')' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> } STMT_END
>   ^~~~~~~~
> /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> #   define STMT_END     )
>                         ^
> In file included from test-libperl.c:3:
> 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:159:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) 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:159:5: note: '{' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
>                                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
>     v2 = ROTR32(v2, 7) ^ v0;   \
>                                ^
> /usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: note: ')' token is here
>     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> } STMT_END
>   ^~~~~~~~
> /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> #   define STMT_END     )
>                         ^
> In file included from test-libperl.c:3:
> 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:162:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:162:5: note: '{' token is here
>     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:162:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:162:5: note: ')' token is here
>     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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     )
>                         ^
> In file included from test-libperl.c:3:
> 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:163:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:163:5: note: '{' token is here
>     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:163:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:163:5: note: ')' token is here
>     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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     )
>                         ^
> In file included from test-libperl.c:3:
> 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:164:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
>     ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /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:164:5: note: '{' token is here
>     ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
> #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
>                                                 ^
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
> 20 errors generated.
> ⬢[acme@toolbox perf]$

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-04 21:53 ` Nathan Chancellor
@ 2022-04-05 14:47   ` Arnaldo Carvalho de Melo
  2022-04-05 15:46     ` Sedat Dilek
  2022-04-07 10:27   ` Sedat Dilek
  1 sibling, 1 reply; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-05 14:47 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sedat Dilek, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

Em Mon, Apr 04, 2022 at 02:53:24PM -0700, Nathan Chancellor escreveu:
> On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > 	Trying to apply Sedat's patch something changed in my system,
> > and that patch wasn't enough, so I had to first apply this one:

<SNIP>

> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,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)
> >  
> >  $(OUTPUT)test-libperl.bin:
> > 
> > ----------------------------------------------------- 8< -------------------

<SNIP>

> > So perhaps in this case its better to disable that
> > -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.

Ok, so I ended up with the patch below.

On the 5.19 window I'll make the tools/perf/Makefile.config filters only
apply when clang is used and unify these settings so that we have it
setup just in one place, shared by the main build and the feature build.

- Arnaldo

commit 5b5da660aa70e2a01748f602e9bbcd18b162a176
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Tue Apr 5 10:33:21 2022 -0300

    tools build: Filter out options and warnings not supported by clang
    
    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     )
                              ^
    
    Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Fangrui Song <maskray@google.com>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: John Keeping <john@metanate.com>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 90774b60d31b2b8e..de66e1cc073481c5 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -220,6 +220,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
 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)
+  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)
 
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 96ad944ca6a885cd..5b5ba475a5c00c0f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -790,6 +790,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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 14:47   ` Arnaldo Carvalho de Melo
@ 2022-04-05 15:46     ` Sedat Dilek
  2022-04-05 20:00       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 21+ messages in thread
From: Sedat Dilek @ 2022-04-05 15:46 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 13223 bytes --]

?

On Tue, Apr 5, 2022 at 4:47 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Mon, Apr 04, 2022 at 02:53:24PM -0700, Nathan Chancellor escreveu:
> > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > >     Trying to apply Sedat's patch something changed in my system,
> > > and that patch wasn't enough, so I had to first apply this one:
>
> <SNIP>
>
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -217,7 +217,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)
> > >
> > >  $(OUTPUT)test-libperl.bin:
> > >
> > > ----------------------------------------------------- 8< -------------------
>
> <SNIP>
>
> > > So perhaps in this case its better to disable that
> > > -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.
>
> Ok, so I ended up with the patch below.
>
> On the 5.19 window I'll make the tools/perf/Makefile.config filters only
> apply when clang is used and unify these settings so that we have it
> setup just in one place, shared by the main build and the feature build.
>

Hi Arnaldo,

Cool, you stepped in.
Some comments below...

> - Arnaldo
>
> commit 5b5da660aa70e2a01748f602e9bbcd18b162a176
> Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date:   Tue Apr 5 10:33:21 2022 -0300
>
>     tools build: Filter out options and warnings not supported by clang
>
>     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     )
>                               ^
>
>     Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
>     Cc: Adrian Hunter <adrian.hunter@intel.com>
>     Cc: Fangrui Song <maskray@google.com>
>     Cc: Florian Fainelli <f.fainelli@gmail.com>
>     Cc: Ian Rogers <irogers@google.com>
>     Cc: Jiri Olsa <jolsa@kernel.org>
>     Cc: John Keeping <john@metanate.com>
>     Cc: Leo Yan <leo.yan@linaro.org>
>     Cc: Michael Petlan <mpetlan@redhat.com>
>     Cc: Namhyung Kim <namhyung@kernel.org>
>     Cc: Nathan Chancellor <nathan@kernel.org>
>     Cc: Nick Desaulniers <ndesaulniers@google.com>
>     Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.org
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 90774b60d31b2b8e..de66e1cc073481c5 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -220,6 +220,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
>  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)
> +  PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> +  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))

^^ This affects CONFIG_LTO_CLANG=y only, so check for it?

> +  PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> +  FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro

^^ Maybe add a comment here or in the commit message that this occurs
with perl v5.34.
Together with the links Nathan pointing to the perl BTS?

> +endif
> +
>  $(OUTPUT)test-libperl.bin:
>         $(BUILD) $(FLAGS_PERL_EMBED)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 96ad944ca6a885cd..5b5ba475a5c00c0f 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -790,6 +790,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

( I am here on Linux v5.17 + kbuild-gnu11-v5.18 and kbuild-v5.18 fixes. )
( My goal was to build perf with LLVM/Clang v13/v14 and -std=gnu11. )
( Debian/unstable switched to perl v5.34 in February. )
( That is the background I hit these issues. )

Link: https://marc.info/?t=164646683300002&r=1&w=2
Link: https://marc.info/?t=164689324800001&r=1&w=2

Unsure what your base is.

When I recall correctly we have CLANG_FLAGS exported in the top-level Makefile?
Oh no, now it is here.

$ git grep CLANG_FLAGS scripts/Makefile.clang
scripts/Makefile.clang:CLANG_FLAGS      += --target=$(CLANG_TARGET_FLAGS)
scripts/Makefile.clang:CLANG_FLAGS      += --target=$(notdir
$(CROSS_COMPILE:%-=%))
scripts/Makefile.clang:CLANG_FLAGS      += -fno-integrated-as
scripts/Makefile.clang:CLANG_FLAGS      +=
--prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
scripts/Makefile.clang:CLANG_FLAGS      += -fintegrated-as
scripts/Makefile.clang:CLANG_FLAGS      += -Werror=unknown-warning-option
scripts/Makefile.clang:CLANG_FLAGS      += -Werror=ignored-optimization-argument
scripts/Makefile.clang:KBUILD_CFLAGS    += $(CLANG_FLAGS)
scripts/Makefile.clang:KBUILD_AFLAGS    += $(CLANG_FLAGS)
scripts/Makefile.clang:export CLANG_FLAGS

So, are all these CLANG_FLAGS "inherited" to tools/ build ECO systems?
I think no - it has its own rules :-(.

So, we should include scripts/Makefile.clang or enhance
tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
can be overridden).

Jiri pointed out he needed two options (when I recall correctly):

[1] -Wno-unused-command-line-argument

Example:
tools/testing/selftests/bpf/Makefile-# Silence some warnings when
compiled with clang
tools/testing/selftests/bpf/Makefile-ifneq ($(LLVM),)
tools/testing/selftests/bpf/Makefile:CFLAGS += -Wno-unused-command-line-argument
tools/testing/selftests/bpf/Makefile-endif

^^ Here you see it is checked for LLVM.
Again, put that stuff in one single place - tools/scripts/Makefile.include

[2] -Wno-ignored-optimization-argument

Both [1] and [2] were not needed in my case.

[1] is always good to have - not only for perf.

AFAICS, you wanted to consolidate PERL_EMBED_XXX and FLAGS_PERL_EMBED
at a single place.
1. tools/build/feature/Makefile
2. tools/perf/Makefile.config

Can not say where we all need perl check/requirement - maybe put that
stuff to the place where we define/check for toolchain/compiler (see
above)?

Again, all these issues happen because of -Werror is strictly set.

I put my patches around that area (see 2nd patch) - without checking
if the LLVM/Clang toolchain is used or not.
Both patches are attached.

$ git show -1 for-5.17/tools-feature_detect_libperl-clang-dileks-v3
commit 72ba634c9b39547197900d8b64ff36134af3ed08
(for-5.17/tools-feature_detect_libperl-clang-dileks-v3)
Author: Sedat Dilek <sedat.dilek@gmail.com>
Date:   Sun Mar 13 12:37:06 2022 +0100

   tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with perf

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e..fa6be127f483 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
+PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

$(OUTPUT)test-libperl.bin:

$ git show -1 for-5.17/perf-libperl_support-clang-dileks
commit 316a1917ec05772ab0f99dad534fabdd74547865
(for-5.17/perf-libperl_support-clang-dileks)
Author: Sedat Dilek <sedat.dilek@gmail.com>
Date:   Sun Mar 6 11:29:50 2022 +0100

   perf: Fix libperl support with clang and perl v5.34

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e..ef9b37c5c652 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config

all: $(FILES)

-__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
%.bin,%.c,$(@F)) $(LDFLAGS)
+__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
-Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
$(LDFLAGS)
  BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1

__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
%.bin,%.cpp,$(@F)) $(LDFLAGS)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 96ad944ca6a8..acc987daf56e 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -213,7 +213,7 @@ endif

# Treat warnings as errors unless directed not to
ifneq ($(WERROR),0)
-  CORE_CFLAGS += -Werror
+  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
  CXXFLAGS += -Werror
  HOSTCFLAGS += -Werror
endif

With both patches I am able to build perf-5.17 with LLVM/Clang v14 and
-std=gnu11 and perl v5.34.

It's good when Jiri tests on his system.

I can test your patch with my next kernel-build, but can not promise.
Do you have it somewhere in a Git repo/branch or a (LORE) link for
easy application?
Did not check if b4 tool is able to extract it as patch out of your
original email.

- Sedat -

[-- Attachment #2: 0001-tools-feature-detect-libperl-Sync-PERL_EMBED_CCOPTS-.patch --]
[-- Type: text/x-patch, Size: 1077 bytes --]

From 72ba634c9b39547197900d8b64ff36134af3ed08 Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Sun, 13 Mar 2022 12:37:06 +0100
Subject: [PATCH] tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with
 perf

---
 tools/build/feature/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e..fa6be127f483 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
+PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
 $(OUTPUT)test-libperl.bin:
-- 
2.35.1


[-- Attachment #3: 0001-perf-Fix-libperl-support-with-clang-and-perl-v5.34.patch --]
[-- Type: text/x-patch, Size: 1405 bytes --]

From 316a1917ec05772ab0f99dad534fabdd74547865 Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Sun, 6 Mar 2022 11:29:50 +0100
Subject: [PATCH] perf: Fix libperl support with clang and perl v5.34

---
 tools/build/feature/Makefile | 2 +-
 tools/perf/Makefile.config   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e..ef9b37c5c652 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
 
 all: $(FILES)
 
-__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
+__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
 
 __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 96ad944ca6a8..acc987daf56e 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -213,7 +213,7 @@ endif
 
 # Treat warnings as errors unless directed not to
 ifneq ($(WERROR),0)
-  CORE_CFLAGS += -Werror
+  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
   CXXFLAGS += -Werror
   HOSTCFLAGS += -Werror
 endif
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 15:46     ` Sedat Dilek
@ 2022-04-05 20:00       ` Arnaldo Carvalho de Melo
  2022-04-05 21:44         ` Arnaldo Carvalho de Melo
  2022-04-06 20:32         ` Sedat Dilek
  0 siblings, 2 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-05 20:00 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Arnaldo Carvalho de Melo, Nathan Chancellor, Adrian Hunter,
	Fangrui Song, Florian Fainelli, Ian Rogers, Jiri Olsa,
	John Keeping, Leo Yan, Michael Petlan, Namhyung Kim,
	Nick Desaulniers, Linux Kernel Mailing List

Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> On Tue, Apr 5, 2022 at 4:47 PM Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> > Em Mon, Apr 04, 2022 at 02:53:24PM -0700, Nathan Chancellor escreveu:

> > +++ b/tools/build/feature/Makefile
> > @@ -220,6 +220,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> >  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)
> > +  PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > +  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> 
> ^^ This affects CONFIG_LTO_CLANG=y only, so check for it?

Well, at this point when trying to build with CC=clang one won't get
libperf detected, so the priority is to make it work, i.e. filter out
the options that prevent this type of build to complete.

And looking at kernel config options is something we try not to do
 
> > +  PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > +  FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro
> 
> ^^ Maybe add a comment here or in the commit message that this occurs
> with perl v5.34.
> Together with the links Nathan pointing to the perl BTS?

Ok, I'll add these notes to the commit log message.
 
> > +endif
> > +
> >  $(OUTPUT)test-libperl.bin:
> >         $(BUILD) $(FLAGS_PERL_EMBED)

> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 96ad944ca6a885cd..5b5ba475a5c00c0f 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -790,6 +790,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

> ( I am here on Linux v5.17 + kbuild-gnu11-v5.18 and kbuild-v5.18 fixes. )
> ( My goal was to build perf with LLVM/Clang v13/v14 and -std=gnu11. )
> ( Debian/unstable switched to perl v5.34 in February. )
> ( That is the background I hit these issues. )

> Link: https://marc.info/?t=164646683300002&r=1&w=2
> Link: https://marc.info/?t=164689324800001&r=1&w=2

> Unsure what your base is.

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent
 
> When I recall correctly we have CLANG_FLAGS exported in the top-level Makefile?
> Oh no, now it is here.

CLANG_FLAGS?

⬢[acme@toolbox perf]$ grep -r CLANG_FLAGS tools/
tools/testing/selftests/rseq/Makefile:CLANG_FLAGS += -no-integrated-as
tools/testing/selftests/rseq/Makefile:	  $(CLANG_FLAGS)
tools/testing/selftests/tc-testing/Makefile:CLANG_FLAGS = -I. -I$(APIDIR) \
tools/testing/selftests/tc-testing/Makefile:	$(CLANG) $(CLANG_FLAGS) \
tools/testing/selftests/sched/Makefile:CLANG_FLAGS += -no-integrated-as
tools/testing/selftests/sched/Makefile:	  $(CLANG_FLAGS)
⬢[acme@toolbox perf]$

That is not used in perf or tools/build/
 
> $ git grep CLANG_FLAGS scripts/Makefile.clang
> scripts/Makefile.clang:CLANG_FLAGS      += --target=$(CLANG_TARGET_FLAGS)
> scripts/Makefile.clang:CLANG_FLAGS      += --target=$(notdir
> $(CROSS_COMPILE:%-=%))
> scripts/Makefile.clang:CLANG_FLAGS      += -fno-integrated-as
> scripts/Makefile.clang:CLANG_FLAGS      +=
> --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> scripts/Makefile.clang:CLANG_FLAGS      += -fintegrated-as
> scripts/Makefile.clang:CLANG_FLAGS      += -Werror=unknown-warning-option
> scripts/Makefile.clang:CLANG_FLAGS      += -Werror=ignored-optimization-argument
> scripts/Makefile.clang:KBUILD_CFLAGS    += $(CLANG_FLAGS)
> scripts/Makefile.clang:KBUILD_AFLAGS    += $(CLANG_FLAGS)
> scripts/Makefile.clang:export CLANG_FLAGS
> 
> So, are all these CLANG_FLAGS "inherited" to tools/ build ECO systems?

Not really

> I think no - it has its own rules :-(.

yes
 
> So, we should include scripts/Makefile.clang or enhance
> tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> can be overridden).

> Jiri pointed out he needed two options (when I recall correctly):
> 
> [1] -Wno-unused-command-line-argument
> 
> Example:
> tools/testing/selftests/bpf/Makefile-# Silence some warnings when
> compiled with clang
> tools/testing/selftests/bpf/Makefile-ifneq ($(LLVM),)
> tools/testing/selftests/bpf/Makefile:CFLAGS += -Wno-unused-command-line-argument
> tools/testing/selftests/bpf/Makefile-endif
> 
> ^^ Here you see it is checked for LLVM.
> Again, put that stuff in one single place - tools/scripts/Makefile.include
> 
> [2] -Wno-ignored-optimization-argument
> 
> Both [1] and [2] were not needed in my case.
> 
> [1] is always good to have - not only for perf.
> 
> AFAICS, you wanted to consolidate PERL_EMBED_XXX and FLAGS_PERL_EMBED
> at a single place.
> 1. tools/build/feature/Makefile
> 2. tools/perf/Makefile.config

Yeah, at some point I'll do it, probably in the 5.19 window.
 
> Can not say where we all need perl check/requirement - maybe put that
> stuff to the place where we define/check for toolchain/compiler (see
> above)?
> 
> Again, all these issues happen because of -Werror is strictly set.
> 
> I put my patches around that area (see 2nd patch) - without checking
> if the LLVM/Clang toolchain is used or not.
> Both patches are attached.

I saw those patches, even added a:

Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
 
> $ git show -1 for-5.17/tools-feature_detect_libperl-clang-dileks-v3
> commit 72ba634c9b39547197900d8b64ff36134af3ed08
> (for-5.17/tools-feature_detect_libperl-clang-dileks-v3)
> Author: Sedat Dilek <sedat.dilek@gmail.com>
> Date:   Sun Mar 13 12:37:06 2022 +0100
> 
>    tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with perf
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e..fa6be127f483 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> 
> $(OUTPUT)test-libperl.bin:
> 
> $ git show -1 for-5.17/perf-libperl_support-clang-dileks
> commit 316a1917ec05772ab0f99dad534fabdd74547865
> (for-5.17/perf-libperl_support-clang-dileks)
> Author: Sedat Dilek <sedat.dilek@gmail.com>
> Date:   Sun Mar 6 11:29:50 2022 +0100
> 
>    perf: Fix libperl support with clang and perl v5.34
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e..ef9b37c5c652 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> 
> all: $(FILES)
> 
> -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> %.bin,%.c,$(@F)) $(LDFLAGS)
> +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
> -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
> $(LDFLAGS)
>   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> 
> __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> %.bin,%.cpp,$(@F)) $(LDFLAGS)
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 96ad944ca6a8..acc987daf56e 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -213,7 +213,7 @@ endif
> 
> # Treat warnings as errors unless directed not to
> ifneq ($(WERROR),0)
> -  CORE_CFLAGS += -Werror
> +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro

Ok, you added it right after -Werror, which is equivalent, in the
feature test case, to what I did.

I'll take that into account when working on having all this in a single
place, next merge window.

>   CXXFLAGS += -Werror
>   HOSTCFLAGS += -Werror
> endif
> 
> With both patches I am able to build perf-5.17 with LLVM/Clang v14 and
> -std=gnu11 and perl v5.34.
> 
> It's good when Jiri tests on his system.

Right, I'll test on these containers, with many gcc and clang versions:

   1 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
   2 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
   3 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
   4 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
   5 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
   6 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
   7 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
   8 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
   9 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
  10 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
  11 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1 
  12 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
  13 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
  14 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
  15 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
  16 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0 
  17 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
  18 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
  19 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
  20 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
  21 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
  22 archlinux:base                : FAIL clang version 13.0.1
  23 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
  24 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
  25 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220322 releases/gcc-11.2.0-884-gf45603f39b , clang version 13.0.0
  26 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
  27 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
  28 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
  29 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
  30 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  31 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  32 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110 
  33 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  34 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
  35 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
  36 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
  37 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 
  38 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
  39 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
  40 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
  41 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
  42 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
  43 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
  44 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
  45 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
  46 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
  47 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
  48 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 
  49 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 
  50 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
  51 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) 
  52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 13.0.1 (Fedora 13.0.1-1.fc37)
  53 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
  54 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
  55 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
  56 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
  57 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
  58 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
  59 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
  60 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
  61 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1 
  62 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
  63 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
  64 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
  65 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
  66 rockylinux:8                  : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module+el8.5.0+715+58f51d49)
  67 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 , clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
  68 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  69 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  70 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  71 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  72 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  73 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
  74 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 , clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
  75 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 
  76 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 
  77 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  78 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  79 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  80 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  81 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  82 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  83 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  84 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
  85 ubuntu:20.04                  : FAIL clang version 10.0.0-4ubuntu1 
  86 ubuntu:20.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 
  87 ubuntu:20.10                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 , Ubuntu clang version 11.0.0-2
  88 ubuntu:21.04                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 , Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
  89 ubuntu:21.10                  : Ok   gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0 , Ubuntu clang version 13.0.0-2
  90 ubuntu:22.04                  : FAIL gcc version 11.2.0 (Ubuntu 11.2.0-18ubuntu1) 
 
> I can test your patch with my next kernel-build, but can not promise.
> Do you have it somewhere in a Git repo/branch or a (LORE) link for
> easy application?

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent

> Did not check if b4 tool is able to extract it as patch out of your
> original email.
> 
> - Sedat -

> From 72ba634c9b39547197900d8b64ff36134af3ed08 Mon Sep 17 00:00:00 2001
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 13 Mar 2022 12:37:06 +0100
> Subject: [PATCH] tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with
>  perf
> 
> ---
>  tools/build/feature/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e..fa6be127f483 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
>  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
>  
>  $(OUTPUT)test-libperl.bin:
> -- 
> 2.35.1
> 

> From 316a1917ec05772ab0f99dad534fabdd74547865 Mon Sep 17 00:00:00 2001
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 6 Mar 2022 11:29:50 +0100
> Subject: [PATCH] perf: Fix libperl support with clang and perl v5.34
> 
> ---
>  tools/build/feature/Makefile | 2 +-
>  tools/perf/Makefile.config   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e..ef9b37c5c652 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
>  
>  all: $(FILES)
>  
> -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
>    BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
>  
>  __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 96ad944ca6a8..acc987daf56e 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -213,7 +213,7 @@ endif
>  
>  # Treat warnings as errors unless directed not to
>  ifneq ($(WERROR),0)
> -  CORE_CFLAGS += -Werror
> +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
>    CXXFLAGS += -Werror
>    HOSTCFLAGS += -Werror
>  endif
> -- 
> 2.35.1
> 


- Arnaldo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 20:00       ` Arnaldo Carvalho de Melo
@ 2022-04-05 21:44         ` Arnaldo Carvalho de Melo
  2022-04-06 20:44           ` Sedat Dilek
  2022-04-08 14:49           ` Arnaldo Carvalho de Melo
  2022-04-06 20:32         ` Sedat Dilek
  1 sibling, 2 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-05 21:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Sedat Dilek, Nathan Chancellor, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > So, we should include scripts/Makefile.clang or enhance
> > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > can be overridden).
> 
> > Jiri pointed out he needed two options (when I recall correctly):
> > 
> > [1] -Wno-unused-command-line-argument

I didn't see this one so far, but this one, and for the python case,
appears on clang 13 on:

  22    45.02 archlinux:base                : FAIL clang version 13.0.1

  CC      /tmp/build/perf/arch/x86/util/pmu.o
clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
error: command '/usr/sbin/clang' failed with exit code 1
  MKDIR   /tmp/build/perf/ui/stdio/
cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
  CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
make[2]: *** Waiting for unfinished jobs....

 
> > Example:
> > tools/testing/selftests/bpf/Makefile-# Silence some warnings when
> > compiled with clang
> > tools/testing/selftests/bpf/Makefile-ifneq ($(LLVM),)
> > tools/testing/selftests/bpf/Makefile:CFLAGS += -Wno-unused-command-line-argument
> > tools/testing/selftests/bpf/Makefile-endif
> > 
> > ^^ Here you see it is checked for LLVM.
> > Again, put that stuff in one single place - tools/scripts/Makefile.include
> > 
> > [2] -Wno-ignored-optimization-argument
> > 
> > Both [1] and [2] were not needed in my case.
> > 
> > [1] is always good to have - not only for perf.
> > 
> > AFAICS, you wanted to consolidate PERL_EMBED_XXX and FLAGS_PERL_EMBED
> > at a single place.
> > 1. tools/build/feature/Makefile
> > 2. tools/perf/Makefile.config
> 
> Yeah, at some point I'll do it, probably in the 5.19 window.
>  
> > Can not say where we all need perl check/requirement - maybe put that
> > stuff to the place where we define/check for toolchain/compiler (see
> > above)?
> > 
> > Again, all these issues happen because of -Werror is strictly set.
> > 
> > I put my patches around that area (see 2nd patch) - without checking
> > if the LLVM/Clang toolchain is used or not.
> > Both patches are attached.
> 
> I saw those patches, even added a:
> 
> Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
>  
> > $ git show -1 for-5.17/tools-feature_detect_libperl-clang-dileks-v3
> > commit 72ba634c9b39547197900d8b64ff36134af3ed08
> > (for-5.17/tools-feature_detect_libperl-clang-dileks-v3)
> > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > Date:   Sun Mar 13 12:37:06 2022 +0100
> > 
> >    tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with perf
> > 
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..fa6be127f483 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > 
> > $(OUTPUT)test-libperl.bin:
> > 
> > $ git show -1 for-5.17/perf-libperl_support-clang-dileks
> > commit 316a1917ec05772ab0f99dad534fabdd74547865
> > (for-5.17/perf-libperl_support-clang-dileks)
> > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > Date:   Sun Mar 6 11:29:50 2022 +0100
> > 
> >    perf: Fix libperl support with clang and perl v5.34
> > 
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..ef9b37c5c652 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> > 
> > all: $(FILES)
> > 
> > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > %.bin,%.c,$(@F)) $(LDFLAGS)
> > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
> > -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
> > $(LDFLAGS)
> >   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> > 
> > __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 96ad944ca6a8..acc987daf56e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -213,7 +213,7 @@ endif
> > 
> > # Treat warnings as errors unless directed not to
> > ifneq ($(WERROR),0)
> > -  CORE_CFLAGS += -Werror
> > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
> 
> Ok, you added it right after -Werror, which is equivalent, in the
> feature test case, to what I did.
> 
> I'll take that into account when working on having all this in a single
> place, next merge window.
> 
> >   CXXFLAGS += -Werror
> >   HOSTCFLAGS += -Werror
> > endif
> > 
> > With both patches I am able to build perf-5.17 with LLVM/Clang v14 and
> > -std=gnu11 and perl v5.34.
> > 
> > It's good when Jiri tests on his system.
> 
> Right, I'll test on these containers, with many gcc and clang versions:
> 
>    1 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
>    2 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
>    3 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
>    4 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
>    5 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
>    6 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
>    7 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
>    8 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
>    9 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
>   10 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
>   11 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1 
>   12 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
>   13 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
>   14 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
>   15 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
>   16 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0 
>   17 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
>   18 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
>   19 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
>   20 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
>   21 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
>   22 archlinux:base                : FAIL clang version 13.0.1
>   23 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
>   24 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
>   25 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220322 releases/gcc-11.2.0-884-gf45603f39b , clang version 13.0.0
>   26 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
>   27 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
>   28 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
>   29 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
>   30 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
>   31 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
>   32 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110 
>   33 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
>   34 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
>   35 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
>   36 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
>   37 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 
>   38 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
>   39 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
>   40 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
>   41 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
>   42 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
>   43 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
>   44 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
>   45 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>   46 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
>   47 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
>   48 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 
>   49 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 
>   50 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
>   51 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) 
>   52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 13.0.1 (Fedora 13.0.1-1.fc37)
>   53 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
>   54 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
>   55 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
>   56 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
>   57 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
>   58 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
>   59 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
>   60 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
>   61 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1 
>   62 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   63 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   64 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
>   65 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
>   66 rockylinux:8                  : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module+el8.5.0+715+58f51d49)
>   67 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 , clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
>   68 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   69 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   70 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   71 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   72 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   73 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 
>   74 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 , clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
>   75 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 
>   76 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 
>   77 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   78 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   79 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   80 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   81 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   82 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   83 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   84 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 
>   85 ubuntu:20.04                  : FAIL clang version 10.0.0-4ubuntu1 
>   86 ubuntu:20.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 
>   87 ubuntu:20.10                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 , Ubuntu clang version 11.0.0-2
>   88 ubuntu:21.04                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 , Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
>   89 ubuntu:21.10                  : Ok   gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0 , Ubuntu clang version 13.0.0-2
>   90 ubuntu:22.04                  : FAIL gcc version 11.2.0 (Ubuntu 11.2.0-18ubuntu1) 
>  
> > I can test your patch with my next kernel-build, but can not promise.
> > Do you have it somewhere in a Git repo/branch or a (LORE) link for
> > easy application?
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent
> 
> > Did not check if b4 tool is able to extract it as patch out of your
> > original email.
> > 
> > - Sedat -
> 
> > From 72ba634c9b39547197900d8b64ff36134af3ed08 Mon Sep 17 00:00:00 2001
> > From: Sedat Dilek <sedat.dilek@gmail.com>
> > Date: Sun, 13 Mar 2022 12:37:06 +0100
> > Subject: [PATCH] tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with
> >  perf
> > 
> > ---
> >  tools/build/feature/Makefile | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..fa6be127f483 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> >  
> >  $(OUTPUT)test-libperl.bin:
> > -- 
> > 2.35.1
> > 
> 
> > From 316a1917ec05772ab0f99dad534fabdd74547865 Mon Sep 17 00:00:00 2001
> > From: Sedat Dilek <sedat.dilek@gmail.com>
> > Date: Sun, 6 Mar 2022 11:29:50 +0100
> > Subject: [PATCH] perf: Fix libperl support with clang and perl v5.34
> > 
> > ---
> >  tools/build/feature/Makefile | 2 +-
> >  tools/perf/Makefile.config   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..ef9b37c5c652 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> >  
> >  all: $(FILES)
> >  
> > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> >    BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> >  
> >  __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 96ad944ca6a8..acc987daf56e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -213,7 +213,7 @@ endif
> >  
> >  # Treat warnings as errors unless directed not to
> >  ifneq ($(WERROR),0)
> > -  CORE_CFLAGS += -Werror
> > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
> >    CXXFLAGS += -Werror
> >    HOSTCFLAGS += -Werror
> >  endif
> > -- 
> > 2.35.1
> > 
> 
> 
> - Arnaldo

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 20:00       ` Arnaldo Carvalho de Melo
  2022-04-05 21:44         ` Arnaldo Carvalho de Melo
@ 2022-04-06 20:32         ` Sedat Dilek
  1 sibling, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-06 20:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 28651 bytes --]

On Tue, Apr 5, 2022 at 10:00 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > On Tue, Apr 5, 2022 at 4:47 PM Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> > > Em Mon, Apr 04, 2022 at 02:53:24PM -0700, Nathan Chancellor escreveu:
>
> > > +++ b/tools/build/feature/Makefile
> > > @@ -220,6 +220,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > >  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)
> > > +  PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > +  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> >
> > ^^ This affects CONFIG_LTO_CLANG=y only, so check for it?
>
> Well, at this point when trying to build with CC=clang one won't get
> libperf detected, so the priority is to make it work, i.e. filter out
> the options that prevent this type of build to complete.
>
> And looking at kernel config options is something we try not to do
>
> > > +  PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > +  FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro
> >
> > ^^ Maybe add a comment here or in the commit message that this occurs
> > with perl v5.34.
> > Together with the links Nathan pointing to the perl BTS?
>
> Ok, I'll add these notes to the commit log message.
>
> > > +endif
> > > +
> > >  $(OUTPUT)test-libperl.bin:
> > >         $(BUILD) $(FLAGS_PERL_EMBED)
>
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 96ad944ca6a885cd..5b5ba475a5c00c0f 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -790,6 +790,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
>
> > ( I am here on Linux v5.17 + kbuild-gnu11-v5.18 and kbuild-v5.18 fixes. )
> > ( My goal was to build perf with LLVM/Clang v13/v14 and -std=gnu11. )
> > ( Debian/unstable switched to perl v5.34 in February. )
> > ( That is the background I hit these issues. )
>
> > Link: https://marc.info/?t=164646683300002&r=1&w=2
> > Link: https://marc.info/?t=164689324800001&r=1&w=2
>
> > Unsure what your base is.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent
>
> > When I recall correctly we have CLANG_FLAGS exported in the top-level Makefile?
> > Oh no, now it is here.
>
> CLANG_FLAGS?
>
> ⬢[acme@toolbox perf]$ grep -r CLANG_FLAGS tools/
> tools/testing/selftests/rseq/Makefile:CLANG_FLAGS += -no-integrated-as
> tools/testing/selftests/rseq/Makefile:    $(CLANG_FLAGS)
> tools/testing/selftests/tc-testing/Makefile:CLANG_FLAGS = -I. -I$(APIDIR) \
> tools/testing/selftests/tc-testing/Makefile:    $(CLANG) $(CLANG_FLAGS) \
> tools/testing/selftests/sched/Makefile:CLANG_FLAGS += -no-integrated-as
> tools/testing/selftests/sched/Makefile:   $(CLANG_FLAGS)
> ⬢[acme@toolbox perf]$
>
> That is not used in perf or tools/build/
>
> > $ git grep CLANG_FLAGS scripts/Makefile.clang
> > scripts/Makefile.clang:CLANG_FLAGS      += --target=$(CLANG_TARGET_FLAGS)
> > scripts/Makefile.clang:CLANG_FLAGS      += --target=$(notdir
> > $(CROSS_COMPILE:%-=%))
> > scripts/Makefile.clang:CLANG_FLAGS      += -fno-integrated-as
> > scripts/Makefile.clang:CLANG_FLAGS      +=
> > --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> > scripts/Makefile.clang:CLANG_FLAGS      += -fintegrated-as
> > scripts/Makefile.clang:CLANG_FLAGS      += -Werror=unknown-warning-option
> > scripts/Makefile.clang:CLANG_FLAGS      += -Werror=ignored-optimization-argument
> > scripts/Makefile.clang:KBUILD_CFLAGS    += $(CLANG_FLAGS)
> > scripts/Makefile.clang:KBUILD_AFLAGS    += $(CLANG_FLAGS)
> > scripts/Makefile.clang:export CLANG_FLAGS
> >
> > So, are all these CLANG_FLAGS "inherited" to tools/ build ECO systems?
>
> Not really
>
> > I think no - it has its own rules :-(.
>
> yes
>
> > So, we should include scripts/Makefile.clang or enhance
> > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > can be overridden).
>
> > Jiri pointed out he needed two options (when I recall correctly):
> >
> > [1] -Wno-unused-command-line-argument
> >
> > Example:
> > tools/testing/selftests/bpf/Makefile-# Silence some warnings when
> > compiled with clang
> > tools/testing/selftests/bpf/Makefile-ifneq ($(LLVM),)
> > tools/testing/selftests/bpf/Makefile:CFLAGS += -Wno-unused-command-line-argument
> > tools/testing/selftests/bpf/Makefile-endif
> >
> > ^^ Here you see it is checked for LLVM.
> > Again, put that stuff in one single place - tools/scripts/Makefile.include
> >
> > [2] -Wno-ignored-optimization-argument
> >
> > Both [1] and [2] were not needed in my case.
> >
> > [1] is always good to have - not only for perf.
> >
> > AFAICS, you wanted to consolidate PERL_EMBED_XXX and FLAGS_PERL_EMBED
> > at a single place.
> > 1. tools/build/feature/Makefile
> > 2. tools/perf/Makefile.config
>
> Yeah, at some point I'll do it, probably in the 5.19 window.
>
> > Can not say where we all need perl check/requirement - maybe put that
> > stuff to the place where we define/check for toolchain/compiler (see
> > above)?
> >
> > Again, all these issues happen because of -Werror is strictly set.
> >
> > I put my patches around that area (see 2nd patch) - without checking
> > if the LLVM/Clang toolchain is used or not.
> > Both patches are attached.
>
> I saw those patches, even added a:
>
> Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
>
> > $ git show -1 for-5.17/tools-feature_detect_libperl-clang-dileks-v3
> > commit 72ba634c9b39547197900d8b64ff36134af3ed08
> > (for-5.17/tools-feature_detect_libperl-clang-dileks-v3)
> > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > Date:   Sun Mar 13 12:37:06 2022 +0100
> >
> >    tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with perf
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..fa6be127f483 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> >
> > $(OUTPUT)test-libperl.bin:
> >
> > $ git show -1 for-5.17/perf-libperl_support-clang-dileks
> > commit 316a1917ec05772ab0f99dad534fabdd74547865
> > (for-5.17/perf-libperl_support-clang-dileks)
> > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > Date:   Sun Mar 6 11:29:50 2022 +0100
> >
> >    perf: Fix libperl support with clang and perl v5.34
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..ef9b37c5c652 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> >
> > all: $(FILES)
> >
> > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > %.bin,%.c,$(@F)) $(LDFLAGS)
> > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
> > -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
> > $(LDFLAGS)
> >   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> >
> > __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 96ad944ca6a8..acc987daf56e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -213,7 +213,7 @@ endif
> >
> > # Treat warnings as errors unless directed not to
> > ifneq ($(WERROR),0)
> > -  CORE_CFLAGS += -Werror
> > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
>
> Ok, you added it right after -Werror, which is equivalent, in the
> feature test case, to what I did.
>
> I'll take that into account when working on having all this in a single
> place, next merge window.
>
> >   CXXFLAGS += -Werror
> >   HOSTCFLAGS += -Werror
> > endif
> >
> > With both patches I am able to build perf-5.17 with LLVM/Clang v14 and
> > -std=gnu11 and perl v5.34.
> >
> > It's good when Jiri tests on his system.
>
> Right, I'll test on these containers, with many gcc and clang versions:
>
>    1 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
>    2 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
>    3 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
>    4 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
>    5 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
>    6 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
>    7 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
>    8 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
>    9 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
>   10 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
>   11 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
>   12 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
>   13 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
>   14 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
>   15 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
>   16 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
>   17 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
>   18 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
>   19 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
>   20 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
>   21 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
>   22 archlinux:base                : FAIL clang version 13.0.1
>   23 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
>   24 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
>   25 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220322 releases/gcc-11.2.0-884-gf45603f39b , clang version 13.0.0
>   26 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
>   27 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
>   28 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
>   29 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
>   30 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   31 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   32 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
>   33 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   34 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
>   35 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
>   36 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
>   37 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
>   38 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
>   39 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
>   40 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
>   41 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
>   42 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
>   43 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
>   44 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
>   45 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>   46 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
>   47 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
>   48 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
>   49 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
>   50 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
>   51 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
>   52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 13.0.1 (Fedora 13.0.1-1.fc37)
>   53 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
>   54 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
>   55 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
>   56 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
>   57 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
>   58 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
>   59 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
>   60 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
>   61 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
>   62 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   63 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   64 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
>   65 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
>   66 rockylinux:8                  : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module+el8.5.0+715+58f51d49)
>   67 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 , clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
>   68 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   69 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   70 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   71 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   72 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   73 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
>   74 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 , clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
>   75 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
>   76 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
>   77 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   78 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   79 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   80 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   81 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   82 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   83 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   84 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>   85 ubuntu:20.04                  : FAIL clang version 10.0.0-4ubuntu1
>   86 ubuntu:20.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
>   87 ubuntu:20.10                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 , Ubuntu clang version 11.0.0-2
>   88 ubuntu:21.04                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 , Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
>   89 ubuntu:21.10                  : Ok   gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0 , Ubuntu clang version 13.0.0-2
>   90 ubuntu:22.04                  : FAIL gcc version 11.2.0 (Ubuntu 11.2.0-18ubuntu1)
>
> > I can test your patch with my next kernel-build, but can not promise.
> > Do you have it somewhere in a Git repo/branch or a (LORE) link for
> > easy application?
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent
>
> > Did not check if b4 tool is able to extract it as patch out of your
> > original email.
> >
> > - Sedat -
>
> > From 72ba634c9b39547197900d8b64ff36134af3ed08 Mon Sep 17 00:00:00 2001
> > From: Sedat Dilek <sedat.dilek@gmail.com>
> > Date: Sun, 13 Mar 2022 12:37:06 +0100
> > Subject: [PATCH] tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with
> >  perf
> >
> > ---
> >  tools/build/feature/Makefile | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..fa6be127f483 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> >
> >  $(OUTPUT)test-libperl.bin:
> > --
> > 2.35.1
> >
>
> > From 316a1917ec05772ab0f99dad534fabdd74547865 Mon Sep 17 00:00:00 2001
> > From: Sedat Dilek <sedat.dilek@gmail.com>
> > Date: Sun, 6 Mar 2022 11:29:50 +0100
> > Subject: [PATCH] perf: Fix libperl support with clang and perl v5.34
> >
> > ---
> >  tools/build/feature/Makefile | 2 +-
> >  tools/perf/Makefile.config   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e..ef9b37c5c652 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> >
> >  all: $(FILES)
> >
> > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> >    BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> >
> >  __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 96ad944ca6a8..acc987daf56e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -213,7 +213,7 @@ endif
> >
> >  # Treat warnings as errors unless directed not to
> >  ifneq ($(WERROR),0)
> > -  CORE_CFLAGS += -Werror
> > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
> >    CXXFLAGS += -Werror
> >    HOSTCFLAGS += -Werror
> >  endif
> > --
> > 2.35.1
> >
>
>
> - Arnaldo

Hi Arnaldo,

Thanks for your patches.

I tested with Debian's latest LLVM-14 and my selfmade LLVM-14 toolchains.

$ /usr/lib/llvm-14/bin/clang -v
Debian clang version 14.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-14/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ /opt/llvm-toolchain/bin/clang -v
dileks clang version 14.0.1 (https://github.com/llvm/llvm-project.git
99c0f85ef992e9aa6465f27a8b05601667412bc7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm-toolchain/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

I reverted my patches and applied yours:

$ git log --oneline -4
bccc88d26f1f (HEAD -> 5.17.1-6-amd64-clang14-lto) tools build: Filter
out options and warnings not supported by clang
19b1b5c6614c tools build: Use $(shell ) instead of `` to get embedded
libperl's ccopts
c655b9fbcfd2 Revert "perf: Fix libperl support with clang and perl v5.34"
99ea736f45f7 Revert "tools: feature-detect: libperl: Sync
PERL_EMBED_CCOPTS with perf"

[ debian LLVM-14 ]

 1019  2022-04-06 22:03:11 LLVM_MVER="14"
 1020  2022-04-06 22:03:11 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
 1021  2022-04-06 22:03:11 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
 1022  2022-04-06 22:03:11 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
 1023  2022-04-06 22:03:11 echo $PATH
 1024  2022-04-06 22:03:11 PYTHON_VER="3.10"
 1025  2022-04-06 22:03:11 MAKE="make"
 1026  2022-04-06 22:03:11 MAKE_OPTS="V=1 -j4 HOSTCC=clang
HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
STRIP=llvm-strip"
 1027  2022-04-06 22:03:11 echo $PYTHON_VER $MAKE $MAKE_OPTS
 1028  2022-04-06 22:03:46 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
clean 2>&1 | tee ../make-log_perf-clean.txt
 1029  2022-04-06 22:04:21 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14.txt

 [ dileks LLVM-14 ]

 1004  2022-04-06 22:14:23 LLVM_MVER="14"
 1005  2022-04-06 22:14:35 LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
 1006  2022-04-06 22:14:35 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
 1007  2022-04-06 22:14:35 echo $PATH
 1008  2022-04-06 22:14:35 PYTHON_VER="3.10"
 1009  2022-04-06 22:14:35 MAKE="make"
 1010  2022-04-06 22:14:35 MAKE_OPTS="V=1 -j4 HOSTCC=clang
HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
STRIP=llvm-strip"
 1011  2022-04-06 22:14:35 echo $PYTHON_VER $MAKE $MAKE_OPTS
 1012  2022-04-06 22:14:41 echo $PATH
 1013  2022-04-06 22:14:51 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
clean 2>&1 | tee ../make-log_perf-clean.txt
 1014  2022-04-06 22:14:56 cd git/
 1015  2022-04-06 22:14:57 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
clean 2>&1 | tee ../make-log_perf-clean.txt
 1016  2022-04-06 22:15:14 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
../make-log_perf-python${PYTHON_VER}-install_bin_dileks-llvm14.txt

[ PERF ]

$ ~/bin/perf -vv
perf version 5.17.1
                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                 glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                   aio: [ on  ]  # HAVE_AIO_SUPPORT
                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
               libpfm4: [ OFF ]  # HAVE_LIBPFM

For details see attached instructions and build-logs.

Feel free to add my credits:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade
LLVM-14 (x86-64)

Personally, I would like to see your patches for Linux v5.18 (do not
wait v5.19).

- Sedat -

[-- Attachment #2: TESTING-PERF-URGENT-ACME-20220406.txt --]
[-- Type: text/plain, Size: 4371 bytes --]

[ PREPS ]

 1006  2022-04-06 21:57:50 git log --oneline v5.17.1.. | grep perl
 1007  2022-04-06 21:58:33 git revert --no-edit 72ba634c9b39
 1008  2022-04-06 22:00:28 git revert --no-edit 316a1917ec05
 1009  2022-04-06 22:00:31 cd ..
 1010  2022-04-06 22:01:13 wget -O 1-perf-urgent-acme.patch "https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/patch/?id=c9094fca93272e0bdc580af695cc69e737b8cab3"
 1011  2022-04-06 22:01:34 wget -O 2-perf-urgent-acme.patch "https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/patch/?id=3507caedc1019e65ea7b9b87a19ba8a03a84f2a9"
 1012  2022-04-06 22:01:36 cd git/
 1013  2022-04-06 22:01:40 git branch --show-current
 1014  2022-04-06 22:01:49 git apply --check --verbose ../1-perf-urgent-acme.patch
 1015  2022-04-06 22:01:56 git am ../1-perf-urgent-acme.patch
 1016  2022-04-06 22:02:03 git apply --check --verbose ../2-perf-urgent-acme.patch
 1017  2022-04-06 22:02:09 git am ../2-perf-urgent-acme.patch
 1018  2022-04-06 22:02:47 plocate howtos | grep perf

[ debian LLVM-14 ]

 1019  2022-04-06 22:03:11 LLVM_MVER="14"
 1020  2022-04-06 22:03:11 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
 1021  2022-04-06 22:03:11 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
 1022  2022-04-06 22:03:11 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then    export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
 1023  2022-04-06 22:03:11 echo $PATH
 1024  2022-04-06 22:03:11 PYTHON_VER="3.10"
 1025  2022-04-06 22:03:11 MAKE="make"
 1026  2022-04-06 22:03:11 MAKE_OPTS="V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar STRIP=llvm-strip"
 1027  2022-04-06 22:03:11 echo $PYTHON_VER $MAKE $MAKE_OPTS
 1028  2022-04-06 22:03:46 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf clean 2>&1 | tee ../make-log_perf-clean.txt
 1029  2022-04-06 22:04:21 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee ../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14.txt

 [ dileks LLVM-14 ]

 1002  2022-04-06 22:14:13 cd src/
 1003  2022-04-06 22:14:15 cd linux-kernel/
 1004  2022-04-06 22:14:23 LLVM_MVER="14"
 1005  2022-04-06 22:14:35 LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
 1006  2022-04-06 22:14:35 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then    export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
 1007  2022-04-06 22:14:35 echo $PATH
 1008  2022-04-06 22:14:35 PYTHON_VER="3.10"
 1009  2022-04-06 22:14:35 MAKE="make"
 1010  2022-04-06 22:14:35 MAKE_OPTS="V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar STRIP=llvm-strip"
 1011  2022-04-06 22:14:35 echo $PYTHON_VER $MAKE $MAKE_OPTS
 1012  2022-04-06 22:14:41 echo $PATH
 1013  2022-04-06 22:14:51 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf clean 2>&1 | tee ../make-log_perf-clean.txt
 1014  2022-04-06 22:14:56 cd git/
 1015  2022-04-06 22:14:57 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf clean 2>&1 | tee ../make-log_perf-clean.txt
 1016  2022-04-06 22:15:14 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee ../make-log_perf-python${PYTHON_VER}-install_bin_dileks-llvm14.tx
 1017  2022-04-06 22:16:41 ~/bin/perf -vv

$ ~/bin/perf -vv
perf version 5.17.1
                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                 glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                   aio: [ on  ]  # HAVE_AIO_SUPPORT
                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
               libpfm4: [ OFF ]  # HAVE_LIBPFM

- dileks // 06-Apr-2022


[-- Attachment #3: make-log_perf-python3.10-install_bin_debian-llvm14.txt.zst --]
[-- Type: application/zstd, Size: 14905 bytes --]

[-- Attachment #4: make-log_perf-python3.10-install_bin_debian-llvm14.txt.zst.sha256 --]
[-- Type: application/octet-stream, Size: 125 bytes --]

31ea1710d3913dfc2acfd35aa61de37a077c69332941431b7cf3486c83d1f1fc  make-log_perf-python3.10-install_bin_debian-llvm14.txt.zst

[-- Attachment #5: make-log_perf-python3.10-install_bin_dileks-llvm14.txt.zst --]
[-- Type: application/zstd, Size: 14934 bytes --]

[-- Attachment #6: make-log_perf-python3.10-install_bin_dileks-llvm14.txt.zst.sha256 --]
[-- Type: application/octet-stream, Size: 125 bytes --]

bc3eac72915ec9be6f717e56f6119aa98efe44338b750997614345cd25f82fae  make-log_perf-python3.10-install_bin_dileks-llvm14.txt.zst

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 21:44         ` Arnaldo Carvalho de Melo
@ 2022-04-06 20:44           ` Sedat Dilek
  2022-04-08 14:49           ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-06 20:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

On Tue, Apr 5, 2022 at 11:44 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > So, we should include scripts/Makefile.clang or enhance
> > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > can be overridden).
> >
> > > Jiri pointed out he needed two options (when I recall correctly):
> > >
> > > [1] -Wno-unused-command-line-argument
>
> I didn't see this one so far, but this one, and for the python case,
> appears on clang 13 on:
>
>   22    45.02 archlinux:base                : FAIL clang version 13.0.1
>
>   CC      /tmp/build/perf/arch/x86/util/pmu.o
> clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> error: command '/usr/sbin/clang' failed with exit code 1
>   MKDIR   /tmp/build/perf/ui/stdio/
> cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
>   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> make[2]: *** Waiting for unfinished jobs....
>

Thanks for your big testing with diverse combinations of LLVM/GCC toolchains!

Yepp, looks like Jiri's testing/breakage is confirmed;

So enhance:

tools/perf/Makefile.config:      CFLAGS += -Wno-compound-token-split-by-macro

tools/build/feature/Makefile:  FLAGS_PERL_EMBED +=
-Wno-compound-token-split-by-macro

...with ?:

-Wno-unused-command-line-argument
( -Wno-ignored-optimization-argument )

...or use "call cc-option" ?

Looks like tools/ build ECO system allows this:

$ git grep 'call cc-option' tools/
tools/build/Build.include:# Usage: cflags-y += $(call
cc-option,-march=winchip-c6,-march=i586)
tools/thermal/tmon/Makefile:override CFLAGS+= $(call
cc-option,-O3,-O1) ${WARNFLAGS}
tools/thermal/tmon/Makefile:override CFLAGS+= $(call
cc-option,-fstack-protector-strong)

Thanks.

- sed@ -

>
> > > Example:
> > > tools/testing/selftests/bpf/Makefile-# Silence some warnings when
> > > compiled with clang
> > > tools/testing/selftests/bpf/Makefile-ifneq ($(LLVM),)
> > > tools/testing/selftests/bpf/Makefile:CFLAGS += -Wno-unused-command-line-argument
> > > tools/testing/selftests/bpf/Makefile-endif
> > >
> > > ^^ Here you see it is checked for LLVM.
> > > Again, put that stuff in one single place - tools/scripts/Makefile.include
> > >
> > > [2] -Wno-ignored-optimization-argument
> > >
> > > Both [1] and [2] were not needed in my case.
> > >
> > > [1] is always good to have - not only for perf.
> > >
> > > AFAICS, you wanted to consolidate PERL_EMBED_XXX and FLAGS_PERL_EMBED
> > > at a single place.
> > > 1. tools/build/feature/Makefile
> > > 2. tools/perf/Makefile.config
> >
> > Yeah, at some point I'll do it, probably in the 5.19 window.
> >
> > > Can not say where we all need perl check/requirement - maybe put that
> > > stuff to the place where we define/check for toolchain/compiler (see
> > > above)?
> > >
> > > Again, all these issues happen because of -Werror is strictly set.
> > >
> > > I put my patches around that area (see 2nd patch) - without checking
> > > if the LLVM/Clang toolchain is used or not.
> > > Both patches are attached.
> >
> > I saw those patches, even added a:
> >
> > Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
> >
> > > $ git show -1 for-5.17/tools-feature_detect_libperl-clang-dileks-v3
> > > commit 72ba634c9b39547197900d8b64ff36134af3ed08
> > > (for-5.17/tools-feature_detect_libperl-clang-dileks-v3)
> > > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > > Date:   Sun Mar 13 12:37:06 2022 +0100
> > >
> > >    tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with perf
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e..fa6be127f483 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > >
> > > $(OUTPUT)test-libperl.bin:
> > >
> > > $ git show -1 for-5.17/perf-libperl_support-clang-dileks
> > > commit 316a1917ec05772ab0f99dad534fabdd74547865
> > > (for-5.17/perf-libperl_support-clang-dileks)
> > > Author: Sedat Dilek <sedat.dilek@gmail.com>
> > > Date:   Sun Mar 6 11:29:50 2022 +0100
> > >
> > >    perf: Fix libperl support with clang and perl v5.34
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e..ef9b37c5c652 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> > >
> > > all: $(FILES)
> > >
> > > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > > %.bin,%.c,$(@F)) $(LDFLAGS)
> > > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
> > > -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
> > > $(LDFLAGS)
> > >   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> > >
> > > __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
> > > %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 96ad944ca6a8..acc987daf56e 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -213,7 +213,7 @@ endif
> > >
> > > # Treat warnings as errors unless directed not to
> > > ifneq ($(WERROR),0)
> > > -  CORE_CFLAGS += -Werror
> > > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
> >
> > Ok, you added it right after -Werror, which is equivalent, in the
> > feature test case, to what I did.
> >
> > I'll take that into account when working on having all this in a single
> > place, next merge window.
> >
> > >   CXXFLAGS += -Werror
> > >   HOSTCFLAGS += -Werror
> > > endif
> > >
> > > With both patches I am able to build perf-5.17 with LLVM/Clang v14 and
> > > -std=gnu11 and perl v5.34.
> > >
> > > It's good when Jiri tests on his system.
> >
> > Right, I'll test on these containers, with many gcc and clang versions:
> >
> >    1 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
> >    2 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
> >    3 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
> >    4 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
> >    5 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
> >    6 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
> >    7 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
> >    8 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
> >    9 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
> >   10 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
> >   11 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
> >   12 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
> >   13 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
> >   14 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
> >   15 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
> >   16 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
> >   17 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
> >   18 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
> >   19 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
> >   20 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
> >   21 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
> >   22 archlinux:base                : FAIL clang version 13.0.1
> >   23 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
> >   24 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
> >   25 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220322 releases/gcc-11.2.0-884-gf45603f39b , clang version 13.0.0
> >   26 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
> >   27 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
> >   28 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
> >   29 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
> >   30 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   31 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   32 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
> >   33 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   34 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
> >   35 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
> >   36 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
> >   37 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
> >   38 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
> >   39 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
> >   40 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
> >   41 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
> >   42 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
> >   43 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
> >   44 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
> >   45 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> >   46 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
> >   47 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
> >   48 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
> >   49 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
> >   50 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
> >   51 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
> >   52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 13.0.1 (Fedora 13.0.1-1.fc37)
> >   53 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
> >   54 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
> >   55 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
> >   56 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
> >   57 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> >   58 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> >   59 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
> >   60 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
> >   61 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
> >   62 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> >   63 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> >   64 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
> >   65 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
> >   66 rockylinux:8                  : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module+el8.5.0+715+58f51d49)
> >   67 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 , clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
> >   68 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   69 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   70 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   71 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   72 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   73 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
> >   74 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 , clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
> >   75 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
> >   76 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
> >   77 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   78 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   79 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   80 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   81 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   82 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   83 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   84 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> >   85 ubuntu:20.04                  : FAIL clang version 10.0.0-4ubuntu1
> >   86 ubuntu:20.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
> >   87 ubuntu:20.10                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 , Ubuntu clang version 11.0.0-2
> >   88 ubuntu:21.04                  : Ok   gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 , Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
> >   89 ubuntu:21.10                  : Ok   gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0 , Ubuntu clang version 13.0.0-2
> >   90 ubuntu:22.04                  : FAIL gcc version 11.2.0 (Ubuntu 11.2.0-18ubuntu1)
> >
> > > I can test your patch with my next kernel-build, but can not promise.
> > > Do you have it somewhere in a Git repo/branch or a (LORE) link for
> > > easy application?
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tmp.perf/urgent
> >
> > > Did not check if b4 tool is able to extract it as patch out of your
> > > original email.
> > >
> > > - Sedat -
> >
> > > From 72ba634c9b39547197900d8b64ff36134af3ed08 Mon Sep 17 00:00:00 2001
> > > From: Sedat Dilek <sedat.dilek@gmail.com>
> > > Date: Sun, 13 Mar 2022 12:37:06 +0100
> > > Subject: [PATCH] tools: feature-detect: libperl: Sync PERL_EMBED_CCOPTS with
> > >  perf
> > >
> > > ---
> > >  tools/build/feature/Makefile | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e..fa6be127f483 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -217,7 +217,8 @@ 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 = $(perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > >
> > >  $(OUTPUT)test-libperl.bin:
> > > --
> > > 2.35.1
> > >
> >
> > > From 316a1917ec05772ab0f99dad534fabdd74547865 Mon Sep 17 00:00:00 2001
> > > From: Sedat Dilek <sedat.dilek@gmail.com>
> > > Date: Sun, 6 Mar 2022 11:29:50 +0100
> > > Subject: [PATCH] perf: Fix libperl support with clang and perl v5.34
> > >
> > > ---
> > >  tools/build/feature/Makefile | 2 +-
> > >  tools/perf/Makefile.config   | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e..ef9b37c5c652 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> > >
> > >  all: $(FILES)
> > >
> > > -__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> > > +__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
> > >    BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
> > >
> > >  __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 96ad944ca6a8..acc987daf56e 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -213,7 +213,7 @@ endif
> > >
> > >  # Treat warnings as errors unless directed not to
> > >  ifneq ($(WERROR),0)
> > > -  CORE_CFLAGS += -Werror
> > > +  CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
> > >    CXXFLAGS += -Werror
> > >    HOSTCFLAGS += -Werror
> > >  endif
> > > --
> > > 2.35.1
> > >
> >
> >
> > - Arnaldo
>
> --
>
> - Arnaldo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-04 21:53 ` Nathan Chancellor
  2022-04-05 14:47   ` Arnaldo Carvalho de Melo
@ 2022-04-07 10:27   ` Sedat Dilek
  2022-04-07 15:03     ` Nathan Chancellor
  1 sibling, 1 reply; 21+ messages in thread
From: Sedat Dilek @ 2022-04-07 10:27 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Hi Arnaldo,
>
> On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > Hi,
> >
> >       Trying to apply Sedat's patch something changed in my system,
> > and that patch wasn't enough, so I had to first apply this one:
> >
> > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Date:   Mon Apr 4 17:28:48 2022 -0300
> >
> >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> >
> >     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.
> >
> >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> >     Cc: Fangrui Song <maskray@google.com>
> >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> >     Cc: Ian Rogers <irogers@google.com>
> >     Cc: Jiri Olsa <jolsa@kernel.org>
> >     Cc: John Keeping <john@metanate.com>
> >     Cc: Leo Yan <leo.yan@linaro.org>
> >     Cc: Michael Petlan <mpetlan@redhat.com>
> >     Cc: Namhyung Kim <namhyung@kernel.org>
> >     Cc: Nathan Chancellor <nathan@kernel.org>
> >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -217,7 +217,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)
> >
> >  $(OUTPUT)test-libperl.bin:
> >
> > ----------------------------------------------------- 8< -------------------
> >
> > After this I go on filtering out some of the gcc options that clang
> > doesn't grok:
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> >  strip-libs = $(filter-out -l%,$(1))
> >
> >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> >
> >  $(OUTPUT)test-libperl.bin:
> >
> > ----------------------------------------------------- 8< -------------------
> >
> > And then get to the problems at the end of this message, which seem
> > similar to the problem described here:
> >
> > From  Nathan Chancellor <>
> > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> >
> > https://lkml.org/lkml/2020/9/1/135
> >
> > So perhaps in this case its better to disable that
> > -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.
>

Thanks for the pointer Nathan.

As said I hit the problem with Debian's perl v5.34.

Checking perl5 Git reveals:

"skip using gcc brace groups for STMT_START/END"
https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760

"Partially Revert "skip using gcc brace groups for STMT_START/END""
https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c

Perl v5.34.x seems not to have these changes:
https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1

Unsure if there exists a real fix for perl5.

- Sedat -

> Cheers,
> Nathan
>
> > ----------------------------------------------------- 8< -------------------
> >
> > ⬢[acme@toolbox perf]$ cat /tmp/build/perf/feature/test-libperl.make.output
> > In file included from test-libperl.c:3:
> > 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     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:151:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:151:5: note: '{' token is here
> >     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:151:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:151:5: note: ')' token is here
> >     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:152:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:152:5: note: '{' token is here
> >     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:152:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:152:5: note: ')' token is here
> >     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:156:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) 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:156:5: note: '{' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
> >                                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
> >     v2 = ROTR32(v2, 7) ^ v0;   \
> >                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:156:5: note: ')' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> > } STMT_END
> >   ^~~~~~~~
> > /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> > #   define STMT_END     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:157:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) 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:157:5: note: '{' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
> >                                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
> >     v2 = ROTR32(v2, 7) ^ v0;   \
> >                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:157:5: note: ')' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 2/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> > } STMT_END
> >   ^~~~~~~~
> > /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> > #   define STMT_END     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:158:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) 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:158:5: note: '{' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
> >                                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
> >     v2 = ROTR32(v2, 7) ^ v0;   \
> >                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:158:5: note: ')' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 3/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> > } STMT_END
> >   ^~~~~~~~
> > /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> > #   define STMT_END     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:159:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:37: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) 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:159:5: note: '{' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:116:48: note: expanded from macro 'ZAPHOD32_MIX'
> > #define ZAPHOD32_MIX(v0,v1,v2,text) STMT_START {                              \
> >                                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:124:32: note: expanded from macro 'ZAPHOD32_MIX'
> >     v2 = ROTR32(v2, 7) ^ v0;   \
> >                                ^
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:159:5: note: ')' token is here
> >     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 4/4");
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:125:3: note: expanded from macro 'ZAPHOD32_MIX'
> > } STMT_END
> >   ^~~~~~~~
> > /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
> > #   define STMT_END     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:162:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:162:5: note: '{' token is here
> >     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:162:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:162:5: note: ')' token is here
> >     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:163:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:163:5: note: '{' token is here
> >     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:163:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:163:5: note: ')' token is here
> >     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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     )
> >                         ^
> > In file included from test-libperl.c:3:
> > 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:164:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
> >     ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /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:164:5: note: '{' token is here
> >     ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
> > #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
> >                                                 ^
> > fatal error: too many errors emitted, stopping now [-ferror-limit=]
> > 20 errors generated.
> > ⬢[acme@toolbox perf]$

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 10:27   ` Sedat Dilek
@ 2022-04-07 15:03     ` Nathan Chancellor
  2022-04-07 16:25       ` Sedat Dilek
  0 siblings, 1 reply; 21+ messages in thread
From: Nathan Chancellor @ 2022-04-07 15:03 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > Hi Arnaldo,
> >
> > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Hi,
> > >
> > >       Trying to apply Sedat's patch something changed in my system,
> > > and that patch wasn't enough, so I had to first apply this one:
> > >
> > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > >
> > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > >
> > >     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.
> > >
> > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > >     Cc: Fangrui Song <maskray@google.com>
> > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > >     Cc: Ian Rogers <irogers@google.com>
> > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > >     Cc: John Keeping <john@metanate.com>
> > >     Cc: Leo Yan <leo.yan@linaro.org>
> > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -217,7 +217,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)
> > >
> > >  $(OUTPUT)test-libperl.bin:
> > >
> > > ----------------------------------------------------- 8< -------------------
> > >
> > > After this I go on filtering out some of the gcc options that clang
> > > doesn't grok:
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > >  strip-libs = $(filter-out -l%,$(1))
> > >
> > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > >
> > >  $(OUTPUT)test-libperl.bin:
> > >
> > > ----------------------------------------------------- 8< -------------------
> > >
> > > And then get to the problems at the end of this message, which seem
> > > similar to the problem described here:
> > >
> > > From  Nathan Chancellor <>
> > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > >
> > > https://lkml.org/lkml/2020/9/1/135
> > >
> > > So perhaps in this case its better to disable that
> > > -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.
> >
> 
> Thanks for the pointer Nathan.
> 
> As said I hit the problem with Debian's perl v5.34.
> 
> Checking perl5 Git reveals:
> 
> "skip using gcc brace groups for STMT_START/END"
> https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760

GitHub says this is in 5.35.2, so it would make sense that 5.34 still
shows the issue.

> "Partially Revert "skip using gcc brace groups for STMT_START/END""
> https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> 
> Perl v5.34.x seems not to have these changes:
> https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> 
> Unsure if there exists a real fix for perl5.

Perhaps those two changes could be cherry-picked into Debian's 5.34. I
have no idea if that is possible though.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 15:03     ` Nathan Chancellor
@ 2022-04-07 16:25       ` Sedat Dilek
  2022-04-07 17:10         ` Sedat Dilek
  2022-04-07 17:14         ` Nathan Chancellor
  0 siblings, 2 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-07 16:25 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > Hi Arnaldo,
> > >
> > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Hi,
> > > >
> > > >       Trying to apply Sedat's patch something changed in my system,
> > > > and that patch wasn't enough, so I had to first apply this one:
> > > >
> > > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > > >
> > > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > > >
> > > >     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.
> > > >
> > > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > >     Cc: Fangrui Song <maskray@google.com>
> > > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > >     Cc: Ian Rogers <irogers@google.com>
> > > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > > >     Cc: John Keeping <john@metanate.com>
> > > >     Cc: Leo Yan <leo.yan@linaro.org>
> > > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > >
> > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > > --- a/tools/build/feature/Makefile
> > > > +++ b/tools/build/feature/Makefile
> > > > @@ -217,7 +217,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)
> > > >
> > > >  $(OUTPUT)test-libperl.bin:
> > > >
> > > > ----------------------------------------------------- 8< -------------------
> > > >
> > > > After this I go on filtering out some of the gcc options that clang
> > > > doesn't grok:
> > > >
> > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > > --- a/tools/build/feature/Makefile
> > > > +++ b/tools/build/feature/Makefile
> > > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > > >  strip-libs = $(filter-out -l%,$(1))
> > > >
> > > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > > >
> > > >  $(OUTPUT)test-libperl.bin:
> > > >
> > > > ----------------------------------------------------- 8< -------------------
> > > >
> > > > And then get to the problems at the end of this message, which seem
> > > > similar to the problem described here:
> > > >
> > > > From  Nathan Chancellor <>
> > > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > > >
> > > > https://lkml.org/lkml/2020/9/1/135
> > > >
> > > > So perhaps in this case its better to disable that
> > > > -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.
> > >
> >
> > Thanks for the pointer Nathan.
> >
> > As said I hit the problem with Debian's perl v5.34.
> >
> > Checking perl5 Git reveals:
> >
> > "skip using gcc brace groups for STMT_START/END"
> > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760
>
> GitHub says this is in 5.35.2, so it would make sense that 5.34 still
> shows the issue.
>
> > "Partially Revert "skip using gcc brace groups for STMT_START/END""
> > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> >
> > Perl v5.34.x seems not to have these changes:
> > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> >
> > Unsure if there exists a real fix for perl5.
>
> Perhaps those two changes could be cherry-picked into Debian's 5.34. I
> have no idea if that is possible though.
>

What perl5 version has Arch Linux?
Do you see the issue and need -Wno-compound-token-split-by-macro?

- Sedat -

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 16:25       ` Sedat Dilek
@ 2022-04-07 17:10         ` Sedat Dilek
  2022-04-07 17:42           ` Sedat Dilek
  2022-04-07 17:14         ` Nathan Chancellor
  1 sibling, 1 reply; 21+ messages in thread
From: Sedat Dilek @ 2022-04-07 17:10 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 8636 bytes --]

On Thu, Apr 7, 2022 at 6:25 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> > > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > Hi Arnaldo,
> > > >
> > > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > Hi,
> > > > >
> > > > >       Trying to apply Sedat's patch something changed in my system,
> > > > > and that patch wasn't enough, so I had to first apply this one:
> > > > >
> > > > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > > > >
> > > > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > > > >
> > > > >     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.
> > > > >
> > > > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > >     Cc: Fangrui Song <maskray@google.com>
> > > > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > >     Cc: Ian Rogers <irogers@google.com>
> > > > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > > > >     Cc: John Keeping <john@metanate.com>
> > > > >     Cc: Leo Yan <leo.yan@linaro.org>
> > > > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > > > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > > > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > > > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > >
> > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > > > --- a/tools/build/feature/Makefile
> > > > > +++ b/tools/build/feature/Makefile
> > > > > @@ -217,7 +217,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)
> > > > >
> > > > >  $(OUTPUT)test-libperl.bin:
> > > > >
> > > > > ----------------------------------------------------- 8< -------------------
> > > > >
> > > > > After this I go on filtering out some of the gcc options that clang
> > > > > doesn't grok:
> > > > >
> > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > > > --- a/tools/build/feature/Makefile
> > > > > +++ b/tools/build/feature/Makefile
> > > > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > > > >  strip-libs = $(filter-out -l%,$(1))
> > > > >
> > > > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > > > >
> > > > >  $(OUTPUT)test-libperl.bin:
> > > > >
> > > > > ----------------------------------------------------- 8< -------------------
> > > > >
> > > > > And then get to the problems at the end of this message, which seem
> > > > > similar to the problem described here:
> > > > >
> > > > > From  Nathan Chancellor <>
> > > > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > > > >
> > > > > https://lkml.org/lkml/2020/9/1/135
> > > > >
> > > > > So perhaps in this case its better to disable that
> > > > > -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.
> > > >
> > >
> > > Thanks for the pointer Nathan.
> > >
> > > As said I hit the problem with Debian's perl v5.34.
> > >
> > > Checking perl5 Git reveals:
> > >
> > > "skip using gcc brace groups for STMT_START/END"
> > > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760
> >
> > GitHub says this is in 5.35.2, so it would make sense that 5.34 still
> > shows the issue.
> >
> > > "Partially Revert "skip using gcc brace groups for STMT_START/END""
> > > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> > >
> > > Perl v5.34.x seems not to have these changes:
> > > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> > >

To summarize the diff between those 2 changes is related to perl.h only.

# git diff /usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
diff --git a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
index 17a21a1c4..bd575fe08 100644
--- a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
+++ b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
@@ -733,13 +733,8 @@ Example usage:
 Trying to select a version that gives no warnings...
*/
#if !(defined(STMT_START) && defined(STMT_END))
-# ifdef PERL_USE_GCC_BRACE_GROUPS
-#   define STMT_START  (void)( /* gcc supports "({ STATEMENTS; })" */
-#   define STMT_END    )
-# else
#   define STMT_START  do
#   define STMT_END    while (0)
-# endif
#endif

#ifndef BYTEORDER  /* Should never happen -- byteorder is in config.h */

With this applied plus removing -Wno-compound-token-split-by-macro
from ACME's patchset ...

$ git log --oneline -2
bccc88d26f1f (HEAD -> 5.17.1-6-amd64-clang14-lto) tools build: Filter
out options and warnings not supported by clang
19b1b5c6614c tools build: Use $(shell ) instead of `` to get embedded
libperl's ccopts

$ git diff tools/
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index de66e1cc0734..7e3854a07643 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -224,7 +224,6 @@ 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:
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 312a7a5906ee..913bf509bd17 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -790,9 +790,6 @@ 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

...I am able to build successfully with Debian's LLVM-14 and perl-5.34.

Both diffs are attached as Gmail might truncate the formatting.

Might be worth writing a Debian bug-report.

- Sedat -

[-- Attachment #2: debian-perl534-PERL_USE_GCC_BRACE_GROUPS.diff --]
[-- Type: text/x-patch, Size: 697 bytes --]

diff --git a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
index 17a21a1c4..bd575fe08 100644
--- a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
+++ b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
@@ -733,13 +733,8 @@ Example usage:
  Trying to select a version that gives no warnings...
 */
 #if !(defined(STMT_START) && defined(STMT_END))
-# ifdef PERL_USE_GCC_BRACE_GROUPS
-#   define STMT_START	(void)(	/* gcc supports "({ STATEMENTS; })" */
-#   define STMT_END	)
-# else
 #   define STMT_START	do
 #   define STMT_END	while (0)
-# endif
 #endif
 
 #ifndef BYTEORDER  /* Should never happen -- byteorder is in config.h */

[-- Attachment #3: tools-perl534-Wno-compound-token-split-by-macro.diff --]
[-- Type: text/x-patch, Size: 1007 bytes --]

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index de66e1cc0734..7e3854a07643 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -224,7 +224,6 @@ 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:
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 312a7a5906ee..913bf509bd17 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -790,9 +790,6 @@ 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 16:25       ` Sedat Dilek
  2022-04-07 17:10         ` Sedat Dilek
@ 2022-04-07 17:14         ` Nathan Chancellor
  2022-04-07 17:17           ` Sedat Dilek
  1 sibling, 1 reply; 21+ messages in thread
From: Nathan Chancellor @ 2022-04-07 17:14 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Thu, Apr 07, 2022 at 06:25:29PM +0200, Sedat Dilek wrote:
> On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> > > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > Hi Arnaldo,
> > > >
> > > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > Hi,
> > > > >
> > > > >       Trying to apply Sedat's patch something changed in my system,
> > > > > and that patch wasn't enough, so I had to first apply this one:
> > > > >
> > > > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > > > >
> > > > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > > > >
> > > > >     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.
> > > > >
> > > > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > >     Cc: Fangrui Song <maskray@google.com>
> > > > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > >     Cc: Ian Rogers <irogers@google.com>
> > > > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > > > >     Cc: John Keeping <john@metanate.com>
> > > > >     Cc: Leo Yan <leo.yan@linaro.org>
> > > > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > > > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > > > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > > > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > >
> > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > > > --- a/tools/build/feature/Makefile
> > > > > +++ b/tools/build/feature/Makefile
> > > > > @@ -217,7 +217,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)
> > > > >
> > > > >  $(OUTPUT)test-libperl.bin:
> > > > >
> > > > > ----------------------------------------------------- 8< -------------------
> > > > >
> > > > > After this I go on filtering out some of the gcc options that clang
> > > > > doesn't grok:
> > > > >
> > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > > > --- a/tools/build/feature/Makefile
> > > > > +++ b/tools/build/feature/Makefile
> > > > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > > > >  strip-libs = $(filter-out -l%,$(1))
> > > > >
> > > > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > > > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > > > >
> > > > >  $(OUTPUT)test-libperl.bin:
> > > > >
> > > > > ----------------------------------------------------- 8< -------------------
> > > > >
> > > > > And then get to the problems at the end of this message, which seem
> > > > > similar to the problem described here:
> > > > >
> > > > > From  Nathan Chancellor <>
> > > > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > > > >
> > > > > https://lkml.org/lkml/2020/9/1/135
> > > > >
> > > > > So perhaps in this case its better to disable that
> > > > > -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.
> > > >
> > >
> > > Thanks for the pointer Nathan.
> > >
> > > As said I hit the problem with Debian's perl v5.34.
> > >
> > > Checking perl5 Git reveals:
> > >
> > > "skip using gcc brace groups for STMT_START/END"
> > > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760
> >
> > GitHub says this is in 5.35.2, so it would make sense that 5.34 still
> > shows the issue.
> >
> > > "Partially Revert "skip using gcc brace groups for STMT_START/END""
> > > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> > >
> > > Perl v5.34.x seems not to have these changes:
> > > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> > >
> > > Unsure if there exists a real fix for perl5.
> >
> > Perhaps those two changes could be cherry-picked into Debian's 5.34. I
> > have no idea if that is possible though.
> >
> 
> What perl5 version has Arch Linux?

$ pacman -Q perl
perl 5.34.1-1

It appears that 5.35 is the development version, which I suppose means
we won't see this fix widely available for some time:

https://www.nntp.perl.org/group/perl.perl5.porters/2022/03/msg263388.html

> Do you see the issue and need -Wno-compound-token-split-by-macro?

I don't build perf but given the above information, I suspect I would
need that flag as well.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 17:14         ` Nathan Chancellor
@ 2022-04-07 17:17           ` Sedat Dilek
  0 siblings, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-07 17:17 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Thu, Apr 7, 2022 at 7:14 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, Apr 07, 2022 at 06:25:29PM +0200, Sedat Dilek wrote:
> > On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> > > > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > > > >
> > > > > Hi Arnaldo,
> > > > >
> > > > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > > Hi,
> > > > > >
> > > > > >       Trying to apply Sedat's patch something changed in my system,
> > > > > > and that patch wasn't enough, so I had to first apply this one:
> > > > > >
> > > > > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > > > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > > > > >
> > > > > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > > > > >
> > > > > >     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.
> > > > > >
> > > > > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > > >     Cc: Fangrui Song <maskray@google.com>
> > > > > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > > >     Cc: Ian Rogers <irogers@google.com>
> > > > > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > > > > >     Cc: John Keeping <john@metanate.com>
> > > > > >     Cc: Leo Yan <leo.yan@linaro.org>
> > > > > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > > > > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > > > > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > > > > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > >
> > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > > > > --- a/tools/build/feature/Makefile
> > > > > > +++ b/tools/build/feature/Makefile
> > > > > > @@ -217,7 +217,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)
> > > > > >
> > > > > >  $(OUTPUT)test-libperl.bin:
> > > > > >
> > > > > > ----------------------------------------------------- 8< -------------------
> > > > > >
> > > > > > After this I go on filtering out some of the gcc options that clang
> > > > > > doesn't grok:
> > > > > >
> > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > > > > --- a/tools/build/feature/Makefile
> > > > > > +++ b/tools/build/feature/Makefile
> > > > > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > > > > >  strip-libs = $(filter-out -l%,$(1))
> > > > > >
> > > > > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > > > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > > > > >
> > > > > >  $(OUTPUT)test-libperl.bin:
> > > > > >
> > > > > > ----------------------------------------------------- 8< -------------------
> > > > > >
> > > > > > And then get to the problems at the end of this message, which seem
> > > > > > similar to the problem described here:
> > > > > >
> > > > > > From  Nathan Chancellor <>
> > > > > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > > > > >
> > > > > > https://lkml.org/lkml/2020/9/1/135
> > > > > >
> > > > > > So perhaps in this case its better to disable that
> > > > > > -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.
> > > > >
> > > >
> > > > Thanks for the pointer Nathan.
> > > >
> > > > As said I hit the problem with Debian's perl v5.34.
> > > >
> > > > Checking perl5 Git reveals:
> > > >
> > > > "skip using gcc brace groups for STMT_START/END"
> > > > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760
> > >
> > > GitHub says this is in 5.35.2, so it would make sense that 5.34 still
> > > shows the issue.
> > >
> > > > "Partially Revert "skip using gcc brace groups for STMT_START/END""
> > > > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> > > >
> > > > Perl v5.34.x seems not to have these changes:
> > > > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> > > >
> > > > Unsure if there exists a real fix for perl5.
> > >
> > > Perhaps those two changes could be cherry-picked into Debian's 5.34. I
> > > have no idea if that is possible though.
> > >
> >
> > What perl5 version has Arch Linux?
>
> $ pacman -Q perl
> perl 5.34.1-1
>
> It appears that 5.35 is the development version, which I suppose means
> we won't see this fix widely available for some time:
>
> https://www.nntp.perl.org/group/perl.perl5.porters/2022/03/msg263388.html
>
> > Do you see the issue and need -Wno-compound-token-split-by-macro?
>
> I don't build perf but given the above information, I suspect I would
> need that flag as well.
>

Can you be so kind and apply my 2 diffs to perl.h and acme patchset
(or Git tree) and test?

- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-07 17:10         ` Sedat Dilek
@ 2022-04-07 17:42           ` Sedat Dilek
  0 siblings, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-07 17:42 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Fangrui Song,
	Florian Fainelli, Ian Rogers, Jiri Olsa, John Keeping, Leo Yan,
	Michael Petlan, Namhyung Kim, Nick Desaulniers,
	Linux Kernel Mailing List

On Thu, Apr 7, 2022 at 7:10 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Thu, Apr 7, 2022 at 6:25 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote:
> > > > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > > > >
> > > > > Hi Arnaldo,
> > > > >
> > > > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > > Hi,
> > > > > >
> > > > > >       Trying to apply Sedat's patch something changed in my system,
> > > > > > and that patch wasn't enough, so I had to first apply this one:
> > > > > >
> > > > > > commit 173b552663419f40bcd3cf9df4f68285cac72727
> > > > > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > > Date:   Mon Apr 4 17:28:48 2022 -0300
> > > > > >
> > > > > >     tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
> > > > > >
> > > > > >     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.
> > > > > >
> > > > > >     Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > > >     Cc: Fangrui Song <maskray@google.com>
> > > > > >     Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > > >     Cc: Ian Rogers <irogers@google.com>
> > > > > >     Cc: Jiri Olsa <jolsa@kernel.org>
> > > > > >     Cc: John Keeping <john@metanate.com>
> > > > > >     Cc: Leo Yan <leo.yan@linaro.org>
> > > > > >     Cc: Michael Petlan <mpetlan@redhat.com>
> > > > > >     Cc: Namhyung Kim <namhyung@kernel.org>
> > > > > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > > > > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > > >     Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > > >
> > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644
> > > > > > --- a/tools/build/feature/Makefile
> > > > > > +++ b/tools/build/feature/Makefile
> > > > > > @@ -217,7 +217,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)
> > > > > >
> > > > > >  $(OUTPUT)test-libperl.bin:
> > > > > >
> > > > > > ----------------------------------------------------- 8< -------------------
> > > > > >
> > > > > > After this I go on filtering out some of the gcc options that clang
> > > > > > doesn't grok:
> > > > > >
> > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644
> > > > > > --- a/tools/build/feature/Makefile
> > > > > > +++ b/tools/build/feature/Makefile
> > > > > > @@ -215,9 +215,12 @@ grep-libs  = $(filter -l%,$(1))
> > > > > >  strip-libs = $(filter-out -l%,$(1))
> > > > > >
> > > > > >  PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> > > > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
> > > > > >  PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
> > > > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> > > > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
> > > > > >  FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> > > > > >
> > > > > >  $(OUTPUT)test-libperl.bin:
> > > > > >
> > > > > > ----------------------------------------------------- 8< -------------------
> > > > > >
> > > > > > And then get to the problems at the end of this message, which seem
> > > > > > similar to the problem described here:
> > > > > >
> > > > > > From  Nathan Chancellor <>
> > > > > > Subject       [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
> > > > > >
> > > > > > https://lkml.org/lkml/2020/9/1/135
> > > > > >
> > > > > > So perhaps in this case its better to disable that
> > > > > > -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.
> > > > >
> > > >
> > > > Thanks for the pointer Nathan.
> > > >
> > > > As said I hit the problem with Debian's perl v5.34.
> > > >
> > > > Checking perl5 Git reveals:
> > > >
> > > > "skip using gcc brace groups for STMT_START/END"
> > > > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760
> > >
> > > GitHub says this is in 5.35.2, so it would make sense that 5.34 still
> > > shows the issue.
> > >
> > > > "Partially Revert "skip using gcc brace groups for STMT_START/END""
> > > > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c
> > > >
> > > > Perl v5.34.x seems not to have these changes:
> > > > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1
> > > >
>
> To summarize the diff between those 2 changes is related to perl.h only.
>
> # git diff /usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
> /usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
> diff --git a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
> b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
> index 17a21a1c4..bd575fe08 100644
> --- a/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h.orig
> +++ b/usr/lib/x86_64-linux-gnu/perl/5.34.0/CORE/perl.h
> @@ -733,13 +733,8 @@ Example usage:
>  Trying to select a version that gives no warnings...
> */
> #if !(defined(STMT_START) && defined(STMT_END))
> -# ifdef PERL_USE_GCC_BRACE_GROUPS
> -#   define STMT_START  (void)( /* gcc supports "({ STATEMENTS; })" */
> -#   define STMT_END    )
> -# else
> #   define STMT_START  do
> #   define STMT_END    while (0)
> -# endif
> #endif
>
> #ifndef BYTEORDER  /* Should never happen -- byteorder is in config.h */
>
> With this applied plus removing -Wno-compound-token-split-by-macro
> from ACME's patchset ...
>
> $ git log --oneline -2
> bccc88d26f1f (HEAD -> 5.17.1-6-amd64-clang14-lto) tools build: Filter
> out options and warnings not supported by clang
> 19b1b5c6614c tools build: Use $(shell ) instead of `` to get embedded
> libperl's ccopts
>
> $ git diff tools/
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index de66e1cc0734..7e3854a07643 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -224,7 +224,6 @@ 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:
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 312a7a5906ee..913bf509bd17 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -790,9 +790,6 @@ 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
>
> ...I am able to build successfully with Debian's LLVM-14 and perl-5.34.
>
> Both diffs are attached as Gmail might truncate the formatting.
>
> Might be worth writing a Debian bug-report.
>

Here we go:

libperl5.34: Upstream patches "skip using gcc brace groups for STMT_START/END"

- sed@ -

[1] https://bugs.debian.org/1009149

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-05 21:44         ` Arnaldo Carvalho de Melo
  2022-04-06 20:44           ` Sedat Dilek
@ 2022-04-08 14:49           ` Arnaldo Carvalho de Melo
  2022-04-08 15:30             ` Sedat Dilek
  1 sibling, 1 reply; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-08 14:49 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

Em Tue, Apr 05, 2022 at 06:44:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > So, we should include scripts/Makefile.clang or enhance
> > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > can be overridden).
> > 
> > > Jiri pointed out he needed two options (when I recall correctly):
> > > 
> > > [1] -Wno-unused-command-line-argument
> 
> I didn't see this one so far, but this one, and for the python case,
> appears on clang 13 on:
> 
>   22    45.02 archlinux:base                : FAIL clang version 13.0.1
> 
>   CC      /tmp/build/perf/arch/x86/util/pmu.o
> clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> error: command '/usr/sbin/clang' failed with exit code 1
>   MKDIR   /tmp/build/perf/ui/stdio/
> cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
>   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> make[2]: *** Waiting for unfinished jobs....

So this one is more involved, see the two patches below, the first fixes
the clang command option probing mechanism used and the second filters
out -ffat-lto-objects.

Its all in my tmp.perf/urgent branch at
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git.

The full test suite is still running, but so far the failures are
unrelated to the problems in this thread:

[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.18.0-rc1.tar.xz
[perfbuilder@five ~]$ time dm
   1   115.87 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
   2    74.26 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
   3    67.82 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
   4    71.32 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
   5    77.05 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
   6    76.76 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
   7    79.36 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
   8   111.26 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
   9   118.37 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
  10   124.39 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
  11   135.45 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1 
  12   129.24 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
  13   124.49 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
  14   115.27 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
  15    62.59 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
  16    90.90 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0 
  17    89.19 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
  18    90.50 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
  19    64.00 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
  20   100.13 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
  21   116.67 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
  22   105.61 archlinux:base                : Ok   gcc (GCC) 11.2.0 , clang version 13.0.1
  23    98.90 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
  24   112.45 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
  25    51.53 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220330 releases/gcc-11.2.0-949-g511e8b6122 , clang version 13.0.0
  26    79.15 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
  27    84.48 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
  28    98.81 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
  29   115.79 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
  30    24.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  31    20.25 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  32    22.06 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110 
  33    22.76 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0 
  34    22.55 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
  35    68.41 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
  36    80.65 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
  37    18.13 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 
  38    81.54 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
  39    95.09 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
  40    97.18 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
  41   109.33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
  42   115.85 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
  43   118.65 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
  44   111.13 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
  45   105.95 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
  46   104.95 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
  47   112.06 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
  48    20.44 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 
  49    18.44 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 
  50   113.69 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
  51    30.08 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) 
      + make PYTHON=python3 ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBTRACEEVENT_DYNAMIC=1 -C tools/perf O=/tmp/build/perf
    make: Entering directory '/git/perf-5.18.0-rc1/tools/perf'
      BUILD:   Doing 'make -j32' parallel build
    Makefile.config:728: No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev
    Makefile.config:1011: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
    Makefile.config:1118: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
    make[1]: *** [Makefile.perf:240: sub-make] Error 2
   
  52   126.52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc37)
  53    96.02 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
  54    82.86 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
  55    43.11 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
          yychar = yylex (&yylval, &yylloc, scanner);
                   ^
    #define yylex           parse_events_lex
                            ^
    1 error generated.
    make[3]: *** [/git/perf-5.18.0-rc1/tools/build/Makefile.build:139: util] Error 2
  56   107.45 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
  57     6.58 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
    In file included from builtin-bench.c:22:
    bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
       66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from bench/bench.h:64,
                     from builtin-bench.c:22:
    /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
      394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
  58     6.48 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC) 
    In file included from builtin-bench.c:22:
    bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
       66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from bench/bench.h:64,
                     from builtin-bench.c:22:
    /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
      394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
    ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
    ld: warning: -r and --icf may not be used together, disabling --icf
  59   118.04 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
  60   127.98 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
  61   122.86 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1 
  62   133.70 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
  63   133.30 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
  64   158.92 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
  65   114.77 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
  66: rockylinux:8

- Arnaldo

From 73fb827d72906bd2d78c6ca091b0c74f90183a95 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Fri, 8 Apr 2022 10:08:07 -0300
Subject: [PATCH 1/2] perf python: Fix probing for some clang command line
 options

The clang compiler complains about some options even without a source
file being available, while others require one, so use the simple
tools/build/feature/test-hello.c file.

Then check for the "is not supported" string in its output, in addition
to the "unknown argument" already being looked for.

This was noticed when building with clang-13 where -ffat-lto-objects
isn't supported and since we were looking just for "unknown argument"
and not providing a source code to clang, was mistakenly assumed as
being available and not being filtered to set of command line options
provided to clang, leading to a build failure.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Link: http://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/setup.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 483f05004e682081..6156bb87ee3e34cf 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -1,12 +1,14 @@
-from os import getenv
+from os import getenv, path
 from subprocess import Popen, PIPE
 from re import sub
 
 cc = getenv("CC")
 cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline()
+src_feature_tests  = getenv('srctree') + '/tools/build/feature'
 
 def clang_has_option(option):
-    return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
+    cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
+    return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
 
 if cc_is_clang:
     from distutils.sysconfig import get_config_vars
-- 
2.35.1

From e807abf709ee26af99588bd13e725fb45011b167 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Thu, 7 Apr 2022 11:04:20 -0300
Subject: [PATCH 2/2] perf build: Don't use -ffat-lto-objects in the python
 feature test when building with clang-13

Using -ffat-lto-objects in the python feature test when building with
clang-13 results in:

  clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
  error: command '/usr/sbin/clang' failed with exit code 1
  cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
  make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1

Noticed when building on a docker.io/library/archlinux:base container.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.config | 3 +++
 tools/perf/util/setup.py   | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 5b5ba475a5c00c0f..f3bf9297bcc03c5e 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
   PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
   PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
   FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+  ifeq ($(CC_NO_CLANG), 0)
+    PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
+  endif
 endif
 
 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 6156bb87ee3e34cf..c255a2c90cd672b1 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -25,6 +25,8 @@ if cc_is_clang:
             vars[var] = sub("-fstack-protector-strong", "", vars[var])
         if not clang_has_option("-fno-semantic-interposition"):
             vars[var] = sub("-fno-semantic-interposition", "", vars[var])
+        if not clang_has_option("-ffat-lto-objects"):
+            vars[var] = sub("-ffat-lto-objects", "", vars[var])
 
 from distutils.core import setup, Extension
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-08 14:49           ` Arnaldo Carvalho de Melo
@ 2022-04-08 15:30             ` Sedat Dilek
  2022-04-09  5:13               ` Sedat Dilek
  2022-04-11  6:38               ` Sedat Dilek
  0 siblings, 2 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-08 15:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 21341 bytes --]

On Fri, Apr 8, 2022 at 4:49 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Tue, Apr 05, 2022 at 06:44:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > > So, we should include scripts/Makefile.clang or enhance
> > > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > > can be overridden).
> > >
> > > > Jiri pointed out he needed two options (when I recall correctly):
> > > >
> > > > [1] -Wno-unused-command-line-argument
> >
> > I didn't see this one so far, but this one, and for the python case,
> > appears on clang 13 on:
> >
> >   22    45.02 archlinux:base                : FAIL clang version 13.0.1
> >
> >   CC      /tmp/build/perf/arch/x86/util/pmu.o
> > clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > error: command '/usr/sbin/clang' failed with exit code 1
> >   MKDIR   /tmp/build/perf/ui/stdio/
> > cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> >   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> > make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > make[2]: *** Waiting for unfinished jobs....
>
> So this one is more involved, see the two patches below, the first fixes
> the clang command option probing mechanism used and the second filters
> out -ffat-lto-objects.
>
> Its all in my tmp.perf/urgent branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git.
>
> The full test suite is still running, but so far the failures are
> unrelated to the problems in this thread:
>
> [perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.18.0-rc1.tar.xz
> [perfbuilder@five ~]$ time dm
>    1   115.87 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
>    2    74.26 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
>    3    67.82 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
>    4    71.32 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
>    5    77.05 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
>    6    76.76 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
>    7    79.36 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
>    8   111.26 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
>    9   118.37 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
>   10   124.39 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
>   11   135.45 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
>   12   129.24 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
>   13   124.49 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
>   14   115.27 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
>   15    62.59 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
>   16    90.90 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
>   17    89.19 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
>   18    90.50 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
>   19    64.00 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
>   20   100.13 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
>   21   116.67 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
>   22   105.61 archlinux:base                : Ok   gcc (GCC) 11.2.0 , clang version 13.0.1
>   23    98.90 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
>   24   112.45 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
>   25    51.53 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220330 releases/gcc-11.2.0-949-g511e8b6122 , clang version 13.0.0
>   26    79.15 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
>   27    84.48 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
>   28    98.81 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
>   29   115.79 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
>   30    24.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   31    20.25 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   32    22.06 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
>   33    22.76 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
>   34    22.55 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
>   35    68.41 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
>   36    80.65 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
>   37    18.13 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
>   38    81.54 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
>   39    95.09 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
>   40    97.18 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
>   41   109.33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
>   42   115.85 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
>   43   118.65 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
>   44   111.13 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
>   45   105.95 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>   46   104.95 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
>   47   112.06 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
>   48    20.44 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
>   49    18.44 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
>   50   113.69 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
>   51    30.08 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
>       + make PYTHON=python3 ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBTRACEEVENT_DYNAMIC=1 -C tools/perf O=/tmp/build/perf
>     make: Entering directory '/git/perf-5.18.0-rc1/tools/perf'
>       BUILD:   Doing 'make -j32' parallel build
>     Makefile.config:728: No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev
>     Makefile.config:1011: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
>     Makefile.config:1118: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
>     make[1]: *** [Makefile.perf:240: sub-make] Error 2
>
>   52   126.52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc37)
>   53    96.02 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
>   54    82.86 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
>   55    43.11 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
>           yychar = yylex (&yylval, &yylloc, scanner);
>                    ^
>     #define yylex           parse_events_lex
>                             ^
>     1 error generated.
>     make[3]: *** [/git/perf-5.18.0-rc1/tools/build/Makefile.build:139: util] Error 2
>   56   107.45 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
>   57     6.58 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
>     In file included from builtin-bench.c:22:
>     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
>        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
>           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from bench/bench.h:64,
>                      from builtin-bench.c:22:
>     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
>       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>   58     6.48 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
>     In file included from builtin-bench.c:22:
>     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
>        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
>           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from bench/bench.h:64,
>                      from builtin-bench.c:22:
>     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
>       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
>     ld: warning: -r and --icf may not be used together, disabling --icf
>   59   118.04 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
>   60   127.98 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
>   61   122.86 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
>   62   133.70 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   63   133.30 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
>   64   158.92 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
>   65   114.77 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
>   66: rockylinux:8
>
> - Arnaldo
>
> From 73fb827d72906bd2d78c6ca091b0c74f90183a95 Mon Sep 17 00:00:00 2001
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date: Fri, 8 Apr 2022 10:08:07 -0300
> Subject: [PATCH 1/2] perf python: Fix probing for some clang command line
>  options
>
> The clang compiler complains about some options even without a source
> file being available, while others require one, so use the simple
> tools/build/feature/test-hello.c file.
>
> Then check for the "is not supported" string in its output, in addition
> to the "unknown argument" already being looked for.
>
> This was noticed when building with clang-13 where -ffat-lto-objects
> isn't supported and since we were looking just for "unknown argument"
> and not providing a source code to clang, was mistakenly assumed as
> being available and not being filtered to set of command line options
> provided to clang, leading to a build failure.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Fangrui Song <maskray@google.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: John Keeping <john@metanate.com>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Michael Petlan <mpetlan@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Sedat Dilek <sedat.dilek@gmail.com>
> Link: http://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/util/setup.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> index 483f05004e682081..6156bb87ee3e34cf 100644
> --- a/tools/perf/util/setup.py
> +++ b/tools/perf/util/setup.py
> @@ -1,12 +1,14 @@
> -from os import getenv
> +from os import getenv, path
>  from subprocess import Popen, PIPE
>  from re import sub
>
>  cc = getenv("CC")
>  cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline()
> +src_feature_tests  = getenv('srctree') + '/tools/build/feature'
>
>  def clang_has_option(option):
> -    return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
> +    cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> +    return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
>
>  if cc_is_clang:
>      from distutils.sysconfig import get_config_vars
> --
> 2.35.1
>
> From e807abf709ee26af99588bd13e725fb45011b167 Mon Sep 17 00:00:00 2001
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date: Thu, 7 Apr 2022 11:04:20 -0300
> Subject: [PATCH 2/2] perf build: Don't use -ffat-lto-objects in the python
>  feature test when building with clang-13
>
> Using -ffat-lto-objects in the python feature test when building with
> clang-13 results in:
>
>   clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
>   error: command '/usr/sbin/clang' failed with exit code 1
>   cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
>   make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
>
> Noticed when building on a docker.io/library/archlinux:base container.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Fangrui Song <maskray@google.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: John Keeping <john@metanate.com>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Michael Petlan <mpetlan@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/Makefile.config | 3 +++
>  tools/perf/util/setup.py   | 2 ++
>  2 files changed, 5 insertions(+)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 5b5ba475a5c00c0f..f3bf9297bcc03c5e 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
>    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
>    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
>    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> +  ifeq ($(CC_NO_CLANG), 0)
> +    PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
> +  endif
>  endif
>
>  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
> diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> index 6156bb87ee3e34cf..c255a2c90cd672b1 100644
> --- a/tools/perf/util/setup.py
> +++ b/tools/perf/util/setup.py
> @@ -25,6 +25,8 @@ if cc_is_clang:
>              vars[var] = sub("-fstack-protector-strong", "", vars[var])
>          if not clang_has_option("-fno-semantic-interposition"):
>              vars[var] = sub("-fno-semantic-interposition", "", vars[var])
> +        if not clang_has_option("-ffat-lto-objects"):
> +            vars[var] = sub("-ffat-lto-objects", "", vars[var])
>
>  from distutils.core import setup, Extension
>
> --
> 2.35.1
>

Thanks for the followup patches.

I have tested with the last 4 commits from [1].

[ INSTRUCTIONS ]

1103  2022-04-08 17:14:40 LLVM_MVER="14"
1104  2022-04-08 17:14:40 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
1105  2022-04-08 17:14:40 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
1106  2022-04-08 17:14:40 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
1107  2022-04-08 17:14:40 echo $PATH
1108  2022-04-08 17:14:40 PYTHON_VER="3.10"
1109  2022-04-08 17:14:40 MAKE="make"
1110  2022-04-08 17:14:40 MAKE_OPTS="V=1 -j4 HOSTCC=clang
HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
STRIP=llvm-strip"
1111  2022-04-08 17:14:40 echo $PYTHON_VER $MAKE $MAKE_OPTS

3.10 make V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang
LD=ld.lld AR=llvm-ar STRIP=llvm-strip

1112  2022-04-08 17:14:50 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
clean 2>&1 | tee ../make-log_perf-clean.txt
1113  2022-04-08 17:15:43 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt

Please feel free to add my...

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v14 (x86-64)

My perf build-log is attached.

- sed@ -

P.S.: I requested to bump perl to version 5.34.1 (see [2]) plus diff from [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent
[2] https://bugs.debian.org/1009170
[3] https://bugs.debian.org/1009149

[-- Attachment #2: make-log_perf-python3.10-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt.zst --]
[-- Type: application/octet-stream, Size: 14842 bytes --]

[-- Attachment #3: make-log_perf-python3.10-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt.zst.sha256 --]
[-- Type: application/octet-stream, Size: 151 bytes --]

ac9a80b6089662e8ef814779220043217c73c2db71f58baa185d129bdaefc7b5  make-log_perf-python3.10-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt.zst

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-08 15:30             ` Sedat Dilek
@ 2022-04-09  5:13               ` Sedat Dilek
  2022-04-11  6:38               ` Sedat Dilek
  1 sibling, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-09  5:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

> P.S.: I requested to bump perl to version 5.34.1 (see [2]) plus diff from [3].
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent
> [2] https://bugs.debian.org/1009170
> [3] https://bugs.debian.org/1009149

OK, new perl package shipping the fix.

perl (5.34.0-4) unstable; urgency=medium

 * Refresh cross build support files for all architectures.
 * Fix massively parallel builds by first making 'depend'.
   (Closes: #996953)
 * Backport upstream patch to perl.h fixing build warnings on clang.
   (Closes: #1009149)

-- Niko Tyni <ntyni@debian.org>  Fri, 08 Apr 2022 20:12:38 +0300

- Sedat -

- Sedat -

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-08 15:30             ` Sedat Dilek
  2022-04-09  5:13               ` Sedat Dilek
@ 2022-04-11  6:38               ` Sedat Dilek
  2022-04-11 11:58                 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 21+ messages in thread
From: Sedat Dilek @ 2022-04-11  6:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Sasha Levin, Greg Kroah-Hartman
  Cc: Nathan Chancellor, Adrian Hunter, Fangrui Song, Florian Fainelli,
	Ian Rogers, Jiri Olsa, John Keeping, Leo Yan, Michael Petlan,
	Namhyung Kim, Nick Desaulniers, Linux Kernel Mailing List

On Fri, Apr 8, 2022 at 5:30 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Fri, Apr 8, 2022 at 4:49 PM Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> >
> > Em Tue, Apr 05, 2022 at 06:44:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > > > So, we should include scripts/Makefile.clang or enhance
> > > > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > > > can be overridden).
> > > >
> > > > > Jiri pointed out he needed two options (when I recall correctly):
> > > > >
> > > > > [1] -Wno-unused-command-line-argument
> > >
> > > I didn't see this one so far, but this one, and for the python case,
> > > appears on clang 13 on:
> > >
> > >   22    45.02 archlinux:base                : FAIL clang version 13.0.1
> > >
> > >   CC      /tmp/build/perf/arch/x86/util/pmu.o
> > > clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > > error: command '/usr/sbin/clang' failed with exit code 1
> > >   MKDIR   /tmp/build/perf/ui/stdio/
> > > cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> > >   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> > > make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > > make[2]: *** Waiting for unfinished jobs....
> >
> > So this one is more involved, see the two patches below, the first fixes
> > the clang command option probing mechanism used and the second filters
> > out -ffat-lto-objects.
> >
> > Its all in my tmp.perf/urgent branch at
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git.
> >
> > The full test suite is still running, but so far the failures are
> > unrelated to the problems in this thread:
> >
> > [perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.18.0-rc1.tar.xz
> > [perfbuilder@five ~]$ time dm
> >    1   115.87 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
> >    2    74.26 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
> >    3    67.82 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
> >    4    71.32 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
> >    5    77.05 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
> >    6    76.76 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
> >    7    79.36 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
> >    8   111.26 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
> >    9   118.37 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
> >   10   124.39 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
> >   11   135.45 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
> >   12   129.24 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
> >   13   124.49 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
> >   14   115.27 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
> >   15    62.59 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
> >   16    90.90 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
> >   17    89.19 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
> >   18    90.50 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
> >   19    64.00 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
> >   20   100.13 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
> >   21   116.67 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
> >   22   105.61 archlinux:base                : Ok   gcc (GCC) 11.2.0 , clang version 13.0.1
> >   23    98.90 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
> >   24   112.45 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
> >   25    51.53 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220330 releases/gcc-11.2.0-949-g511e8b6122 , clang version 13.0.0
> >   26    79.15 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
> >   27    84.48 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
> >   28    98.81 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
> >   29   115.79 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
> >   30    24.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   31    20.25 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   32    22.06 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
> >   33    22.76 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> >   34    22.55 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
> >   35    68.41 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
> >   36    80.65 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
> >   37    18.13 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
> >   38    81.54 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
> >   39    95.09 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
> >   40    97.18 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
> >   41   109.33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
> >   42   115.85 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
> >   43   118.65 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
> >   44   111.13 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
> >   45   105.95 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> >   46   104.95 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
> >   47   112.06 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
> >   48    20.44 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
> >   49    18.44 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
> >   50   113.69 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
> >   51    30.08 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
> >       + make PYTHON=python3 ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBTRACEEVENT_DYNAMIC=1 -C tools/perf O=/tmp/build/perf
> >     make: Entering directory '/git/perf-5.18.0-rc1/tools/perf'
> >       BUILD:   Doing 'make -j32' parallel build
> >     Makefile.config:728: No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev
> >     Makefile.config:1011: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
> >     Makefile.config:1118: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
> >     make[1]: *** [Makefile.perf:240: sub-make] Error 2
> >
> >   52   126.52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> >   53    96.02 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
> >   54    82.86 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
> >   55    43.11 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
> >           yychar = yylex (&yylval, &yylloc, scanner);
> >                    ^
> >     #define yylex           parse_events_lex
> >                             ^
> >     1 error generated.
> >     make[3]: *** [/git/perf-5.18.0-rc1/tools/build/Makefile.build:139: util] Error 2
> >   56   107.45 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
> >   57     6.58 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> >     In file included from builtin-bench.c:22:
> >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >     In file included from bench/bench.h:64,
> >                      from builtin-bench.c:22:
> >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >   58     6.48 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> >     In file included from builtin-bench.c:22:
> >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >     In file included from bench/bench.h:64,
> >                      from builtin-bench.c:22:
> >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> >     ld: warning: -r and --icf may not be used together, disabling --icf
> >   59   118.04 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
> >   60   127.98 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
> >   61   122.86 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
> >   62   133.70 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> >   63   133.30 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> >   64   158.92 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
> >   65   114.77 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
> >   66: rockylinux:8
> >
> > - Arnaldo
> >
> > From 73fb827d72906bd2d78c6ca091b0c74f90183a95 Mon Sep 17 00:00:00 2001
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Date: Fri, 8 Apr 2022 10:08:07 -0300
> > Subject: [PATCH 1/2] perf python: Fix probing for some clang command line
> >  options
> >
> > The clang compiler complains about some options even without a source
> > file being available, while others require one, so use the simple
> > tools/build/feature/test-hello.c file.
> >
> > Then check for the "is not supported" string in its output, in addition
> > to the "unknown argument" already being looked for.
> >
> > This was noticed when building with clang-13 where -ffat-lto-objects
> > isn't supported and since we were looking just for "unknown argument"
> > and not providing a source code to clang, was mistakenly assumed as
> > being available and not being filtered to set of command line options
> > provided to clang, leading to a build failure.
> >
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Fangrui Song <maskray@google.com>
> > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: John Keeping <john@metanate.com>
> > Cc: Leo Yan <leo.yan@linaro.org>
> > Cc: Michael Petlan <mpetlan@redhat.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Nathan Chancellor <nathan@kernel.org>
> > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > Link: http://lore.kernel.org/lkml/
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >  tools/perf/util/setup.py | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > index 483f05004e682081..6156bb87ee3e34cf 100644
> > --- a/tools/perf/util/setup.py
> > +++ b/tools/perf/util/setup.py
> > @@ -1,12 +1,14 @@
> > -from os import getenv
> > +from os import getenv, path
> >  from subprocess import Popen, PIPE
> >  from re import sub
> >
> >  cc = getenv("CC")
> >  cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline()
> > +src_feature_tests  = getenv('srctree') + '/tools/build/feature'
> >
> >  def clang_has_option(option):
> > -    return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
> > +    cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> > +    return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
> >
> >  if cc_is_clang:
> >      from distutils.sysconfig import get_config_vars
> > --
> > 2.35.1
> >
> > From e807abf709ee26af99588bd13e725fb45011b167 Mon Sep 17 00:00:00 2001
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Date: Thu, 7 Apr 2022 11:04:20 -0300
> > Subject: [PATCH 2/2] perf build: Don't use -ffat-lto-objects in the python
> >  feature test when building with clang-13
> >
> > Using -ffat-lto-objects in the python feature test when building with
> > clang-13 results in:
> >
> >   clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> >   error: command '/usr/sbin/clang' failed with exit code 1
> >   cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> >   make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> >
> > Noticed when building on a docker.io/library/archlinux:base container.
> >
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Fangrui Song <maskray@google.com>
> > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: John Keeping <john@metanate.com>
> > Cc: Leo Yan <leo.yan@linaro.org>
> > Cc: Michael Petlan <mpetlan@redhat.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Nathan Chancellor <nathan@kernel.org>
> > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >  tools/perf/Makefile.config | 3 +++
> >  tools/perf/util/setup.py   | 2 ++
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 5b5ba475a5c00c0f..f3bf9297bcc03c5e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
> >    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
> >    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
> >    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> > +  ifeq ($(CC_NO_CLANG), 0)
> > +    PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
> > +  endif
> >  endif
> >
> >  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
> > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > index 6156bb87ee3e34cf..c255a2c90cd672b1 100644
> > --- a/tools/perf/util/setup.py
> > +++ b/tools/perf/util/setup.py
> > @@ -25,6 +25,8 @@ if cc_is_clang:
> >              vars[var] = sub("-fstack-protector-strong", "", vars[var])
> >          if not clang_has_option("-fno-semantic-interposition"):
> >              vars[var] = sub("-fno-semantic-interposition", "", vars[var])
> > +        if not clang_has_option("-ffat-lto-objects"):
> > +            vars[var] = sub("-ffat-lto-objects", "", vars[var])
> >
> >  from distutils.core import setup, Extension
> >
> > --
> > 2.35.1
> >
>
> Thanks for the followup patches.
>
> I have tested with the last 4 commits from [1].
>
> [ INSTRUCTIONS ]
>
> 1103  2022-04-08 17:14:40 LLVM_MVER="14"
> 1104  2022-04-08 17:14:40 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
> 1105  2022-04-08 17:14:40 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
> 1106  2022-04-08 17:14:40 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
> export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
> 1107  2022-04-08 17:14:40 echo $PATH
> 1108  2022-04-08 17:14:40 PYTHON_VER="3.10"
> 1109  2022-04-08 17:14:40 MAKE="make"
> 1110  2022-04-08 17:14:40 MAKE_OPTS="V=1 -j4 HOSTCC=clang
> HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
> STRIP=llvm-strip"
> 1111  2022-04-08 17:14:40 echo $PYTHON_VER $MAKE $MAKE_OPTS
>
> 3.10 make V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang
> LD=ld.lld AR=llvm-ar STRIP=llvm-strip
>
> 1112  2022-04-08 17:14:50 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> clean 2>&1 | tee ../make-log_perf-clean.txt
> 1113  2022-04-08 17:15:43 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
> ../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt
>
> Please feel free to add my...
>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v14 (x86-64)
>
> My perf build-log is attached.
>
> - sed@ -
>
> P.S.: I requested to bump perl to version 5.34.1 (see [2]) plus diff from [3].
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent
> [2] https://bugs.debian.org/1009170
> [3] https://bugs.debian.org/1009149

[ To: GregKH and Sasha L. ]

I have seen the linux-stable team is taking perf patches for queue-5.17.

I have reported build problems with perf + clang + libperl (perl v5.34).
My original report was against Linux v5.17-rc6 (see [1]).

So, I would like to see at least the 4 commits I have tested with to
be in Linux v5.17.y.
They are now in upstream means Linux v5.18-rc2.

Here are the upstream commit-ids:

3a8a0475861a perf build: Don't use -ffat-lto-objects in the python
feature test when building with clang-13
dd6e1fe91cdd perf python: Fix probing for some clang command line options
41caff459a5b tools build: Filter out options and warnings not supported by clang
541f695cbcb6 tools build: Use $(shell ) instead of `` to get embedded
libperl's ccopts

@Arnaldo: If you agree, the linux-stable team should include them in
the next Linux v5.17.y series.
( I can NOT speak for other linux-stable releases. )

Thanks.

- sed@ -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=queue/5.17
[2] https://marc.info/?t=164646683300002&r=1&w=2

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-11  6:38               ` Sedat Dilek
@ 2022-04-11 11:58                 ` Greg Kroah-Hartman
  2022-04-12 18:33                   ` Sedat Dilek
  0 siblings, 1 reply; 21+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-11 11:58 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Arnaldo Carvalho de Melo, Sasha Levin, Nathan Chancellor,
	Adrian Hunter, Fangrui Song, Florian Fainelli, Ian Rogers,
	Jiri Olsa, John Keeping, Leo Yan, Michael Petlan, Namhyung Kim,
	Nick Desaulniers, Linux Kernel Mailing List

On Mon, Apr 11, 2022 at 08:38:37AM +0200, Sedat Dilek wrote:
> On Fri, Apr 8, 2022 at 5:30 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > On Fri, Apr 8, 2022 at 4:49 PM Arnaldo Carvalho de Melo
> > <arnaldo.melo@gmail.com> wrote:
> > >
> > > Em Tue, Apr 05, 2022 at 06:44:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > > > > So, we should include scripts/Makefile.clang or enhance
> > > > > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > > > > can be overridden).
> > > > >
> > > > > > Jiri pointed out he needed two options (when I recall correctly):
> > > > > >
> > > > > > [1] -Wno-unused-command-line-argument
> > > >
> > > > I didn't see this one so far, but this one, and for the python case,
> > > > appears on clang 13 on:
> > > >
> > > >   22    45.02 archlinux:base                : FAIL clang version 13.0.1
> > > >
> > > >   CC      /tmp/build/perf/arch/x86/util/pmu.o
> > > > clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > > > error: command '/usr/sbin/clang' failed with exit code 1
> > > >   MKDIR   /tmp/build/perf/ui/stdio/
> > > > cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> > > >   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> > > > make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > > > make[2]: *** Waiting for unfinished jobs....
> > >
> > > So this one is more involved, see the two patches below, the first fixes
> > > the clang command option probing mechanism used and the second filters
> > > out -ffat-lto-objects.
> > >
> > > Its all in my tmp.perf/urgent branch at
> > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git.
> > >
> > > The full test suite is still running, but so far the failures are
> > > unrelated to the problems in this thread:
> > >
> > > [perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.18.0-rc1.tar.xz
> > > [perfbuilder@five ~]$ time dm
> > >    1   115.87 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
> > >    2    74.26 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
> > >    3    67.82 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
> > >    4    71.32 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
> > >    5    77.05 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
> > >    6    76.76 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
> > >    7    79.36 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
> > >    8   111.26 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
> > >    9   118.37 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
> > >   10   124.39 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
> > >   11   135.45 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
> > >   12   129.24 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
> > >   13   124.49 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
> > >   14   115.27 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
> > >   15    62.59 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
> > >   16    90.90 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
> > >   17    89.19 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
> > >   18    90.50 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
> > >   19    64.00 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
> > >   20   100.13 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
> > >   21   116.67 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
> > >   22   105.61 archlinux:base                : Ok   gcc (GCC) 11.2.0 , clang version 13.0.1
> > >   23    98.90 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
> > >   24   112.45 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
> > >   25    51.53 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220330 releases/gcc-11.2.0-949-g511e8b6122 , clang version 13.0.0
> > >   26    79.15 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
> > >   27    84.48 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
> > >   28    98.81 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
> > >   29   115.79 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
> > >   30    24.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > >   31    20.25 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > >   32    22.06 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
> > >   33    22.76 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > >   34    22.55 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
> > >   35    68.41 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
> > >   36    80.65 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
> > >   37    18.13 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
> > >   38    81.54 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
> > >   39    95.09 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
> > >   40    97.18 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
> > >   41   109.33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
> > >   42   115.85 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
> > >   43   118.65 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
> > >   44   111.13 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
> > >   45   105.95 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> > >   46   104.95 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
> > >   47   112.06 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
> > >   48    20.44 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
> > >   49    18.44 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
> > >   50   113.69 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
> > >   51    30.08 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
> > >       + make PYTHON=python3 ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBTRACEEVENT_DYNAMIC=1 -C tools/perf O=/tmp/build/perf
> > >     make: Entering directory '/git/perf-5.18.0-rc1/tools/perf'
> > >       BUILD:   Doing 'make -j32' parallel build
> > >     Makefile.config:728: No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev
> > >     Makefile.config:1011: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
> > >     Makefile.config:1118: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
> > >     make[1]: *** [Makefile.perf:240: sub-make] Error 2
> > >
> > >   52   126.52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> > >   53    96.02 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
> > >   54    82.86 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
> > >   55    43.11 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
> > >           yychar = yylex (&yylval, &yylloc, scanner);
> > >                    ^
> > >     #define yylex           parse_events_lex
> > >                             ^
> > >     1 error generated.
> > >     make[3]: *** [/git/perf-5.18.0-rc1/tools/build/Makefile.build:139: util] Error 2
> > >   56   107.45 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
> > >   57     6.58 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> > >     In file included from builtin-bench.c:22:
> > >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> > >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> > >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >     In file included from bench/bench.h:64,
> > >                      from builtin-bench.c:22:
> > >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> > >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >   58     6.48 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> > >     In file included from builtin-bench.c:22:
> > >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> > >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> > >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >     In file included from bench/bench.h:64,
> > >                      from builtin-bench.c:22:
> > >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> > >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > >   59   118.04 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
> > >   60   127.98 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
> > >   61   122.86 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
> > >   62   133.70 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> > >   63   133.30 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> > >   64   158.92 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
> > >   65   114.77 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
> > >   66: rockylinux:8
> > >
> > > - Arnaldo
> > >
> > > From 73fb827d72906bd2d78c6ca091b0c74f90183a95 Mon Sep 17 00:00:00 2001
> > > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Date: Fri, 8 Apr 2022 10:08:07 -0300
> > > Subject: [PATCH 1/2] perf python: Fix probing for some clang command line
> > >  options
> > >
> > > The clang compiler complains about some options even without a source
> > > file being available, while others require one, so use the simple
> > > tools/build/feature/test-hello.c file.
> > >
> > > Then check for the "is not supported" string in its output, in addition
> > > to the "unknown argument" already being looked for.
> > >
> > > This was noticed when building with clang-13 where -ffat-lto-objects
> > > isn't supported and since we were looking just for "unknown argument"
> > > and not providing a source code to clang, was mistakenly assumed as
> > > being available and not being filtered to set of command line options
> > > provided to clang, leading to a build failure.
> > >
> > > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > Cc: Fangrui Song <maskray@google.com>
> > > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > Cc: Ian Rogers <irogers@google.com>
> > > Cc: Jiri Olsa <jolsa@kernel.org>
> > > Cc: John Keeping <john@metanate.com>
> > > Cc: Leo Yan <leo.yan@linaro.org>
> > > Cc: Michael Petlan <mpetlan@redhat.com>
> > > Cc: Namhyung Kim <namhyung@kernel.org>
> > > Cc: Nathan Chancellor <nathan@kernel.org>
> > > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > Link: http://lore.kernel.org/lkml/
> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > ---
> > >  tools/perf/util/setup.py | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > > index 483f05004e682081..6156bb87ee3e34cf 100644
> > > --- a/tools/perf/util/setup.py
> > > +++ b/tools/perf/util/setup.py
> > > @@ -1,12 +1,14 @@
> > > -from os import getenv
> > > +from os import getenv, path
> > >  from subprocess import Popen, PIPE
> > >  from re import sub
> > >
> > >  cc = getenv("CC")
> > >  cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline()
> > > +src_feature_tests  = getenv('srctree') + '/tools/build/feature'
> > >
> > >  def clang_has_option(option):
> > > -    return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
> > > +    cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> > > +    return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
> > >
> > >  if cc_is_clang:
> > >      from distutils.sysconfig import get_config_vars
> > > --
> > > 2.35.1
> > >
> > > From e807abf709ee26af99588bd13e725fb45011b167 Mon Sep 17 00:00:00 2001
> > > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Date: Thu, 7 Apr 2022 11:04:20 -0300
> > > Subject: [PATCH 2/2] perf build: Don't use -ffat-lto-objects in the python
> > >  feature test when building with clang-13
> > >
> > > Using -ffat-lto-objects in the python feature test when building with
> > > clang-13 results in:
> > >
> > >   clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > >   error: command '/usr/sbin/clang' failed with exit code 1
> > >   cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> > >   make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > >
> > > Noticed when building on a docker.io/library/archlinux:base container.
> > >
> > > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > Cc: Fangrui Song <maskray@google.com>
> > > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > Cc: Ian Rogers <irogers@google.com>
> > > Cc: Jiri Olsa <jolsa@kernel.org>
> > > Cc: John Keeping <john@metanate.com>
> > > Cc: Leo Yan <leo.yan@linaro.org>
> > > Cc: Michael Petlan <mpetlan@redhat.com>
> > > Cc: Namhyung Kim <namhyung@kernel.org>
> > > Cc: Nathan Chancellor <nathan@kernel.org>
> > > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > ---
> > >  tools/perf/Makefile.config | 3 +++
> > >  tools/perf/util/setup.py   | 2 ++
> > >  2 files changed, 5 insertions(+)
> > >
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 5b5ba475a5c00c0f..f3bf9297bcc03c5e 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
> > >    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
> > >    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
> > >    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> > > +  ifeq ($(CC_NO_CLANG), 0)
> > > +    PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
> > > +  endif
> > >  endif
> > >
> > >  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
> > > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > > index 6156bb87ee3e34cf..c255a2c90cd672b1 100644
> > > --- a/tools/perf/util/setup.py
> > > +++ b/tools/perf/util/setup.py
> > > @@ -25,6 +25,8 @@ if cc_is_clang:
> > >              vars[var] = sub("-fstack-protector-strong", "", vars[var])
> > >          if not clang_has_option("-fno-semantic-interposition"):
> > >              vars[var] = sub("-fno-semantic-interposition", "", vars[var])
> > > +        if not clang_has_option("-ffat-lto-objects"):
> > > +            vars[var] = sub("-ffat-lto-objects", "", vars[var])
> > >
> > >  from distutils.core import setup, Extension
> > >
> > > --
> > > 2.35.1
> > >
> >
> > Thanks for the followup patches.
> >
> > I have tested with the last 4 commits from [1].
> >
> > [ INSTRUCTIONS ]
> >
> > 1103  2022-04-08 17:14:40 LLVM_MVER="14"
> > 1104  2022-04-08 17:14:40 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
> > 1105  2022-04-08 17:14:40 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
> > 1106  2022-04-08 17:14:40 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
> > export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
> > 1107  2022-04-08 17:14:40 echo $PATH
> > 1108  2022-04-08 17:14:40 PYTHON_VER="3.10"
> > 1109  2022-04-08 17:14:40 MAKE="make"
> > 1110  2022-04-08 17:14:40 MAKE_OPTS="V=1 -j4 HOSTCC=clang
> > HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
> > STRIP=llvm-strip"
> > 1111  2022-04-08 17:14:40 echo $PYTHON_VER $MAKE $MAKE_OPTS
> >
> > 3.10 make V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang
> > LD=ld.lld AR=llvm-ar STRIP=llvm-strip
> >
> > 1112  2022-04-08 17:14:50 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> > clean 2>&1 | tee ../make-log_perf-clean.txt
> > 1113  2022-04-08 17:15:43 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> > PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
> > ../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt
> >
> > Please feel free to add my...
> >
> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v14 (x86-64)
> >
> > My perf build-log is attached.
> >
> > - sed@ -
> >
> > P.S.: I requested to bump perl to version 5.34.1 (see [2]) plus diff from [3].
> >
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent
> > [2] https://bugs.debian.org/1009170
> > [3] https://bugs.debian.org/1009149
> 
> [ To: GregKH and Sasha L. ]
> 
> I have seen the linux-stable team is taking perf patches for queue-5.17.
> 
> I have reported build problems with perf + clang + libperl (perl v5.34).
> My original report was against Linux v5.17-rc6 (see [1]).
> 
> So, I would like to see at least the 4 commits I have tested with to
> be in Linux v5.17.y.
> They are now in upstream means Linux v5.18-rc2.
> 
> Here are the upstream commit-ids:
> 
> 3a8a0475861a perf build: Don't use -ffat-lto-objects in the python
> feature test when building with clang-13
> dd6e1fe91cdd perf python: Fix probing for some clang command line options
> 41caff459a5b tools build: Filter out options and warnings not supported by clang
> 541f695cbcb6 tools build: Use $(shell ) instead of `` to get embedded
> libperl's ccopts
> 
> @Arnaldo: If you agree, the linux-stable team should include them in
> the next Linux v5.17.y series.
> ( I can NOT speak for other linux-stable releases. )

All now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Build perf with clang, failure with libperf
  2022-04-11 11:58                 ` Greg Kroah-Hartman
@ 2022-04-12 18:33                   ` Sedat Dilek
  0 siblings, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2022-04-12 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnaldo Carvalho de Melo, Sasha Levin, Nathan Chancellor,
	Adrian Hunter, Fangrui Song, Florian Fainelli, Ian Rogers,
	Jiri Olsa, John Keeping, Leo Yan, Michael Petlan, Namhyung Kim,
	Nick Desaulniers, Linux Kernel Mailing List

On Mon, Apr 11, 2022 at 1:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Mon, Apr 11, 2022 at 08:38:37AM +0200, Sedat Dilek wrote:
> > On Fri, Apr 8, 2022 at 5:30 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > >
> > > On Fri, Apr 8, 2022 at 4:49 PM Arnaldo Carvalho de Melo
> > > <arnaldo.melo@gmail.com> wrote:
> > > >
> > > > Em Tue, Apr 05, 2022 at 06:44:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > Em Tue, Apr 05, 2022 at 05:00:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > > Em Tue, Apr 05, 2022 at 05:46:00PM +0200, Sedat Dilek escreveu:
> > > > > > > So, we should include scripts/Makefile.clang or enhance
> > > > > > > tools/scripts/Makefile.include where LLVM/Clang stuff is defined (and
> > > > > > > can be overridden).
> > > > > >
> > > > > > > Jiri pointed out he needed two options (when I recall correctly):
> > > > > > >
> > > > > > > [1] -Wno-unused-command-line-argument
> > > > >
> > > > > I didn't see this one so far, but this one, and for the python case,
> > > > > appears on clang 13 on:
> > > > >
> > > > >   22    45.02 archlinux:base                : FAIL clang version 13.0.1
> > > > >
> > > > >   CC      /tmp/build/perf/arch/x86/util/pmu.o
> > > > > clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > > > > error: command '/usr/sbin/clang' failed with exit code 1
> > > > >   MKDIR   /tmp/build/perf/ui/stdio/
> > > > > cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> > > > >   CC      /tmp/build/perf/arch/x86/util/kvm-stat.o
> > > > > make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > > > > make[2]: *** Waiting for unfinished jobs....
> > > >
> > > > So this one is more involved, see the two patches below, the first fixes
> > > > the clang command option probing mechanism used and the second filters
> > > > out -ffat-lto-objects.
> > > >
> > > > Its all in my tmp.perf/urgent branch at
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git.
> > > >
> > > > The full test suite is still running, but so far the failures are
> > > > unrelated to the problems in this thread:
> > > >
> > > > [perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.18.0-rc1.tar.xz
> > > > [perfbuilder@five ~]$ time dm
> > > >    1   115.87 almalinux:8                   : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
> > > >    2    74.26 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
> > > >    3    67.82 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
> > > >    4    71.32 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
> > > >    5    77.05 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
> > > >    6    76.76 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
> > > >    7    79.36 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
> > > >    8   111.26 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
> > > >    9   118.37 alpine:3.11                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
> > > >   10   124.39 alpine:3.12                   : Ok   gcc (Alpine 9.3.0) 9.3.0 , Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
> > > >   11   135.45 alpine:3.13                   : Ok   gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 , Alpine clang version 10.0.1
> > > >   12   129.24 alpine:3.14                   : Ok   gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424 , Alpine clang version 11.1.0
> > > >   13   124.49 alpine:3.15                   : Ok   gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1
> > > >   14   115.27 alpine:edge                   : Ok   gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , Alpine clang version 13.0.1
> > > >   15    62.59 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
> > > >   16    90.90 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
> > > >   17    89.19 alt:p10                       : Ok   x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
> > > >   18    90.50 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) , ALT Linux Team clang version 12.0.1
> > > >   19    64.00 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) , clang version 3.6.2 (tags/RELEASE_362/final)
> > > >   20   100.13 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-13) , clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
> > > >   21   116.67 amazonlinux:devel             : Ok   gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.amzn2022)
> > > >   22   105.61 archlinux:base                : Ok   gcc (GCC) 11.2.0 , clang version 13.0.1
> > > >   23    98.90 centos:8                      : Ok   gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) , clang version 11.0.1 (Red Hat 11.0.1-1.module_el8.4.0+966+2995ef20)
> > > >   24   112.45 centos:stream                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10) , clang version 13.0.0 (Red Hat 13.0.0-3.module_el8.6.0+1074+380cef3f)
> > > >   25    51.53 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220330 releases/gcc-11.2.0-949-g511e8b6122 , clang version 13.0.0
> > > >   26    79.15 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 , clang version 3.8.1-24 (tags/RELEASE_381/final)
> > > >   27    84.48 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1
> > > >   28    98.81 debian:11                     : Ok   gcc (Debian 10.2.1-6) 10.2.1 20210110 , Debian clang version 11.0.1-2
> > > >   29   115.79 debian:experimental           : Ok   gcc (Debian 11.2.0-19) 11.2.0 , Debian clang version 13.0.1-3+b2
> > > >   30    24.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > > >   31    20.25 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > > >   32    22.06 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
> > > >   33    22.76 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 11.2.0-18) 11.2.0
> > > >   34    22.55 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.5.0 (tags/RELEASE_350/final)
> > > >   35    68.41 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) , clang version 3.7.0 (tags/RELEASE_370/final)
> > > >   36    80.65 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) , clang version 3.8.1 (tags/RELEASE_381/final)
> > > >   37    18.13 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
> > > >   38    81.54 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) , clang version 3.9.1 (tags/RELEASE_391/final)
> > > >   39    95.09 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) , clang version 4.0.1 (tags/RELEASE_401/final)
> > > >   40    97.18 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) , clang version 5.0.2 (tags/RELEASE_502/final)
> > > >   41   109.33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 6.0.1 (tags/RELEASE_601/final)
> > > >   42   115.85 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) , clang version 7.0.1 (Fedora 7.0.1-6.fc29)
> > > >   43   118.65 fedora:30                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 8.0.0 (Fedora 8.0.0-3.fc30)
> > > >   44   111.13 fedora:31                     : Ok   gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) , clang version 9.0.1 (Fedora 9.0.1-4.fc31)
> > > >   45   105.95 fedora:32                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> > > >   46   104.95 fedora:33                     : Ok   gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)
> > > >   47   112.06 fedora:34                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)
> > > >   48    20.44 fedora:34-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
> > > >   49    18.44 fedora:34-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
> > > >   50   113.69 fedora:35                     : Ok   gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) , clang version 13.0.0 (Fedora 13.0.0-3.fc35)
> > > >   51    30.08 fedora:36                     : FAIL gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC)
> > > >       + make PYTHON=python3 ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBTRACEEVENT_DYNAMIC=1 -C tools/perf O=/tmp/build/perf
> > > >     make: Entering directory '/git/perf-5.18.0-rc1/tools/perf'
> > > >       BUILD:   Doing 'make -j32' parallel build
> > > >     Makefile.config:728: No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev
> > > >     Makefile.config:1011: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
> > > >     Makefile.config:1118: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
> > > >     make[1]: *** [Makefile.perf:240: sub-make] Error 2
> > > >
> > > >   52   126.52 fedora:rawhide                : Ok   gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> > > >   53    96.02 gentoo-stage3:latest          : Ok   gcc (Gentoo 11.2.0 p1) 11.2.0 , clang version 13.0.0
> > > >   54    82.86 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0 , clang version 3.9.1 (tags/RELEASE_391/final)
> > > >   55    43.11 mageia:7                      : FAIL clang version 8.0.0 (Mageia 8.0.0-1.mga7)
> > > >           yychar = yylex (&yylval, &yylloc, scanner);
> > > >                    ^
> > > >     #define yylex           parse_events_lex
> > > >                             ^
> > > >     1 error generated.
> > > >     make[3]: *** [/git/perf-5.18.0-rc1/tools/build/Makefile.build:139: util] Error 2
> > > >   56   107.45 manjaro:base                  : Ok   gcc (GCC) 11.1.0 , clang version 13.0.0
> > > >   57     6.58 openmandriva:4.2              : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> > > >     In file included from builtin-bench.c:22:
> > > >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> > > >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> > > >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >     In file included from bench/bench.h:64,
> > > >                      from builtin-bench.c:22:
> > > >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> > > >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> > > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >   58     6.48 openmandriva:cooker           : FAIL gcc version 11.2.0 20210728 (OpenMandriva) (GCC)
> > > >     In file included from builtin-bench.c:22:
> > > >     bench/bench.h:66:19: error: conflicting types for 'pthread_attr_setaffinity_np'; have 'int(pthread_attr_t *, size_t,  cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  cpu_set_t *)'}
> > > >        66 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
> > > >           |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >     In file included from bench/bench.h:64,
> > > >                      from builtin-bench.c:22:
> > > >     /usr/include/pthread.h:394:12: note: previous declaration of 'pthread_attr_setaffinity_np' with type 'int(pthread_attr_t *, size_t,  const cpu_set_t *)' {aka 'int(pthread_attr_t *, long unsigned int,  const cpu_set_t *)'}
> > > >       394 | extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
> > > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >     ld: warning: -r and --gc-sections may not be used together, disabling --gc-sections
> > > >     ld: warning: -r and --icf may not be used together, disabling --icf
> > > >   59   118.04 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] , clang version 5.0.1 (tags/RELEASE_501/final 312548)
> > > >   60   127.98 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 7.0.1 (tags/RELEASE_701/final 349238)
> > > >   61   122.86 opensuse:15.2                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 9.0.1
> > > >   62   133.70 opensuse:15.3                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> > > >   63   133.30 opensuse:15.4                 : Ok   gcc (SUSE Linux) 7.5.0 , clang version 11.0.1
> > > >   64   158.92 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] , clang version 13.0.0
> > > >   65   114.77 oraclelinux:8                 : Ok   gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4.0.1) , clang version 12.0.1 (Red Hat 12.0.1-4.0.1.module+el8.5.0+20428+2b4ecd47)
> > > >   66: rockylinux:8
> > > >
> > > > - Arnaldo
> > > >
> > > > From 73fb827d72906bd2d78c6ca091b0c74f90183a95 Mon Sep 17 00:00:00 2001
> > > > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > Date: Fri, 8 Apr 2022 10:08:07 -0300
> > > > Subject: [PATCH 1/2] perf python: Fix probing for some clang command line
> > > >  options
> > > >
> > > > The clang compiler complains about some options even without a source
> > > > file being available, while others require one, so use the simple
> > > > tools/build/feature/test-hello.c file.
> > > >
> > > > Then check for the "is not supported" string in its output, in addition
> > > > to the "unknown argument" already being looked for.
> > > >
> > > > This was noticed when building with clang-13 where -ffat-lto-objects
> > > > isn't supported and since we were looking just for "unknown argument"
> > > > and not providing a source code to clang, was mistakenly assumed as
> > > > being available and not being filtered to set of command line options
> > > > provided to clang, leading to a build failure.
> > > >
> > > > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > Cc: Fangrui Song <maskray@google.com>
> > > > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > Cc: Ian Rogers <irogers@google.com>
> > > > Cc: Jiri Olsa <jolsa@kernel.org>
> > > > Cc: John Keeping <john@metanate.com>
> > > > Cc: Leo Yan <leo.yan@linaro.org>
> > > > Cc: Michael Petlan <mpetlan@redhat.com>
> > > > Cc: Namhyung Kim <namhyung@kernel.org>
> > > > Cc: Nathan Chancellor <nathan@kernel.org>
> > > > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > Link: http://lore.kernel.org/lkml/
> > > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > ---
> > > >  tools/perf/util/setup.py | 6 ++++--
> > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > > > index 483f05004e682081..6156bb87ee3e34cf 100644
> > > > --- a/tools/perf/util/setup.py
> > > > +++ b/tools/perf/util/setup.py
> > > > @@ -1,12 +1,14 @@
> > > > -from os import getenv
> > > > +from os import getenv, path
> > > >  from subprocess import Popen, PIPE
> > > >  from re import sub
> > > >
> > > >  cc = getenv("CC")
> > > >  cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline()
> > > > +src_feature_tests  = getenv('srctree') + '/tools/build/feature'
> > > >
> > > >  def clang_has_option(option):
> > > > -    return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
> > > > +    cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> > > > +    return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ]
> > > >
> > > >  if cc_is_clang:
> > > >      from distutils.sysconfig import get_config_vars
> > > > --
> > > > 2.35.1
> > > >
> > > > From e807abf709ee26af99588bd13e725fb45011b167 Mon Sep 17 00:00:00 2001
> > > > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > Date: Thu, 7 Apr 2022 11:04:20 -0300
> > > > Subject: [PATCH 2/2] perf build: Don't use -ffat-lto-objects in the python
> > > >  feature test when building with clang-13
> > > >
> > > > Using -ffat-lto-objects in the python feature test when building with
> > > > clang-13 results in:
> > > >
> > > >   clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> > > >   error: command '/usr/sbin/clang' failed with exit code 1
> > > >   cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
> > > >   make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
> > > >
> > > > Noticed when building on a docker.io/library/archlinux:base container.
> > > >
> > > > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > > > Cc: Fangrui Song <maskray@google.com>
> > > > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > > > Cc: Ian Rogers <irogers@google.com>
> > > > Cc: Jiri Olsa <jolsa@kernel.org>
> > > > Cc: John Keeping <john@metanate.com>
> > > > Cc: Leo Yan <leo.yan@linaro.org>
> > > > Cc: Michael Petlan <mpetlan@redhat.com>
> > > > Cc: Namhyung Kim <namhyung@kernel.org>
> > > > Cc: Nathan Chancellor <nathan@kernel.org>
> > > > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > > > Cc: Sedat Dilek <sedat.dilek@gmail.com>
> > > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > > ---
> > > >  tools/perf/Makefile.config | 3 +++
> > > >  tools/perf/util/setup.py   | 2 ++
> > > >  2 files changed, 5 insertions(+)
> > > >
> > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > > index 5b5ba475a5c00c0f..f3bf9297bcc03c5e 100644
> > > > --- a/tools/perf/Makefile.config
> > > > +++ b/tools/perf/Makefile.config
> > > > @@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
> > > >    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
> > > >    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
> > > >    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> > > > +  ifeq ($(CC_NO_CLANG), 0)
> > > > +    PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
> > > > +  endif
> > > >  endif
> > > >
> > > >  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
> > > > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > > > index 6156bb87ee3e34cf..c255a2c90cd672b1 100644
> > > > --- a/tools/perf/util/setup.py
> > > > +++ b/tools/perf/util/setup.py
> > > > @@ -25,6 +25,8 @@ if cc_is_clang:
> > > >              vars[var] = sub("-fstack-protector-strong", "", vars[var])
> > > >          if not clang_has_option("-fno-semantic-interposition"):
> > > >              vars[var] = sub("-fno-semantic-interposition", "", vars[var])
> > > > +        if not clang_has_option("-ffat-lto-objects"):
> > > > +            vars[var] = sub("-ffat-lto-objects", "", vars[var])
> > > >
> > > >  from distutils.core import setup, Extension
> > > >
> > > > --
> > > > 2.35.1
> > > >
> > >
> > > Thanks for the followup patches.
> > >
> > > I have tested with the last 4 commits from [1].
> > >
> > > [ INSTRUCTIONS ]
> > >
> > > 1103  2022-04-08 17:14:40 LLVM_MVER="14"
> > > 1104  2022-04-08 17:14:40 LLVM_TOOLCHAIN_PATH="/usr/lib/llvm-${LLVM_MVER}/bin"
> > > 1105  2022-04-08 17:14:40 ##LLVM_TOOLCHAIN_PATH="/opt/llvm-toolchain/bin"
> > > 1106  2022-04-08 17:14:40 if [ -d ${LLVM_TOOLCHAIN_PATH} ]; then
> > > export PATH="${LLVM_TOOLCHAIN_PATH}:${PATH}"; fi
> > > 1107  2022-04-08 17:14:40 echo $PATH
> > > 1108  2022-04-08 17:14:40 PYTHON_VER="3.10"
> > > 1109  2022-04-08 17:14:40 MAKE="make"
> > > 1110  2022-04-08 17:14:40 MAKE_OPTS="V=1 -j4 HOSTCC=clang
> > > HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar
> > > STRIP=llvm-strip"
> > > 1111  2022-04-08 17:14:40 echo $PYTHON_VER $MAKE $MAKE_OPTS
> > >
> > > 3.10 make V=1 -j4 HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar CC=clang
> > > LD=ld.lld AR=llvm-ar STRIP=llvm-strip
> > >
> > > 1112  2022-04-08 17:14:50 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> > > clean 2>&1 | tee ../make-log_perf-clean.txt
> > > 1113  2022-04-08 17:15:43 LC_ALL=C $MAKE $MAKE_OPTS -C tools/perf
> > > PYTHON=python${PYTHON_VER} install-bin 2>&1 | tee
> > > ../make-log_perf-python${PYTHON_VER}-install_bin_debian-llvm14_perf-urgent-acme-20220408.txt
> > >
> > > Please feel free to add my...
> > >
> > > Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v14 (x86-64)
> > >
> > > My perf build-log is attached.
> > >
> > > - sed@ -
> > >
> > > P.S.: I requested to bump perl to version 5.34.1 (see [2]) plus diff from [3].
> > >
> > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent
> > > [2] https://bugs.debian.org/1009170
> > > [3] https://bugs.debian.org/1009149
> >
> > [ To: GregKH and Sasha L. ]
> >
> > I have seen the linux-stable team is taking perf patches for queue-5.17.
> >
> > I have reported build problems with perf + clang + libperl (perl v5.34).
> > My original report was against Linux v5.17-rc6 (see [1]).
> >
> > So, I would like to see at least the 4 commits I have tested with to
> > be in Linux v5.17.y.
> > They are now in upstream means Linux v5.18-rc2.
> >
> > Here are the upstream commit-ids:
> >
> > 3a8a0475861a perf build: Don't use -ffat-lto-objects in the python
> > feature test when building with clang-13
> > dd6e1fe91cdd perf python: Fix probing for some clang command line options
> > 41caff459a5b tools build: Filter out options and warnings not supported by clang
> > 541f695cbcb6 tools build: Use $(shell ) instead of `` to get embedded stuff
> > libperl's ccopts
> >
> > @Arnaldo: If you agree, the linux-stable team should include them in
> > the next Linux v5.17.y series.
> > ( I can NOT speak for other linux-stable releases. )
>
> All now queued up, thanks.
>
> greg k-h

Thanks.

Today, I tested (build and boot into bare metal) Linux v5.17.3-rc1
which includes the queued up commits.

$ cat /proc/version
Linux version 5.17.3-rc1-1-amd64-clang14-lto
(sedat.dilek@gmail.com@iniza) (Debian clang version
14.0.1-++20220411113112+6697c5bc3a1e-1~exp1~20220411233201.117, Debian
LLD 14.0.1) #1~bookworm+dileks1 SMP PREEMPT 2022-04-12

- Sedat -

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-04-12 18:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 20:43 Build perf with clang, failure with libperf Arnaldo Carvalho de Melo
2022-04-04 21:53 ` Nathan Chancellor
2022-04-05 14:47   ` Arnaldo Carvalho de Melo
2022-04-05 15:46     ` Sedat Dilek
2022-04-05 20:00       ` Arnaldo Carvalho de Melo
2022-04-05 21:44         ` Arnaldo Carvalho de Melo
2022-04-06 20:44           ` Sedat Dilek
2022-04-08 14:49           ` Arnaldo Carvalho de Melo
2022-04-08 15:30             ` Sedat Dilek
2022-04-09  5:13               ` Sedat Dilek
2022-04-11  6:38               ` Sedat Dilek
2022-04-11 11:58                 ` Greg Kroah-Hartman
2022-04-12 18:33                   ` Sedat Dilek
2022-04-06 20:32         ` Sedat Dilek
2022-04-07 10:27   ` Sedat Dilek
2022-04-07 15:03     ` Nathan Chancellor
2022-04-07 16:25       ` Sedat Dilek
2022-04-07 17:10         ` Sedat Dilek
2022-04-07 17:42           ` Sedat Dilek
2022-04-07 17:14         ` Nathan Chancellor
2022-04-07 17:17           ` Sedat Dilek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).