[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFP8O3Lm_nDTPcvLyA-kkwnuiTNnv+s3hEf3dneUU3s0Th_-hA@mail.gmail.com>
Date: Wed, 23 Aug 2023 23:13:18 -0700
From: Fangrui Song <maskray@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Denis Nikitin <denik@...omium.org>, linux-kbuild@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>, Tom Rix <trix@...hat.com>,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
Douglas Anderson <dianders@...omium.org>
Subject: Re: [PATCH v2] modpost: Skip .llvm.call-graph-profile section check
On Wed, Aug 23, 2023 at 6:34 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> On Thu, Aug 24, 2023 at 8:30 AM Denis Nikitin <denik@...omium.org> wrote:
> >
> > On Wed, Aug 23, 2023 at 4:02 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
> > >
> > > On Wed, Aug 23, 2023 at 3:00 AM Fangrui Song <maskray@...gle.com> wrote:
> > > >
> > > > On Tue, Aug 22, 2023 at 10:49 AM Denis Nikitin <denik@...omium.org> wrote:
> > > > >
> > > > > .llvm.call-graph-profile section is added by clang when the kernel is
> > > > > built with profiles (e.g. -fprofile-sample-use= or -fprofile-use=).
> > > > >
> > > > > The section contains edge information derived from text sections,
> > > > > so .llvm.call-graph-profile itself doesn't need more analysis as
> > > > > the text sections have been analyzed.
> > > > >
> > > > > This change fixes the kernel build with clang and a sample profile
> > > > > which currently fails with:
> > > > >
> > > > > "FATAL: modpost: Please add code to calculate addend for this architecture"
> > >
> > >
> > > Curious.
> > >
> > > This message is only displayed for REL.
> > >
> > > (Please not it is located in section_rel() function)
> > >
> > >
> > > I think modern architectures use RELA instead of REL.
> > > Which architecture are we talking about?
> >
> > Aarch64. There was also a report on x86-64 but the error message could be
> > different there.
> >
> > >
> > >
> > > What does the output of this command look like?
> > >
> > > $ llvm-readelf -S vmlinux.o | grep .llvm.call-graph-profile
> > >
> > >
> > > Is it REL?
> > >
> >
> > [119] .llvm.call-graph-profile LLVM_CALL_GRAPH_PROFILE 0000000000000000
> > 1c74a458 0104c8 08 E 0 0 1
> > [120] .rel.llvm.call-graph-profile REL 0000000000000000 1c75a920 041320 10
> > I 26090 119 8
>
>
> Fangrui,
>
> Aarch64 uses RELA for other sections, but REL for this one.
>
> I'd like to confirm if this is an expectation, not a toolchain bug.
Hi Masahiro,
Yes, using REL is intentional. It makes the relocations of
.llvm.call-graph-profile smaller.
The format encodes the (from,to,count) information with
* the section content holds 'count'
* two R_*_NONE relocations hold 'from' and 'to'. The addend field is
unused, therefore REL is better.
--
宋方睿
Powered by blists - more mailing lists