Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf build: Add LDFLAGS to dlfilters .so link
@ 2026-06-26 18:27 Trevor Allison
  2026-06-26 18:34 ` sashiko-bot
  2026-07-03 20:37 ` Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Trevor Allison @ 2026-06-26 18:27 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung
  Cc: mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter,
	james.clark, linux-perf-users, linux-kernel, tallison

Build-time linker flags were not applied when linking dlfilters.
Pass LDFLAGS for consistency with the other link rules.

Signed-off-by: Trevor Allison <tallison@redhat.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 3f0544d37a7f..2b53d9e0c73b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -680,7 +680,7 @@ $(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
 .SECONDARY: $(DLFILTERS:.so=.o)
 
 $(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
-	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
+	$(QUIET_LINK)$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -o $@ $<
 
 ifndef NO_JVMTI
 LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
-- 
2.50.1 (Apple Git-155)


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

* Re: [PATCH] perf build: Add LDFLAGS to dlfilters .so link
  2026-06-26 18:27 [PATCH] perf build: Add LDFLAGS to dlfilters .so link Trevor Allison
@ 2026-06-26 18:34 ` sashiko-bot
  2026-07-04 16:16   ` Namhyung Kim
  2026-07-03 20:37 ` Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: sashiko-bot @ 2026-06-26 18:34 UTC (permalink / raw)
  To: Trevor Allison; +Cc: linux-perf-users

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Adding `$(LDFLAGS)` to the unconditionally built `dlfilters` shared library link rule breaks statically linked `perf` builds.
--

commit 18f2c24db710920618ef1d894a2b24abff4dbeb9
Author: Trevor Allison <tallison@redhat.com>

perf build: Add LDFLAGS to dlfilters .so link
    
Build-time linker flags were not applied when linking dlfilters.
Pass LDFLAGS for consistency with the other link rules.

> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 476b8dcaef58c..f2294a6d89604 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -677,7 +677,7 @@ $(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
>  .SECONDARY: $(DLFILTERS:.so=.o)
>  
>  $(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
> -	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
> +	$(QUIET_LINK)$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -o $@ $<

[Severity: Low]
Does this break static builds of perf?

If a user builds perf statically by setting LDFLAGS="-static", this rule
will pass both "-static" and "-shared" to the linker. Since these flags are
mutually exclusive, this results in a fatal linker error.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260626182739.53294-1-tallison@redhat.com?part=1

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

* Re: [PATCH] perf build: Add LDFLAGS to dlfilters .so link
  2026-06-26 18:27 [PATCH] perf build: Add LDFLAGS to dlfilters .so link Trevor Allison
  2026-06-26 18:34 ` sashiko-bot
@ 2026-07-03 20:37 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2026-07-03 20:37 UTC (permalink / raw)
  To: peterz, mingo, acme, Trevor Allison
  Cc: mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter,
	james.clark, linux-perf-users, linux-kernel

On Fri, 26 Jun 2026 14:27:39 -0400, Trevor Allison wrote:
> Build-time linker flags were not applied when linking dlfilters.
> Pass LDFLAGS for consistency with the other link rules.
> 
> 
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



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

* Re: [PATCH] perf build: Add LDFLAGS to dlfilters .so link
  2026-06-26 18:34 ` sashiko-bot
@ 2026-07-04 16:16   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2026-07-04 16:16 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: Trevor Allison, linux-perf-users

On Fri, Jun 26, 2026 at 06:34:23PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Adding `$(LDFLAGS)` to the unconditionally built `dlfilters` shared library link rule breaks statically linked `perf` builds.
> --
> 
> commit 18f2c24db710920618ef1d894a2b24abff4dbeb9
> Author: Trevor Allison <tallison@redhat.com>
> 
> perf build: Add LDFLAGS to dlfilters .so link
>     
> Build-time linker flags were not applied when linking dlfilters.
> Pass LDFLAGS for consistency with the other link rules.
> 
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index 476b8dcaef58c..f2294a6d89604 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -677,7 +677,7 @@ $(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
> >  .SECONDARY: $(DLFILTERS:.so=.o)
> >  
> >  $(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
> > -	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
> > +	$(QUIET_LINK)$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -o $@ $<
> 
> [Severity: Low]
> Does this break static builds of perf?
> 
> If a user builds perf statically by setting LDFLAGS="-static", this rule
> will pass both "-static" and "-shared" to the linker. Since these flags are
> mutually exclusive, this results in a fatal linker error.

Oops, I missed this message and merged it.  It indeed caused a failure 
in the build test.  It seems we should skip building dlfilters when the
LDFLAGS has -static or remove -static from the LDFLAGS for dlfilters.

Thanks,
Namhyung

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

end of thread, other threads:[~2026-07-04 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 18:27 [PATCH] perf build: Add LDFLAGS to dlfilters .so link Trevor Allison
2026-06-26 18:34 ` sashiko-bot
2026-07-04 16:16   ` Namhyung Kim
2026-07-03 20:37 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox