[PATCH V2] modpost: Amend ppc64 save/restfpr symnames for -Os build

Christophe Leroy (CS GROUP) chleroy at kernel.org
Mon Nov 24 01:57:24 AEDT 2025



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 at exactco.de>
> ---
> V2: description
> Theoretically for -stable, but no previous commit that broke it.

In that case you have to add Cc: stable at 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)



More information about the Linuxppc-dev mailing list