All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf build: Fix static build of dlfilters
@ 2026-07-13 10:23 Leo Yan
  2026-07-13 17:38 ` Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Leo Yan @ 2026-07-13 10:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
	Adrian Hunter, James Clark, Trevor Allison
  Cc: linux-perf-users, linux-kernel, Leo Yan

Commit e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
passes LDFLAGS when linking dlfilter shared objects. That breaks static
builds because LDFLAGS can contain -static, leading to an invalid link
command.

dlfilters are always built as shared objects, even for a static perf
binary. Filter out -static for the dlfilter .so link while preserving
the rest of LDFLAGS.

Fixes: e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
Signed-off-by: Leo Yan <leo.yan@arm.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 2b53d9e0c73b3382724b1f776880aaa8fa505f59..0031112c036e830e50711d5cb0b3867cba36e374 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) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -o $@ $<
+	$(QUIET_LINK)$(CC) $(filter-out -static,$(LDFLAGS)) $(EXTRA_CFLAGS) -shared -o $@ $<
 
 ifndef NO_JVMTI
 LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o

---
base-commit: ef3af1df4f3372bd8ad47619452a283048b3bc8d
change-id: 20260713-perf_fix_static_build-6db03942fee1

Best regards,
-- 
Leo Yan <leo.yan@arm.com>


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

* Re: [PATCH] perf build: Fix static build of dlfilters
  2026-07-13 10:23 [PATCH] perf build: Fix static build of dlfilters Leo Yan
@ 2026-07-13 17:38 ` Namhyung Kim
  2026-07-13 18:14   ` Leo Yan
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2026-07-13 17:38 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Trevor Allison, linux-perf-users, linux-kernel

Hi Leo,

On Mon, Jul 13, 2026 at 11:23:01AM +0100, Leo Yan wrote:
> Commit e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
> passes LDFLAGS when linking dlfilter shared objects. That breaks static
> builds because LDFLAGS can contain -static, leading to an invalid link
> command.
> 
> dlfilters are always built as shared objects, even for a static perf
> binary. Filter out -static for the dlfilter .so link while preserving
> the rest of LDFLAGS.
> 
> Fixes: e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Actually I posted the same patch.  Can I get your Tested-by?

https://lore.kernel.org/r/20260707000357.823509-1-namhyung@kernel.org

Thanks,
Namhyung

> ---
>  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 2b53d9e0c73b3382724b1f776880aaa8fa505f59..0031112c036e830e50711d5cb0b3867cba36e374 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) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -o $@ $<
> +	$(QUIET_LINK)$(CC) $(filter-out -static,$(LDFLAGS)) $(EXTRA_CFLAGS) -shared -o $@ $<
>  
>  ifndef NO_JVMTI
>  LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
> 
> ---
> base-commit: ef3af1df4f3372bd8ad47619452a283048b3bc8d
> change-id: 20260713-perf_fix_static_build-6db03942fee1
> 
> Best regards,
> -- 
> Leo Yan <leo.yan@arm.com>
> 

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

* Re: [PATCH] perf build: Fix static build of dlfilters
  2026-07-13 17:38 ` Namhyung Kim
@ 2026-07-13 18:14   ` Leo Yan
  2026-07-13 20:54     ` Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Leo Yan @ 2026-07-13 18:14 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Trevor Allison, linux-perf-users, linux-kernel

Hi Namhyung,

On Mon, Jul 13, 2026 at 10:38:41AM -0700, Namhyung Kim wrote:

[...]

> > Fixes: e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
> 
> Actually I posted the same patch.  Can I get your Tested-by?
> 
> https://lore.kernel.org/r/20260707000357.823509-1-namhyung@kernel.org

Sorry for duplicate patches. I will give my test tag on the patch.

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

* Re: [PATCH] perf build: Fix static build of dlfilters
  2026-07-13 18:14   ` Leo Yan
@ 2026-07-13 20:54     ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2026-07-13 20:54 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Trevor Allison, linux-perf-users, linux-kernel

On Mon, Jul 13, 2026 at 07:14:01PM +0100, Leo Yan wrote:
> Hi Namhyung,
> 
> On Mon, Jul 13, 2026 at 10:38:41AM -0700, Namhyung Kim wrote:
> 
> [...]
> 
> > > Fixes: e1065ed188cf ("perf build: Add LDFLAGS to dlfilters .so link")
> > 
> > Actually I posted the same patch.  Can I get your Tested-by?
> > 
> > https://lore.kernel.org/r/20260707000357.823509-1-namhyung@kernel.org
> 
> Sorry for duplicate patches. I will give my test tag on the patch.

No problem, thanks for your work!

Namhyung


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

end of thread, other threads:[~2026-07-13 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 10:23 [PATCH] perf build: Fix static build of dlfilters Leo Yan
2026-07-13 17:38 ` Namhyung Kim
2026-07-13 18:14   ` Leo Yan
2026-07-13 20:54     ` Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.