| Message ID | 20260429124752.2697484-1-adhemerval.zanella@linaro.org |
|---|---|
| State | New |
| Headers | show |
| Series | powerpc: Fix check-localplt from 99303f3871 | expand |
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.
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.
On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > 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. Do all soft-fp targets need these aliases?
On 04/05/26 17:21, H.J. Lu wrote: > On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto > <adhemerval.zanella@linaro.org> wrote: >> >> >> >> 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. > > Do all soft-fp targets need these aliases? > No, but the glibc soft-fp objects are not built for these ABI anyway.
On Tue, May 5, 2026 at 4:46 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 04/05/26 17:21, H.J. Lu wrote: > > On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto > > <adhemerval.zanella@linaro.org> wrote: > >> > >> > >> > >> 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. > > > > Do all soft-fp targets need these aliases? > > > > No, but the glibc soft-fp objects are not built for these ABI anyway. > There is sysdeps/powerpc/nofpu/Makefile:sysdep_routines += $(gcc-single-routines) $(gcc-double-routines) \ Should symbol-hacks.h changes be added to sysdeps/powerpc/nofpu, instead of sysdeps/powerpc/powerpc32?
On Tue, May 5, 2026 at 5:00 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Tue, May 5, 2026 at 4:46 AM Adhemerval Zanella Netto > <adhemerval.zanella@linaro.org> wrote: > > > > > > > > On 04/05/26 17:21, H.J. Lu wrote: > > > On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto > > > <adhemerval.zanella@linaro.org> wrote: > > >> > > >> > > >> > > >> 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. > > > > > > Do all soft-fp targets need these aliases? > > > > > > > No, but the glibc soft-fp objects are not built for these ABI anyway. > > > > There is > > sysdeps/powerpc/nofpu/Makefile:sysdep_routines += > $(gcc-single-routines) $(gcc-double-routines) \ > > Should symbol-hacks.h changes be added to sysdeps/powerpc/nofpu, > instead of sysdeps/powerpc/powerpc32? I think we need single-symbol-hacks.h in soft-fp and a target which uses $(gcc-single-routines) should just include it.
On 04/05/26 18:08, H.J. Lu wrote: > On Tue, May 5, 2026 at 5:00 AM H.J. Lu <hjl.tools@gmail.com> wrote: >> >> On Tue, May 5, 2026 at 4:46 AM Adhemerval Zanella Netto >> <adhemerval.zanella@linaro.org> wrote: >>> >>> >>> >>> On 04/05/26 17:21, H.J. Lu wrote: >>>> On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto >>>> <adhemerval.zanella@linaro.org> wrote: >>>>> >>>>> >>>>> >>>>> 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. >>>> >>>> Do all soft-fp targets need these aliases? >>>> >>> >>> No, but the glibc soft-fp objects are not built for these ABI anyway. >>> >> >> There is >> >> sysdeps/powerpc/nofpu/Makefile:sysdep_routines += >> $(gcc-single-routines) $(gcc-double-routines) \ >> >> Should symbol-hacks.h changes be added to sysdeps/powerpc/nofpu, >> instead of sysdeps/powerpc/powerpc32? > > I think we need single-symbol-hacks.h in soft-fp and a target which > uses $(gcc-single-routines) should just include it. > My point is now only powerpc requires such symbols, and it should be no future ABI that would need it. Maybe a better options would to move $(gcc-single-routines) $(gcc-double-routines) to powerpc specific folders, but I went to simplest solution.
On Tue, May 5, 2026 at 8:15 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 04/05/26 18:08, H.J. Lu wrote: > > On Tue, May 5, 2026 at 5:00 AM H.J. Lu <hjl.tools@gmail.com> wrote: > >> > >> On Tue, May 5, 2026 at 4:46 AM Adhemerval Zanella Netto > >> <adhemerval.zanella@linaro.org> wrote: > >>> > >>> > >>> > >>> On 04/05/26 17:21, H.J. Lu wrote: > >>>> On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto > >>>> <adhemerval.zanella@linaro.org> wrote: > >>>>> > >>>>> > >>>>> > >>>>> 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. > >>>> > >>>> Do all soft-fp targets need these aliases? > >>>> > >>> > >>> No, but the glibc soft-fp objects are not built for these ABI anyway. > >>> > >> > >> There is > >> > >> sysdeps/powerpc/nofpu/Makefile:sysdep_routines += > >> $(gcc-single-routines) $(gcc-double-routines) \ > >> > >> Should symbol-hacks.h changes be added to sysdeps/powerpc/nofpu, > >> instead of sysdeps/powerpc/powerpc32? > > > > I think we need single-symbol-hacks.h in soft-fp and a target which > > uses $(gcc-single-routines) should just include it. > > > > My point is now only powerpc requires such symbols, and it should be no > future ABI that would need it. Maybe a better options would to move > $(gcc-single-routines) $(gcc-double-routines) to powerpc specific folders, > but I went to simplest solution. I prefer consistency. Symbol hacks for $(gcc-single-routines) belong to sysdeps/powerpc/nofpu. Checking __NO_FPRS__ doesn't look nice.
On 05/05/26 09:27, H.J. Lu wrote: > On Tue, May 5, 2026 at 8:15 PM Adhemerval Zanella Netto > <adhemerval.zanella@linaro.org> wrote: >> >> >> >> On 04/05/26 18:08, H.J. Lu wrote: >>> On Tue, May 5, 2026 at 5:00 AM H.J. Lu <hjl.tools@gmail.com> wrote: >>>> >>>> On Tue, May 5, 2026 at 4:46 AM Adhemerval Zanella Netto >>>> <adhemerval.zanella@linaro.org> wrote: >>>>> >>>>> >>>>> >>>>> On 04/05/26 17:21, H.J. Lu wrote: >>>>>> On Mon, May 4, 2026 at 10:41 PM Adhemerval Zanella Netto >>>>>> <adhemerval.zanella@linaro.org> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> 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. >>>>>> >>>>>> Do all soft-fp targets need these aliases? >>>>>> >>>>> >>>>> No, but the glibc soft-fp objects are not built for these ABI anyway. >>>>> >>>> >>>> There is >>>> >>>> sysdeps/powerpc/nofpu/Makefile:sysdep_routines += >>>> $(gcc-single-routines) $(gcc-double-routines) \ >>>> >>>> Should symbol-hacks.h changes be added to sysdeps/powerpc/nofpu, >>>> instead of sysdeps/powerpc/powerpc32? >>> >>> I think we need single-symbol-hacks.h in soft-fp and a target which >>> uses $(gcc-single-routines) should just include it. >>> >> >> My point is now only powerpc requires such symbols, and it should be no >> future ABI that would need it. Maybe a better options would to move >> $(gcc-single-routines) $(gcc-double-routines) to powerpc specific folders, >> but I went to simplest solution. > > I prefer consistency. Symbol hacks for $(gcc-single-routines) belong to > sysdeps/powerpc/nofpu. Checking __NO_FPRS__ doesn't look nice. > Fair enough, I will update the patch with a nofpu symbol-hacks.h
On 5/5/26 7:29 AM, Adhemerval Zanella Netto wrote: > On 05/05/26 09:27, H.J. Lu wrote: >> I prefer consistency. Symbol hacks for $(gcc-single-routines) belong to >> sysdeps/powerpc/nofpu. Checking __NO_FPRS__ doesn't look nice. >> > > Fair enough, I will update the patch with a nofpu symbol-hacks.h If the patch ends up changing powerpc specific files, consider that pre-approved. Peter
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