linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fāng-ruì Sòng" <maskray@google.com>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Leo Yan <leo.yan@linaro.org>, Michael Petlan <mpetlan@redhat.com>,
	Sedat Dilek <sedat.dilek@gmail.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH 2/2] perf clang: Fixes for more recent LLVM/clang
Date: Mon, 11 Oct 2021 16:49:13 -0700	[thread overview]
Message-ID: <CAFP8O3Km7dDR5i=aOiEAH6kM_jXA0uAvo4hZvPgm43UR3MdYYw@mail.gmail.com> (raw)
In-Reply-To: <CAP-5=fX9czHvqwj9DGABe8M59Rck17U9kDMhAgwxHn_L=D04zw@mail.gmail.com>

On Mon, Oct 11, 2021 at 4:35 PM Ian Rogers <irogers@google.com> wrote:
>
> On Mon, Oct 11, 2021 at 4:24 PM Ian Rogers <irogers@google.com> wrote:
> >
> > The parameters to two functions and the location of a variable have
> > changed in more recent LLVM/clang releases.
> >
> > Tested with LLVM 6, 8, 9, 10 and 11.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/perf/util/c++/clang.cpp | 20 +++++++++++++-------
> >  1 file changed, 13 insertions(+), 7 deletions(-)
> >
> > diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
> > index c8885dfa3667..756200cb80b1 100644
> > --- a/tools/perf/util/c++/clang.cpp
> > +++ b/tools/perf/util/c++/clang.cpp
> > @@ -44,7 +44,6 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
> >                 "-triple", "bpf-pc-linux",
> >                 "-fsyntax-only",
> >                 "-ferror-limit", "19",
> > -               "-fmessage-length", "127",
>
> Sorry, missed from the commit message. I removed this flag to format
> output down to 127 columns as with clang 11 I see in perf test:
>
> 58: builtin clang support                                           :
> 58.1: builtin clang compile C source to IR                          :
> --- start ---
> test child forked, pid 279307
> error: unknown argument: '-fmessage-length'
> 1 error generated.
> test child finished with -1
>
> The flag isn't necessary for correct operation.

Right, I changed the -cc1 option from Separate-form -fmessage-length
to -fmessage-length= in 2020-03.
-ferror-limit can be deleted as well.

> Thanks,
> Ian
>
> >                 "-O2",
> >                 "-nostdsysteminc",
> >                 "-nobuiltininc",
> > @@ -55,7 +54,11 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
> >                 "-x", "c"};
> >
> >         CCArgs.append(CFlags.begin(), CFlags.end());
> > -       CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs);
> > +       CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs
> > +#if CLANG_VERSION_MAJOR >= 11
> > +                                                        ,/*BinaryName=*/nullptr
> > +#endif
> > +                                                        );
> >
> >         FrontendOptions& Opts = CI->getFrontendOpts();
> >         Opts.Inputs.clear();
> > @@ -151,13 +154,16 @@ getBPFObjectFromModule(llvm::Module *Module)
> >
> >         legacy::PassManager PM;
> >         bool NotAdded;
> > -#if CLANG_VERSION_MAJOR < 7
> > -       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
> > -                                                     TargetMachine::CGFT_ObjectFile);
> > +       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream
> > +#if CLANG_VERSION_MAJOR >= 7
> > +                                                      , /*DwoOut=*/nullptr
> > +#endif
> > +#if CLANG_VERSION_MAJOR < 10
> > +                                                      , TargetMachine::CGFT_ObjectFile
> >  #else
> > -       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
> > -                                                     TargetMachine::CGFT_ObjectFile);
> > +                                                      , llvm::CGFT_ObjectFile
> >  #endif
> > +                                                      );
> >         if (NotAdded) {
> >                 llvm::errs() << "TargetMachine can't emit a file of this type\n";
> >                 return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);
> > --
> > 2.33.0.882.g93a45727a2-goog
> >

Related, does it make sense to drop CLANG_VERSION_MAJOR<7 support?

  reply	other threads:[~2021-10-11 23:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 23:24 [PATCH 1/2] tools: Bump minimum LLVM C++ std to GNU++14 Ian Rogers
2021-10-11 23:24 ` [PATCH 2/2] perf clang: Fixes for more recent LLVM/clang Ian Rogers
2021-10-11 23:35   ` Ian Rogers
2021-10-11 23:49     ` Fāng-ruì Sòng [this message]
2021-10-12  2:17       ` Ian Rogers
2021-11-12 10:24 Ma Xinjian
2021-11-12 15:35 ` Ian Rogers
2021-11-12 18:43 ` Arnaldo Carvalho de Melo

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='CAFP8O3Km7dDR5i=aOiEAH6kM_jXA0uAvo4hZvPgm43UR3MdYYw@mail.gmail.com' \
    --to=maskray@google.com \
    --cc=Mark.Rutland@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=daniel@iogearbox.net \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=sedat.dilek@gmail.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;
as well as URLs for NNTP newsgroup(s).