* [PATCH] perf build: filter all combinations of -flto for libbperl
@ 2025-03-11 17:33 Holger Hoffstätte
2025-03-18 23:10 ` [PATCH RESEND] perf build: filter all combinations of -flto for libperl Holger Hoffstätte
0 siblings, 1 reply; 3+ messages in thread
From: Holger Hoffstätte @ 2025-03-11 17:33 UTC (permalink / raw)
To: linux-perf-users, linux-kernel, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan
Cc: Guilherme Amadio
When building the libperl feature the build uses perl's build flags
(ccopts) but filters out various flags, e.g. for LTO.
While this is conceptually correct, it is insufficient in practice,
since only "-flto=auto" is filterd out. When perl itself is built with
"-flto" this can cause parts of perf being built with LTO and others
without, giving exciting build errors like e.g.:
../tools/perf/pmu-events/pmu-events.c:72851:(.text+0xb79): undefined
reference to `strcmp_cpuid_str' collect2: error: ld returned 1 exit status
Fix this by filtering all matching flag values of -flto{=n,auto,..}.
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
tools/perf/Makefile.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index a148ca9ef..4f5a40ab8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -820,7 +820,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% -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH RESEND] perf build: filter all combinations of -flto for libperl
2025-03-11 17:33 [PATCH] perf build: filter all combinations of -flto for libbperl Holger Hoffstätte
@ 2025-03-18 23:10 ` Holger Hoffstätte
2025-03-21 6:14 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Holger Hoffstätte @ 2025-03-18 23:10 UTC (permalink / raw)
To: linux-perf-users, linux-kernel, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
Liang, Kan, Guilherme Amadio
[Not a peep of feedback - if I'm doing something wrong here please let me know;
the patch fixes a real bug someone reported in Gentoo.]
When enabling the libperl feature the build uses perl's build flags
(ccopts) but filters out various flags, e.g. for LTO.
While this is conceptually correct, it is insufficient in practice,
since only "-flto=auto" is filtered out. When perl itself is built with
"-flto" this can cause parts of perf being built with LTO and others
without, giving exciting build errors like e.g.:
../tools/perf/pmu-events/pmu-events.c:72851:(.text+0xb79): undefined
reference to `strcmp_cpuid_str' collect2: error: ld returned 1 exit status
Fix this by filtering all matching flag values of -flto{=n,auto,..}.
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
tools/perf/Makefile.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index a148ca9ef..4f5a40ab8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -820,7 +820,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% -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] perf build: filter all combinations of -flto for libperl
2025-03-18 23:10 ` [PATCH RESEND] perf build: filter all combinations of -flto for libperl Holger Hoffstätte
@ 2025-03-21 6:14 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-03-21 6:14 UTC (permalink / raw)
To: Holger Hoffstätte
Cc: linux-perf-users, linux-kernel, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Ian Rogers, Adrian Hunter, Liang, Kan,
Guilherme Amadio
Hello,
On Wed, Mar 19, 2025 at 12:10:59AM +0100, Holger Hoffstätte wrote:
> [Not a peep of feedback - if I'm doing something wrong here please let me know;
> the patch fixes a real bug someone reported in Gentoo.]
>
> When enabling the libperl feature the build uses perl's build flags
> (ccopts) but filters out various flags, e.g. for LTO.
> While this is conceptually correct, it is insufficient in practice,
> since only "-flto=auto" is filtered out. When perl itself is built with
> "-flto" this can cause parts of perf being built with LTO and others
> without, giving exciting build errors like e.g.:
>
> ../tools/perf/pmu-events/pmu-events.c:72851:(.text+0xb79): undefined
> reference to `strcmp_cpuid_str' collect2: error: ld returned 1 exit status
>
> Fix this by filtering all matching flag values of -flto{=n,auto,..}.
>
> Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Thanks for the fix but the patch is not applying. Can you please check
and resend?
Thanks,
Namhyung
> ---
> tools/perf/Makefile.config | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index a148ca9ef..4f5a40ab8 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -820,7 +820,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% -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
> PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
> FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
> --
> 2.48.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-21 6:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 17:33 [PATCH] perf build: filter all combinations of -flto for libbperl Holger Hoffstätte
2025-03-18 23:10 ` [PATCH RESEND] perf build: filter all combinations of -flto for libperl Holger Hoffstätte
2025-03-21 6:14 ` Namhyung Kim
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).