Re: [PATCH] m68k: use kernel's generic libgcc functions

Greg Ungerer
2023-10-05T00:49:28Z

Hi Geert,

On 5/10/23 00:52, Geert Uytterhoeven wrote:
> Hi Greg,
>
> On Wed, Sep 13, 2023 at 9:14 AM Greg Ungerer <gerg@kernel.org> wrote:
>> From: Greg Ungerer <gerg@linux-m68k.org>
>>
>> The arch/m68k/lib versions of the libgcc functions: ashldi3, ashrdi3
>> and lshrdi3 were taken directly from an older version of gcc.
>> We can use the kernel's own generic lib versions of these - they are
>> virtually identical. Switch to those and remove the m68k local ones.
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>
> Thanks for your patch!
>
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> i.e. will queue in the m68k for-v6.7 branch.
>
>> --- a/arch/m68k/Kconfig
>> +++ b/arch/m68k/Kconfig
>> @@ -19,6 +19,9 @@ config M68K
>> select GENERIC_CPU_DEVICES
>> select GENERIC_IOMAP
>> select GENERIC_IRQ_SHOW
>> + select GENERIC_LIB_ASHLDI3
>> + select GENERIC_LIB_ASHRDI3
>> + select GENERIC_LIB_LSHRDI3
>> select HAS_IOPORT if PCI || ISA || ATARI_ROM_ISA
>> select HAVE_ARCH_SECCOMP
>> select HAVE_ARCH_SECCOMP_FILTER
>
> I guess we can select GENERIC_LIB_MULDI3 if CPU_HAS_NO_MULDIV64
> and clean up arch/m68k/lib/muldi3.c, too?

Yes, that is true.

I was hoping we might be able to do something a little more clever.
The common muldi3.c is almost identical except our local macro for
umul_ppmm(). But looking at the common lib/muldi3.c code it has been
setup to handle an arch local definition of that. I didn't spend too much
time looking at it yet, not sure where we could put that for the whole
mechanism to work though.

Regards
Greg