perf build: Add LDFLAGS to dlfilters .so link
PATCH 1/1 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.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -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
Signature · 1 line
2.50.1 (Apple Git-155)
[email protected]
AI reviewThank 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…
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 <[email protected]>
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.
tools/perf/Makefile.perf $(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h · line 680
Quoted 10 lines
tools/perf/Makefile.perf +1
-1@@ -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.
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Namhyung Kim
maintainerQuoted 26 lines · On Fri, Jun 26, 2026 at 06:34:23PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Adding$(LDFLAGS)to the unconditionally builtdlfiltersshared library link rule breaks statically linkedperfbuilds. --commit
18f2c24db710920618ef1d894a2b24abff4dbeb9
Author: Trevor Allison <[email protected]>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.
tools/perf/Makefile.perf $(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h · line 680
Quoted 10 lines
tools/perf/Makefile.perf +1
-1@@ -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?
Quoted 3 lines
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
Quoted 4 lines · Trevor Allison
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