* [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build @ 2025-11-23 12:13 René Rebe 2025-11-23 14:57 ` Christophe Leroy (CS GROUP) 0 siblings, 1 reply; 5+ messages in thread From: René Rebe @ 2025-11-23 12:13 UTC (permalink / raw) To: linux-kbuild, linuxppc-dev Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin, Christophe Leroy Building a size optimized ppc64 kernel (-Os), gcc emits more FP save/restore symbols, that the linker generates on demand into the .sfpr section. Explicitly allow-list those in scripts/mod/modpost.c, too. They are needed for the amdgpu in-kernel floating point support. MODPOST Module.symvers ERROR: modpost: "_restfpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_restfpr_26" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_restfpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_savegpr1_27" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_savegpr1_25" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_restfpr_28" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_savegpr1_29" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_savefpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_savefpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! ERROR: modpost: "_restfpr_15" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! WARNING: modpost: suppressed 56 unresolved symbol warnings because there were too many) Signed-off-by: René Rebe <rene@exactco.de> --- V2: description Theoretically for -stable, but no previous commit that broke it. --- scripts/mod/modpost.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 47c8aa2a6939..133dfa16308a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -602,6 +602,10 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname) /* Special register function linked on all modules during final link of .ko */ if (strstarts(symname, "_restgpr0_") || strstarts(symname, "_savegpr0_") || + strstarts(symname, "_restgpr1_") || + strstarts(symname, "_savegpr1_") || + strstarts(symname, "_restfpr_") || + strstarts(symname, "_savefpr_") || strstarts(symname, "_restvr_") || strstarts(symname, "_savevr_") || strcmp(symname, ".TOC.") == 0) -- 2.46.0 -- René Rebe, ExactCODE GmbH, Berlin, Germany https://exactco.de • https://t2linux.com • https://patreon.com/renerebe ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build 2025-11-23 12:13 [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build René Rebe @ 2025-11-23 14:57 ` Christophe Leroy (CS GROUP) 2025-11-23 15:09 ` René Rebe 2025-11-26 0:16 ` Erhard Furtner 0 siblings, 2 replies; 5+ messages in thread From: Christophe Leroy (CS GROUP) @ 2025-11-23 14:57 UTC (permalink / raw) To: René Rebe, linux-kbuild, linuxppc-dev Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin Le 23/11/2025 à 13:13, René Rebe a écrit : > Building a size optimized ppc64 kernel (-Os), gcc emits more FP > save/restore symbols, that the linker generates on demand into the > .sfpr section. Explicitly allow-list those in scripts/mod/modpost.c, > too. They are needed for the amdgpu in-kernel floating point support. Would have been interested to know with which version of GCC the problem started. By the way you seem to fix the problem for modules, but does it also work when amdgpu is in kernel ? I would have expected a need to add functions in arch/powerpc/lib/crtsavres.S as well, just like following commits: 8fe9c93e7453 ("powerpc: Add vr save/restore functions") 7fca5dc8aa7a ("powerpc: Fix module building for gcc 4.5 and 64 bit") da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc versions") > > MODPOST Module.symvers > ERROR: modpost: "_restfpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_restfpr_26" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_restfpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_savegpr1_27" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_savegpr1_25" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_restfpr_28" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_savegpr1_29" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_savefpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_savefpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > ERROR: modpost: "_restfpr_15" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! > WARNING: modpost: suppressed 56 unresolved symbol warnings because there were too many) > > Signed-off-by: René Rebe <rene@exactco.de> > --- > V2: description > Theoretically for -stable, but no previous commit that broke it. In that case you have to add Cc: stable@vger.kernel.org Add indeed it is likely a gcc upgrade that broke it, not a previous commit. > --- > scripts/mod/modpost.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 47c8aa2a6939..133dfa16308a 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -602,6 +602,10 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname) > /* Special register function linked on all modules during final link of .ko */ > if (strstarts(symname, "_restgpr0_") || > strstarts(symname, "_savegpr0_") || > + strstarts(symname, "_restgpr1_") || > + strstarts(symname, "_savegpr1_") || > + strstarts(symname, "_restfpr_") || > + strstarts(symname, "_savefpr_") || > strstarts(symname, "_restvr_") || > strstarts(symname, "_savevr_") || > strcmp(symname, ".TOC.") == 0) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build 2025-11-23 14:57 ` Christophe Leroy (CS GROUP) @ 2025-11-23 15:09 ` René Rebe 2025-11-23 15:25 ` René Rebe 2025-11-26 0:16 ` Erhard Furtner 1 sibling, 1 reply; 5+ messages in thread From: René Rebe @ 2025-11-23 15:09 UTC (permalink / raw) To: chleroy; +Cc: linux-kbuild, linuxppc-dev, maddy, mpe, npiggin Hi, On Sun, 23 Nov 2025 15:57:24 +0100, "Christophe Leroy (CS GROUP)" <chleroy@kernel.org> wrote: > Le 23/11/2025 à 13:13, René Rebe a écrit : > > Building a size optimized ppc64 kernel (-Os), gcc emits more FP > > save/restore symbols, that the linker generates on demand into the > > .sfpr section. Explicitly allow-list those in scripts/mod/modpost.c, > > too. They are needed for the amdgpu in-kernel floating point support. > > Would have been interested to know with which version of GCC the > problem started. idk, maybe forever, or at least a decade fo GCC? Most devs probably don't build size optimized, and addtionally we only use in kernel floating point for amdgpu since recently? Should I add Fixes: for the in-kernel FP hash? > By the way you seem to fix the problem for modules, but does it also > work when amdgpu is in kernel ? I would have expected a need to add > functions in arch/powerpc/lib/crtsavres.S as well, just like following > commits: > > 8fe9c93e7453 ("powerpc: Add vr save/restore functions") > 7fca5dc8aa7a ("powerpc: Fix module building for gcc 4.5 and 64 bit") > da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc > versions") idk, I avoid linking that big stuff directly into the kernel and would need to specically test that, too. I guess I go do that now, too, ... > > MODPOST Module.symvers > > ERROR: modpost: "_restfpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_restfpr_26" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_restfpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_savegpr1_27" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_savegpr1_25" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_restfpr_28" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_savegpr1_29" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_savefpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_savefpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > ERROR: modpost: "_restfpr_15" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > undefined! > > WARNING: modpost: suppressed 56 unresolved symbol warnings because > > there were too many) > > Signed-off-by: René Rebe <rene@exactco.de> > > --- > > V2: description > > Theoretically for -stable, but no previous commit that broke it. > > In that case you have to add Cc: stable@vger.kernel.org > Add indeed it is likely a gcc upgrade that broke it, not a previous > commit. Should I then simply use enabling amdgpu dc_fp and in-kernel FP as the breaking commit for Fixes:? Thanks! René > > --- > > scripts/mod/modpost.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > index 47c8aa2a6939..133dfa16308a 100644 > > --- a/scripts/mod/modpost.c > > +++ b/scripts/mod/modpost.c > > @@ -602,6 +602,10 @@ static int ignore_undef_symbol(struct elf_info > > *info, const char *symname) > > /* Special register function linked on all modules during final link of > > .ko */ > > if (strstarts(symname, "_restgpr0_") || > > strstarts(symname, "_savegpr0_") || > > + strstarts(symname, "_restgpr1_") || > > + strstarts(symname, "_savegpr1_") || > > + strstarts(symname, "_restfpr_") || > > + strstarts(symname, "_savefpr_") || > > strstarts(symname, "_restvr_") || > > strstarts(symname, "_savevr_") || > > strcmp(symname, ".TOC.") == 0) > -- René Rebe, ExactCODE GmbH, Berlin, Germany https://exactco.de • https://t2linux.com • https://patreon.com/renerebe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build 2025-11-23 15:09 ` René Rebe @ 2025-11-23 15:25 ` René Rebe 0 siblings, 0 replies; 5+ messages in thread From: René Rebe @ 2025-11-23 15:25 UTC (permalink / raw) To: chleroy; +Cc: linux-kbuild, linuxppc-dev, maddy, mpe, npiggin Hey, On Sun, 23 Nov 2025 16:09:41 +0100 (CET), René Rebe <rene@exactco.de> wrote: > On Sun, 23 Nov 2025 15:57:24 +0100, "Christophe Leroy (CS GROUP)" <chleroy@kernel.org> wrote: > > > Le 23/11/2025 à 13:13, René Rebe a écrit : > > > Building a size optimized ppc64 kernel (-Os), gcc emits more FP > > > save/restore symbols, that the linker generates on demand into the > > > .sfpr section. Explicitly allow-list those in scripts/mod/modpost.c, > > > too. They are needed for the amdgpu in-kernel floating point support. > > > > Would have been interested to know with which version of GCC the > > problem started. > > idk, maybe forever, or at least a decade fo GCC? Most devs probably > don't build size optimized, and addtionally we only use in kernel > floating point for amdgpu since recently? Should I add Fixes: for the > in-kernel FP hash? > > > By the way you seem to fix the problem for modules, but does it also > > work when amdgpu is in kernel ? I would have expected a need to add > > functions in arch/powerpc/lib/crtsavres.S as well, just like following > > commits: > > > > 8fe9c93e7453 ("powerpc: Add vr save/restore functions") > > 7fca5dc8aa7a ("powerpc: Fix module building for gcc 4.5 and 64 bit") > > da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc > > versions") > > idk, I avoid linking that big stuff directly into the kernel and would > need to specically test that, too. I guess I go do that now, too, ... It appears built-in amdgpu FP somehow magically works for me: debug-linux:[linux-6.17]# grep DRM.*AMD .config CONFIG_DRM_AMDGPU=y CONFIG_DRM_AMDGPU_SI=y CONFIG_DRM_AMDGPU_CIK=y CONFIG_DRM_AMDGPU_USERPTR=y CONFIG_DRM_AMD_ACP=y CONFIG_DRM_AMD_DC=y CONFIG_DRM_AMD_DC_FP=y CONFIG_DRM_AMD_DC_SI=y ... CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp_ddc.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp_log.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp_psp.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp1_execution.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp1_transition.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp2_execution.o CC drivers/gpu/drm/amd/amdgpu/../display/modules/hdcp/hdcp2_transition.o AR drivers/gpu/drm/amd/amdgpu/built-in.a AR drivers/gpu/drm/built-in.a AR drivers/gpu/built-in.a AR drivers/built-in.a AR built-in.a AR vmlinux.a LD vmlinux.o GEN modules.builtin.modinfo GEN modules.builtin MODPOST vmlinux.symvers CC .vmlinux.export.o UPD include/generated/utsversion.h CC init/version-timestamp.o KSYMS .tmp_vmlinux0.kallsyms.S AS .tmp_vmlinux0.kallsyms.o LD .tmp_vmlinux1 NM .tmp_vmlinux1.syms KSYMS .tmp_vmlinux1.kallsyms.S AS .tmp_vmlinux1.kallsyms.o LD .tmp_vmlinux2 NM .tmp_vmlinux2.syms KSYMS .tmp_vmlinux2.kallsyms.S AS .tmp_vmlinux2.kallsyms.o LD vmlinux.unstripped NM System.map SORTTAB vmlinux.unstripped make[3]: Nothing to be done for 'vmlinux.unstripped'. OBJCOPY vmlinux So I guess the patch is good to go after clarifying which kind of Fixes: to use? Thanks! René > > > MODPOST Module.symvers > > > ERROR: modpost: "_restfpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_restfpr_26" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_restfpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_savegpr1_27" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_savegpr1_25" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_restfpr_28" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_savegpr1_29" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_savefpr_20" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_savefpr_22" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > ERROR: modpost: "_restfpr_15" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] > > > undefined! > > > WARNING: modpost: suppressed 56 unresolved symbol warnings because > > > there were too many) > > > Signed-off-by: René Rebe <rene@exactco.de> > > > --- > > > V2: description > > > Theoretically for -stable, but no previous commit that broke it. > > > > In that case you have to add Cc: stable@vger.kernel.org > > Add indeed it is likely a gcc upgrade that broke it, not a previous > > commit. > > Should I then simply use enabling amdgpu dc_fp and in-kernel FP as the > breaking commit for Fixes:? > > Thanks! > > René > > > > --- > > > scripts/mod/modpost.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > > index 47c8aa2a6939..133dfa16308a 100644 > > > --- a/scripts/mod/modpost.c > > > +++ b/scripts/mod/modpost.c > > > @@ -602,6 +602,10 @@ static int ignore_undef_symbol(struct elf_info > > > *info, const char *symname) > > > /* Special register function linked on all modules during final link of > > > .ko */ > > > if (strstarts(symname, "_restgpr0_") || > > > strstarts(symname, "_savegpr0_") || > > > + strstarts(symname, "_restgpr1_") || > > > + strstarts(symname, "_savegpr1_") || > > > + strstarts(symname, "_restfpr_") || > > > + strstarts(symname, "_savefpr_") || > > > strstarts(symname, "_restvr_") || > > > strstarts(symname, "_savevr_") || > > > strcmp(symname, ".TOC.") == 0) > > > > -- > René Rebe, ExactCODE GmbH, Berlin, Germany > https://exactco.de • https://t2linux.com • https://patreon.com/renerebe -- René Rebe, ExactCODE GmbH, Berlin, Germany https://exactco.de • https://t2linux.com • https://patreon.com/renerebe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build 2025-11-23 14:57 ` Christophe Leroy (CS GROUP) 2025-11-23 15:09 ` René Rebe @ 2025-11-26 0:16 ` Erhard Furtner 1 sibling, 0 replies; 5+ messages in thread From: Erhard Furtner @ 2025-11-26 0:16 UTC (permalink / raw) To: Christophe Leroy (CS GROUP), René Rebe, linux-kbuild, linuxppc-dev Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin On 11/23/25 15:57, Christophe Leroy (CS GROUP) wrote: > > > Le 23/11/2025 à 13:13, René Rebe a écrit : >> Building a size optimized ppc64 kernel (-Os), gcc emits more FP >> save/restore symbols, that the linker generates on demand into the >> .sfpr section. Explicitly allow-list those in scripts/mod/modpost.c, >> too. They are needed for the amdgpu in-kernel floating point support. > > Would have been interested to know with which version of GCC the problem > started. I can reproduce the modpost errors on GCC 15.2 and GCC 11.5. Same kernel .config builds ok with CLANG 20.1.8 however. > By the way you seem to fix the problem for modules, but does it also > work when amdgpu is in kernel ? I would have expected a need to add > functions in arch/powerpc/lib/crtsavres.S as well, just like following > commits: If I build amdgpu statically into the kernel I don't get the modpost errors, the build finishes successfully. Only building amdgpu as module leads to these errors Rene reported. Regards, Erhard ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-26 0:16 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-23 12:13 [PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build René Rebe 2025-11-23 14:57 ` Christophe Leroy (CS GROUP) 2025-11-23 15:09 ` René Rebe 2025-11-23 15:25 ` René Rebe 2025-11-26 0:16 ` Erhard Furtner
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).