tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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>
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>
>
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.
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
© 2016 - 2026 Red Hat, Inc.