Re: [PATCH 1/2] perf build: Autodetect minimum required llvm-dev version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 10, 2024 at 03:27:16PM +0100, Quentin Monnet wrote:
> 2024-09-10 15:04 UTC+0100 ~ James Clark <james.clark@xxxxxxxxxx>
> > The new LLVM addr2line feature requires a minimum version of 13 to
> > compile. Add a feature check for the version so that NO_LLVM=1 doesn't
> > need to be explicitly added. Leave the existing llvm feature check
> > intact because it's used by tools other than Perf.
> > 
> > This fixes the following compilation error when the llvm-dev version
> > doesn't match:
> > 
> >    util/llvm-c-helpers.cpp: In function 'char* llvm_name_for_code(dso*, const char*, u64)':
> >    util/llvm-c-helpers.cpp:178:21: error: 'std::remove_reference_t<llvm::DILineInfo>' {aka 'struct llvm::DILineInfo'} has no member named 'StartAddress'
> >      178 |   addr, res_or_err->StartAddress ? *res_or_err->StartAddress : 0);
> > 
> > Fixes: c3f8644c21df ("perf report: Support LLVM for addr2line()")
> > Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
> > ---
> >   tools/build/Makefile.feature           |  2 +-
> >   tools/build/feature/Makefile           |  9 +++++++++
> >   tools/build/feature/test-llvm-perf.cpp | 14 ++++++++++++++
> >   tools/perf/Makefile.config             |  6 +++---
> >   4 files changed, 27 insertions(+), 4 deletions(-)
> >   create mode 100644 tools/build/feature/test-llvm-perf.cpp
> > 
> > diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> > index 0717e96d6a0e..427a9389e26c 100644
> > --- a/tools/build/Makefile.feature
> > +++ b/tools/build/Makefile.feature
> > @@ -136,7 +136,7 @@ FEATURE_DISPLAY ?=              \
> >            libunwind              \
> >            libdw-dwarf-unwind     \
> >            libcapstone            \
> > -         llvm                   \
> > +         llvm-perf              \
 
> Hi! Just a quick question, why remove "llvm" from the list, here?

Right, having it here is still interesting, if not for perf, for some
other tool in tools/ that uses this:

⬢[acme@toolbox perf-tools-next]$ cat tools/build/feature/test-llvm.cpp
// SPDX-License-Identifier: GPL-2.0
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/raw_ostream.h"
#define NUM_VERSION (((LLVM_VERSION_MAJOR) << 16) + (LLVM_VERSION_MINOR << 8) + LLVM_VERSION_PATCH)

#if NUM_VERSION < 0x030900
# error "LLVM version too low"
#endif
int main()
{
	llvm::errs() << "Hello World!\n";
	llvm::llvm_shutdown();
	return 0;
}
⬢[acme@toolbox perf-tools-next]$

My understanding about James intention is that for perf we need at least
llvm-dev 13, but he kept the other feature test for other projects.


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux