[PATCH] powerpc: fpr save/restore function cleanups

Michael Ellerman mpe at ellerman.id.au
Mon Nov 14 23:44:45 AEDT 2016


Nicholas Piggin <npiggin at gmail.com> writes:

> On Tue, 1 Nov 2016 15:41:12 +1100
> Nicholas Piggin <npiggin at gmail.com> wrote:
>
>> On Tue,  1 Nov 2016 15:22:19 +1100
>> Nicholas Piggin <npiggin at gmail.com> wrote:
>> 
>> > The powerpc64 linker generates fpr save/restore functions on-demand,
>> > placing them in the .sfpr section. So remove the explicitly coded ones
>> > from the 64 build.
>> > 
>> > Have 32-bit put save/restore functions into .sfpr section rather than
>> > .text, to match 64-bit.
>> > 
>> > And explicitly have the linker script place the section rather than
>> > leaving it as orphan.
>> > 
>> > Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
>> > ---
>> > 
>> > I tested this with 64-bit optimize-for-size build with modules,
>> > and that works okay.  
>> 
>> No I didn't, it's broken. I'll send an update shortly.
>
> Working (hopefully) patch this time. I also removed the 32-bit changes
> which aren't really necessary:
>
> The powerpc64 linker generates fpr save/restore functions on-demand,
> placing them in the .sfpr section. Module linking (because it's a
> "non-final" link) requires --save-restore-funcs for this.
>
> Remove the explicitly coded save/restore functions from the 64 build.
>
> And explicitly have the linker script place the section rather than
> leaving it as orphan.

>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  arch/powerpc/Makefile             |   4 +
>  arch/powerpc/boot/Makefile        |   3 +-
>  arch/powerpc/boot/crtsavres.S     |   8 +-
>  arch/powerpc/kernel/vmlinux.lds.S |   6 +
>  arch/powerpc/lib/Makefile         |   5 +-
>  arch/powerpc/lib/crtsavres.S      | 238 +-------------------------------------
>  6 files changed, 22 insertions(+), 242 deletions(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index fe76cfe..8ea7c9e 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -179,7 +179,11 @@ else
>  CHECKFLAGS	+= -D__LITTLE_ENDIAN__
>  endif
>  
> +ifeq ($(CONFIG_PPC32),y)
>  KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> +else
> +KBUILD_LDFLAGS_MODULE += --save-restore-funcs

As discussed offline, this option is reasonably new, added in 2014 and
appearing in binutils 2.25.

So it's too new to require, we can use it if it's there, but we still
need a fallback for when it's not.

cheers


More information about the Linuxppc-dev mailing list