[PATCH] powerpc: Fix check-localplt from 99303f3871
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon May 4 14:41:23 GMT 2026
On 04/05/26 10:56, H.J. Lu wrote:
> On Wed, Apr 29, 2026 at 8:48 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> The misc/hash.c uses floating-point operations and powerpc softfp
>> also exports the same libgcc symbols, which creates extra PLT calls.
>> Use the same hack from divdi3-symbol-hacks.h to route such calls
>> internally.
>>
>> Checked with build/check for powerpc-linux-gnu-soft.
>> ---
>> soft-fp/fixunssfsi.c | 1 +
>> soft-fp/gesf2.c | 1 +
>> soft-fp/lesf2.c | 2 ++
>> sysdeps/powerpc/powerpc32/symbol-hacks.h | 8 ++++++++
>> 4 files changed, 12 insertions(+)
>>
>> diff --git a/soft-fp/fixunssfsi.c b/soft-fp/fixunssfsi.c
>> index 9e883a9769..1b17b04852 100644
>> --- a/soft-fp/fixunssfsi.c
>> +++ b/soft-fp/fixunssfsi.c
>> @@ -43,3 +43,4 @@ __fixunssfsi (SFtype a)
>>
>> return r;
>> }
>> +strong_alias (__fixunssfsi, __fixunssfsi_internal)
>> diff --git a/soft-fp/gesf2.c b/soft-fp/gesf2.c
>> index f7289982f1..455bb75d34 100644
>> --- a/soft-fp/gesf2.c
>> +++ b/soft-fp/gesf2.c
>> @@ -47,3 +47,4 @@ __gesf2 (SFtype a, SFtype b)
>> }
>>
>> strong_alias (__gesf2, __gtsf2);
>> +strong_alias (__gesf2, __gesf2_internal)
>> diff --git a/soft-fp/lesf2.c b/soft-fp/lesf2.c
>> index 2f4921f3ce..3b40b3c9b8 100644
>> --- a/soft-fp/lesf2.c
>> +++ b/soft-fp/lesf2.c
>> @@ -47,3 +47,5 @@ __lesf2 (SFtype a, SFtype b)
>> }
>>
>> strong_alias (__lesf2, __ltsf2);
>> +strong_alias (__lesf2, __lesf2_internal);
>> +strong_alias (__ltsf2, __ltsf2_internal);
>> diff --git a/sysdeps/powerpc/powerpc32/symbol-hacks.h b/sysdeps/powerpc/powerpc32/symbol-hacks.h
>> index 1faf282601..6f85c16bb8 100644
>> --- a/sysdeps/powerpc/powerpc32/symbol-hacks.h
>> +++ b/sysdeps/powerpc/powerpc32/symbol-hacks.h
>> @@ -19,3 +19,11 @@
>> #include <sysdeps/wordsize-32/divdi3-symbol-hacks.h>
>>
>> #include_next "symbol-hacks.h"
>> +
>> +#if !defined __ASSEMBLER__ \
>> + && IS_IN (libc) && defined SHARED && defined __NO_FPRS__
>> +asm ("__fixunssfsi = __fixunssfsi_internal");
>> +asm ("__ltsf2 = __ltsf2_internal");
>> +asm ("__lesf2 = __lesf2_internal");
>> +asm ("__gesf2 = __gesf2_internal");
>> +#endif
>> --
>> 2.43.0
>>
>
> I think we should follow sysdeps/wordsize-32/divdi3-symbol-hacks.h to
> define aliases and implement the symbol hack only if needed by defining
> a unique macro when compiling the function definition.
I though about it, but these libgcc interfaces were a historical mistake and
only required for powerpc-linux-gnu-soft (other soft-fp ABIs, like
csky-linux-gnuabiv2-soft, m68k-linux-gnu-coldfire-soft, mips*-linux-gnu-soft,
or1k-linux-gnu-soft, sh4-linux-gnu-soft import its usage on libgcc).
So I went to the simplest solution.
More information about the Libc-alpha
mailing list