[PATCH v8 01/13] perf build: Link the jvmti agent and the GTK UI with EXTRA_CFLAGS

From: Arnaldo Carvalho de Melo

Date: Wed Nov 18 2026 - 17:38:30 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

The jvmti and GTK objects are compiled with EXTRA_CFLAGS but their
shared objects are linked with LDFLAGS only, so flags with link-time
parts never reach them. With -fprofile-instr-generate the jvmti
agent's __profc counters had no __llvm_profile runtime to write them,
and its files showed 0.00% in the coverage report.

Pass EXTRA_CFLAGS at link time, as the dlfilter rule already does.

Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/Makefile.perf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index b74b534e1153ffcb..e730f1a209cb44a4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -640,7 +640,7 @@ $(GTK_IN): FORCE prepare
$(Q)$(MAKE) $(build)=gtk

$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
- $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
+ $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(EXTRA_CFLAGS) $(filter %.o,$^) $(GTK_LIBS)

$(SCRIPTS) : $(OUTPUT)% : %.sh
$(QUIET_GEN)$(INSTALL) '$<' '$@'
@@ -791,7 +791,7 @@ $(LIBJVMTI_IN): prepare FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti

$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
- $(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
endif

$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.56.1