diff mbox series

modpost: Skip .llvm.call-graph-profile section check

Message ID 20230822065256.163660-1-denik@chromium.org (mailing list archive)
State New, archived
Headers show
Series modpost: Skip .llvm.call-graph-profile section check | expand

Commit Message

Denis Nikitin Aug. 22, 2023, 6:52 a.m. UTC
.llvm.call-graph-profile section is added when the kernel is built with
profiles (e.g. -fprofile-sample-use=<llvm.profile>). The section holds
metadata for symbols beloning to other sections and hence doesn't need
modpost checks.

This change fixes the kernel build with sample profiles which fails
with:
"FATAL: modpost: Please add code to calculate addend for this architecture"

Signed-off-by: Denis Nikitin <denik@chromium.org>
---
 scripts/mod/modpost.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Fangrui Song Aug. 22, 2023, 7:05 a.m. UTC | #1
On Mon, Aug 21, 2023 at 11:54 PM Denis Nikitin <denik@chromium.org> wrote:
>
> .llvm.call-graph-profile section is added when the kernel is built with
> profiles (e.g. -fprofile-sample-use=<llvm.profile>).

Right. .llvm.call-graph-profile may also be added when the kernel is
built with clang -fprofile-use= (though instrumentation-based PGO
support is not upstreamed yet).

> The section holds
> metadata for symbols beloning to other sections and hence doesn't need
> modpost checks.

Typo: belonging.

.llvm.call-graph-profile 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 sample profiles which fails
> with:
> "FATAL: modpost: Please add code to calculate addend for this architecture"
>
> Signed-off-by: Denis Nikitin <denik@chromium.org>
> ---
>  scripts/mod/modpost.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index b29b29707f10..64bd13f7199c 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -761,6 +761,7 @@ static const char *const section_white_list[] =
>         ".fmt_slot*",                   /* EZchip */
>         ".gnu.lto*",
>         ".discard.*",
> +       ".llvm.call-graph-profile",     /* call graph */
>         NULL
>  };
>
> --
> 2.42.0.rc1.204.g551eb34607-goog
>
>

Otherwise the change looks good to me.
Nick Desaulniers Aug. 22, 2023, 3:47 p.m. UTC | #2
On Mon, Aug 21, 2023 at 11:54 PM Denis Nikitin <denik@chromium.org> wrote:
>
> .llvm.call-graph-profile section is added when the kernel is built with
> profiles (e.g. -fprofile-sample-use=<llvm.profile>). The section holds
> metadata for symbols beloning to other sections and hence doesn't need
> modpost checks.
>
> This change fixes the kernel build with sample profiles which fails
> with:
> "FATAL: modpost: Please add code to calculate addend for this architecture"
>
> Signed-off-by: Denis Nikitin <denik@chromium.org>

Thanks for the patch. If you send a v2 with Fangrui's suggested
changes+additions, feel free to carry forward my reviewed by tag.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  scripts/mod/modpost.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index b29b29707f10..64bd13f7199c 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -761,6 +761,7 @@ static const char *const section_white_list[] =
>         ".fmt_slot*",                   /* EZchip */
>         ".gnu.lto*",
>         ".discard.*",
> +       ".llvm.call-graph-profile",     /* call graph */
>         NULL
>  };
>
> --
> 2.42.0.rc1.204.g551eb34607-goog
>
Denis Nikitin Aug. 22, 2023, 5:17 p.m. UTC | #3
Thanks for the prompt review!

On Tue, Aug 22, 2023 at 12:06 AM Fangrui Song <maskray@google.com> wrote:
>
> On Mon, Aug 21, 2023 at 11:54 PM Denis Nikitin <denik@chromium.org> wrote:
> >
> > .llvm.call-graph-profile section is added when the kernel is built with
> > profiles (e.g. -fprofile-sample-use=<llvm.profile>).
>
> Right. .llvm.call-graph-profile may also be added when the kernel is
> built with clang -fprofile-use= (though instrumentation-based PGO
> support is not upstreamed yet).

OK, I will add -fprofile-use.

> > The section holds
> > metadata for symbols beloning to other sections and hence doesn't need
> > modpost checks.
>
> Typo: belonging.
>
> .llvm.call-graph-profile 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.

Ack.

Thanks,
Denis
Denis Nikitin Aug. 22, 2023, 5:21 p.m. UTC | #4
On Tue, Aug 22, 2023 at 8:47 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Mon, Aug 21, 2023 at 11:54 PM Denis Nikitin <denik@chromium.org> wrote:
> >
> > .llvm.call-graph-profile section is added when the kernel is built with
> > profiles (e.g. -fprofile-sample-use=<llvm.profile>). The section holds
> > metadata for symbols beloning to other sections and hence doesn't need
> > modpost checks.
> >
> > This change fixes the kernel build with sample profiles which fails
> > with:
> > "FATAL: modpost: Please add code to calculate addend for this architecture"
> >
> > Signed-off-by: Denis Nikitin <denik@chromium.org>
>
> Thanks for the patch. If you send a v2 with Fangrui's suggested
> changes+additions, feel free to carry forward my reviewed by tag.
>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>

Thanks! Will do shortly.

- Denis
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b29b29707f10..64bd13f7199c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -761,6 +761,7 @@  static const char *const section_white_list[] =
 	".fmt_slot*",			/* EZchip */
 	".gnu.lto*",
 	".discard.*",
+	".llvm.call-graph-profile",	/* call graph */
 	NULL
 };