From: Namhyung Kim <namhyung@kernel.org>
To: Trevor Allison <tallison@redhat.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf build: Fix LTO build of libperf-jvmti.so
Date: Wed, 8 Jul 2026 17:12:42 -0700 [thread overview]
Message-ID: <ak7neuxFS3ZuGL4F@google.com> (raw)
In-Reply-To: <20260701042145.71595-1-tallison@redhat.com>
Hello,
On Wed, Jul 01, 2026 at 12:21:45AM -0400, Trevor Allison wrote:
> Linking libperf-jvmti.so through jvmti-in.o (ld -r) breaks LTO when
> -flto is passed via LDFLAGS. Link the JVMTI object files directly
> instead, and pass any LTO flags from LDFLAGS to the JVMTI compile step
Can you share the error message and put it in the commit message?
I think my build is fine with LDFLAGS=-flto.
Thanks,
Namhyung
>
> Signed-off-by: Trevor Allison <tallison@redhat.com>
> ---
> tools/perf/Makefile.perf | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 3f0544d37a7f..bc66d711fa39 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -686,10 +686,12 @@ ifndef NO_JVMTI
> LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
>
> $(LIBJVMTI_IN): prepare FORCE
> - $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
> + $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti \
> + CFLAGS="$(CFLAGS) $(filter -flto% -ffat-lto-objects,$(LDFLAGS))"
>
> $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
> - $(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
> + $(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ \
> + $(addprefix $(OUTPUT)jvmti/,libjvmti.o jvmti_agent.o libstring.o libctype.o)
> endif
>
> $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
> --
> 2.50.1 (Apple Git-155)
>
next prev parent reply other threads:[~2026-07-09 0:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 4:21 [PATCH] perf build: Fix LTO build of libperf-jvmti.so Trevor Allison
2026-07-09 0:12 ` Namhyung Kim [this message]
2026-07-09 1:49 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ak7neuxFS3ZuGL4F@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tallison@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox