public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Ian Rogers <irogers@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Fangrui Song <maskray@google.com>, Jiri Olsa <jolsa@redhat.com>,
	Michael Petlan <mpetlan@redhat.com>, Leo Yan <leo.yan@linaro.org>,
	John Keeping <john@metanate.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Subject: Re: [PATCH] tools: feature/test-libperl.c: Sync PERL_EMBED_CCOPTS with perf
Date: Fri, 11 Mar 2022 12:56:07 +0100	[thread overview]
Message-ID: <Yis41ykyJq1fHYSx@krava> (raw)
In-Reply-To: <20220310061909.20166-1-sedat.dilek@gmail.com>

On Thu, Mar 10, 2022 at 07:19:09AM +0100, Sedat Dilek wrote:
> When trying to build perf with a LLVM/Clang toolchain people see errors
> when testing for libperl feature.
> 
> Jiri reports:
> 
> > I'm getting some other lto related error:
> >
> >         $ cat test-libperl.make.output
> >         clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
> >
> 
> The reason is PERL_EMBED_CCOPTS is defined in two places:
> 
> tools/build/feature/Makefile
> tools/perf/Makefile.config
> 
> As an result FLAGS_PERL_EMBED is set differently.
> 
> For building perf '-ffat-lto-objects' is filtered-out:
> 
> $ git grep ffat-lto-objects tools/perf/
> tools/perf/Makefile.config:  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> 
> Sync PERL_EMBED_CCOPTS in tools/build/feature/Makefile to fix this.
> 
> For a minimal fix for Linux v5.17 this here was preferred by Arnaldo.
> 
> Link: https://marc.info/?t=164646683300002&r=1&w=2
> Reported-by: Jiri Olsa <olsajiri@gmail.com>
> Reported-by: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
> Tested-by: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
> Suggested-by: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
> ---
>  tools/build/feature/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1480910c792e..869073cf8449 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -218,6 +218,7 @@ 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 := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))

it looks like this is not enough, at least on fedora 35

I had to add changes below on top of your patch, it fixed the perl
feature detection and perf build itself, but I'm still getting error
with perf/python.so:

	$ CC=clang make JOBS=1 
	...
	  GEN     python/perf.so
	python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/python.o: file not recognized: file format not recognized
	clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
	error: command 'clang' failed with exit status 1
	cp: cannot stat 'python_ext_build/lib/perf*.so': No such file or directory

with:

	$ file python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/python.o
	python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/python.o: LLVM IR bitcode

do you get clean compile with python lang enabled?

jirka


---
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 869073cf8449..86df0fe11ee5 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -217,9 +217,9 @@ 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)
 PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
-FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+FLAGS_PERL_EMBED  := $(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro
 
 $(OUTPUT)test-libperl.bin:
 	$(BUILD) $(FLAGS_PERL_EMBED)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 96ad944ca6a8..38b0b0e7a168 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -778,7 +778,7 @@ else
   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 -specs=%,$(PERL_EMBED_CCOPTS))
-  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
+  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro
   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 483f05004e68..cfbb03babf63 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -43,7 +43,7 @@ class install_lib(_install_lib):
 
 cflags = getenv('CFLAGS', '').split()
 # switch off several checks (need to be at the end of cflags list)
-cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls', '-DPYTHON_PERF' ]
+cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls', '-Wno-ignored-optimization-argument', '-DPYTHON_PERF' ]
 if not cc_is_clang:
     cflags += ['-Wno-cast-function-type' ]
 

  parent reply	other threads:[~2022-03-11 11:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  6:19 [PATCH] tools: feature/test-libperl.c: Sync PERL_EMBED_CCOPTS with perf Sedat Dilek
2022-03-10 20:59 ` Nick Desaulniers
2022-03-11 11:56 ` Jiri Olsa [this message]
2022-03-11 23:30   ` Sedat Dilek
2022-03-11 23:39     ` Sedat Dilek
2022-03-12  1:41       ` Sedat Dilek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yis41ykyJq1fHYSx@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@redhat.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=irogers@google.com \
    --cc=john@metanate.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maskray@google.com \
    --cc=mpetlan@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sedat.dilek@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox