All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brendan McGrath <bmcgrath@codeweavers.com>
To: Ian Rogers <irogers@google.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: "James Clark" <james.clark@linaro.org>,
	"Rémi Bernon" <rbernon@codeweavers.com>,
	"Sam James" <sam@gentoo.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Leo Yan" <leo.yan@arm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf symbols: Fix HAVE_LIBBFD_BUILDID_SUPPORT build
Date: Fri, 12 Sep 2025 09:23:42 +1000	[thread overview]
Message-ID: <3e6eb24f-5557-4045-8593-bfd12e2b9cec@codeweavers.com> (raw)
In-Reply-To: <CAP-5=fX33kGxfHzqVGzusMBiHJM6G75TbLyZazjp37yohwscGg@mail.gmail.com>



On 9/9/25 01:47, Ian Rogers wrote:
> On Mon, Sep 8, 2025 at 3:24 AM Brendan McGrath <bmcgrath@codeweavers.com> wrote:
>> Just wanted to let you know that I've been able to put together a PoC
>> that does just this. It allows the pe-file-parsing test to pass using
>> LLVM in place of libbfd.
>>
>> If there's interest, I would be happy to try to shape this in to
>> something that can be accepted upstream.
> 
> IMO that'd be great! In this series:
> https://lore.kernel.org/lkml/20250823003216.733941-1-irogers@google.com/
> I wanted to pull apart the disasm vs the srcline vs .. uses of
> libraries like llvm, capstone, let's delete libbfd, objdump, etc. The
> idea being to have the API defined somewhere like disasm.h and then
> based on compile time and runtime options select which implementation
> to use. Things have evolved in perf, with a lot of stuff just globbed
> into places like symbol without clear separation of APIs. Separating
> things by library used allows reuse of things like library handles.
> 
> That series has 2 issues I'm aware of:
> 1) the last 6 patches remove libbfd support (rather than refactor) and
> some people may care. I suspect with your fix it could be down to ~1
> person caring. I removed rather than refactored as there is a very
> real risk that when you do refactor you break, and as this stuff is
> next to always disabled then it's easy for regressions to creep in at
> which point that ~1 person would probably complain. I'd much rather we
> had a good solution that everyone was working toward having work well,
> your patches would pull in this direction :-)
> 
> 2) Namhyung didn't like that I'd reversed the struct definitions for
> the the capstone/LLVM APIs using pahole and would prefer that the
> definitions came from capstone.h/llvm.h. My reasons for not doing that
> are:
> 2.1) if you have say capstone.h or llvm.h then why not just link
> against the library? But doing that avoids the decoupling the patch
> series is trying to set up. We'd need more build options, which option
> to make the default, etc. which is kind of messy.
> 2.2) to support that you'd need to bring back a "what if no
> capstone.h/llvm.h" option in the code, I'd wanted that to be the
> dlopen/dlsym case which must already handle libcapstone.so or
> libLLVM.so being missing. Supporting the "no anything" option brings
> with it a lot of ifdef-ery I was hoping to avoid and it would again be
> one of those seldom used and often broken build options (like symbol
> minimal (no libelf) today).
> 2.3) in my build environment (bazel) depending on headers means
> linking against the library and the global initializers mean that even
> though no code (in say libLLVM) is directly used you can't strip out
> the library again. I'd need to rework my build environment to try to
> get the headers without the library and that'd be a larger undertaking
> than the reverse engineering of the structs using pahole (as is
> already done in the series). So changing the patches would mean
> creating a patch series that I'd need to then do more work on to have
> work in my build environment, and I'm not sure things are any better
> by doing that. pahole was my compromise to just sidestep all of this
> without copy-pasting from header files and introducing licensing
> issues.
> 
> Anyway, what does this mean to fixing PE executables in LLVM? Perhaps
> the first 12 patches of:
> https://lore.kernel.org/lkml/20250823003216.733941-1-irogers@google.com/
> can land and then you put your changes into llvm.c there?

I'm happy to do that. I'll be largely unavailable for the next 4 weeks 
anyway, and I've still got clean-up/improvements to make to the PoC 
before it would be ready for any kind of submission. So I'm happy to 
wait and then modify my patches accordingly.

> We can
> always clean up the issues of problem (2) above as later patches -
> don't let perfect be the enemy of good. If libbfd must live-on then we
> can move it to libbfd.c so that going through the generic source
> doesn't mean wading through the libbfd code.
> 
> Anyway, I know I'm hijacking your fix to advance my own patch series.
> I'm happy with your work landing independent of it, it just seemed we
> could do the APIs more cleanly if both series landed together. I don't
> object to (I'd also be positive for) just getting PE working without
> my series. Isolating your code in the llvm.c in my series may make
> things a bit easier for you. Having both series together would allow
> the library decoupling, BPF JIT disassembly along with LLVM PE
> support.
> 
> Namhyung/Arnaldo as the barriers to entry, could you comment?
> 
> Thanks,
> Ian


  parent reply	other threads:[~2025-09-11 23:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 15:15 [PATCH 0/2] perf tools: read_build_id() blocking argument fixes James Clark
2025-09-03 15:15 ` [PATCH 1/2] perf tests: Fix "PE file support" test build James Clark
2025-09-03 16:28   ` Ian Rogers
2025-09-03 15:15 ` [PATCH 2/2] perf symbols: Fix HAVE_LIBBFD_BUILDID_SUPPORT build James Clark
2025-09-03 16:07   ` Ian Rogers
2025-09-04  8:13     ` James Clark
2025-09-04  8:27       ` Rémi Bernon
2025-09-04 14:18         ` James Clark
2025-09-04 15:53           ` Ian Rogers
2025-09-08 10:24             ` Brendan McGrath
2025-09-08 15:47               ` Ian Rogers
2025-09-08 21:15                 ` Arnaldo Carvalho de Melo
2025-09-11 23:23                 ` Brendan McGrath [this message]
2025-09-04 17:53     ` Sam James
2025-09-09 10:17       ` Guilherme Amadio
2025-09-03 15:34 ` [PATCH 0/2 v6.17-rc] perf tools: read_build_id() blocking argument fixes Arnaldo Carvalho de Melo
2025-09-03 17:47   ` Namhyung Kim

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=3e6eb24f-5557-4045-8593-bfd12e2b9cec@codeweavers.com \
    --to=bmcgrath@codeweavers.com \
    --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=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rbernon@codeweavers.com \
    --cc=sam@gentoo.org \
    /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 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.