new musl libc release 1.2.4 (2023-05-01) (was Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1))

2023-05-02 Thread Bastian Bittorf
On Sun, Feb 12, 2023 at 05:34:43PM -0500, Rich Felker wrote:
> On Sun, Feb 12, 2023 at 08:17:04AM +, Bastian Bittorf wrote:
> > On Sat, Feb 11, 2023 at 02:30:44PM -0500, Rich Felker wrote:
> > > > >   .hidden __hwcap
> > > > >   .long __hwcap-.
> > > > > -1:   mflr 4
> > > > > - lwz 5, 0(4)
> > > > > - lwzx 4, 4, 5
> > > > > - andis. 4, 4, 0x80
> > > > > +1:   mflr 6
> > > > > + lwz 5, 0(6)
> > > > > + lwzx 6, 6, 5
> > > > > + andis. 6, 6, 0x80
> > > > >   beq 1f
> > > > >   .long 0x11c35b01 /* evldd 14,88(3) */
> > > > >   .long 0x11e36301 /* ... */
> > 
> > It works!

New musl release including this fix is out:
https://musl.libc.org/releases/musl-1.2.4.tar.gz

Is anybody already working on upgrading musl for OpenWRT?

bye, bastian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-12 Thread Rich Felker
On Sun, Feb 12, 2023 at 08:17:04AM +, Bastian Bittorf wrote:
> On Sat, Feb 11, 2023 at 02:30:44PM -0500, Rich Felker wrote:
> > > > .hidden __hwcap
> > > > .long __hwcap-.
> > > > -1: mflr 4
> > > > -   lwz 5, 0(4)
> > > > -   lwzx 4, 4, 5
> > > > -   andis. 4, 4, 0x80
> > > > +1: mflr 6
> > > > +   lwz 5, 0(6)
> > > > +   lwzx 6, 6, 5
> > > > +   andis. 6, 6, 0x80
> > > > beq 1f
> > > > .long 0x11c35b01 /* evldd 14,88(3) */
> > > > .long 0x11e36301 /* ... */
> 
> It works!
> 
> ~ # test A -gt 5 && echo OK
> ash: A: out of range
> ~ # echo $?
> 2
> ~ # uname -a
> Linux (none) 6.1.11 #1 Sun Feb 12 09:06:57 CET 2023 ppc GNU/Linux
> 
> In the end i directly changed the sourcecode,  
> using the patchdir did not work an my side, i'am sure
> a made a mistake here.
> 
> Anyway - i'am happy!
> Is there some more, where i can help/test?
> 
> I uploaded kernel + busybox/initrd for qemu here:
> http://intercity-vpn.de/mpc85xx/musl-1.2.3+ppcpatch/

Thanks for following up. I'll go ahead and include this change for the
upcoming release.

Rich

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-12 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 02:30:44PM -0500, Rich Felker wrote:
> > >   .hidden __hwcap
> > >   .long __hwcap-.
> > > -1:   mflr 4
> > > - lwz 5, 0(4)
> > > - lwzx 4, 4, 5
> > > - andis. 4, 4, 0x80
> > > +1:   mflr 6
> > > + lwz 5, 0(6)
> > > + lwzx 6, 6, 5
> > > + andis. 6, 6, 0x80
> > >   beq 1f
> > >   .long 0x11c35b01 /* evldd 14,88(3) */
> > >   .long 0x11e36301 /* ... */

It works!

~ # test A -gt 5 && echo OK
ash: A: out of range
~ # echo $?
2
~ # uname -a
Linux (none) 6.1.11 #1 Sun Feb 12 09:06:57 CET 2023 ppc GNU/Linux

In the end i directly changed the sourcecode,  
using the patchdir did not work an my side, i'am sure
a made a mistake here.

Anyway - i'am happy!
Is there some more, where i can help/test?

I uploaded kernel + busybox/initrd for qemu here:
http://intercity-vpn.de/mpc85xx/musl-1.2.3+ppcpatch/

bye, Bastian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Rich Felker
On Sat, Feb 11, 2023 at 07:27:39PM +, Bastian Bittorf wrote:
> On Sat, Feb 11, 2023 at 09:01:03AM -0500, Rich Felker wrote:
> > It looks like the powerpc spe longjmp code is clobbering the value
> > argument. Try the attached patch.
> 
> > diff --git a/src/setjmp/powerpc/longjmp.S b/src/setjmp/powerpc/longjmp.S
> > index 611389fe..465e4cd7 100644
> > --- a/src/setjmp/powerpc/longjmp.S
> > +++ b/src/setjmp/powerpc/longjmp.S
> > @@ -42,10 +42,10 @@ longjmp:
> > bl 1f
> > .hidden __hwcap
> > .long __hwcap-.
> > -1: mflr 4
> > -   lwz 5, 0(4)
> > -   lwzx 4, 4, 5
> > -   andis. 4, 4, 0x80
> > +1: mflr 6
> > +   lwz 5, 0(6)
> > +   lwzx 6, 6, 5
> > +   andis. 6, 6, 0x80
> > beq 1f
> > .long 0x11c35b01 /* evldd 14,88(3) */
> > .long 0x11e36301 /* ... */
> 
> Thanks a lot, this looked promising!, but
> sorry, it does NOT solve the issue:
> 
> Using musl-cross-make and this file in
> patches/musl-1.2.0/ppc-spe-longjmp-fix.diff
> i compiled an output/bin/powerpc-linux-muslsf*
> crosscompiler with:
> make TARGET=powerpc-linux-muslsf install
> and used it for further steps...
> 
> maybe the patch did not applied?  
> let me sleep about it...
> 
> Thanks a lot, Bastian

If busybox is static linked, you need to be sure you're linking
against the new libc.a built with the patch applied. If it's dynamic
linked, you need to make sure the shared libc is installed on the
system (but you can use the newly-built patched libc.so *as a command*
to run the dynamic busybox binary and test it).

Rich

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 09:01:03AM -0500, Rich Felker wrote:
> It looks like the powerpc spe longjmp code is clobbering the value
> argument. Try the attached patch.

> diff --git a/src/setjmp/powerpc/longjmp.S b/src/setjmp/powerpc/longjmp.S
> index 611389fe..465e4cd7 100644
> --- a/src/setjmp/powerpc/longjmp.S
> +++ b/src/setjmp/powerpc/longjmp.S
> @@ -42,10 +42,10 @@ longjmp:
>   bl 1f
>   .hidden __hwcap
>   .long __hwcap-.
> -1:   mflr 4
> - lwz 5, 0(4)
> - lwzx 4, 4, 5
> - andis. 4, 4, 0x80
> +1:   mflr 6
> + lwz 5, 0(6)
> + lwzx 6, 6, 5
> + andis. 6, 6, 0x80
>   beq 1f
>   .long 0x11c35b01 /* evldd 14,88(3) */
>   .long 0x11e36301 /* ... */

Thanks a lot, this looked promising!, but
sorry, it does NOT solve the issue:

Using musl-cross-make and this file in
patches/musl-1.2.0/ppc-spe-longjmp-fix.diff
i compiled an output/bin/powerpc-linux-muslsf*
crosscompiler with:
make TARGET=powerpc-linux-muslsf install
and used it for further steps...

maybe the patch did not applied?  
let me sleep about it...

Thanks a lot, Bastian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 12:51:47PM +, Bastian Bittorf wrote:
> With OpenWRT i recognized a strange behavior of ash-shell scripts.
> It happens only on target PowerPC, e.g. m68k, arm, mips, x86 are
> unaffected.

to be more clear:
it seems to affect musl, but not glibc build.

bye, Bastian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Rich Felker
On Sat, Feb 11, 2023 at 12:51:47PM +, Bastian Bittorf wrote:
> With OpenWRT i recognized a strange behavior of ash-shell scripts.
> It happens only on target PowerPC, e.g. m68k, arm, mips, x86 are
> unaffected.
> 
> The visible strange behavior in 'ash' is:
> 
> $ test A -gt 5 && echo OK
> ash: A: out of range
> OK
> 
> Ofcourse this wrong returncode leads to all sorts of things...
> 
> I tested several busybox releases (1.33.2, 1.35.0, 1.36.0) and
> crosscompiled with musl-git-b76f37f (from musl.cc) and 
> crosscompiled with glibc: powerpc-linux-gnu-gcc (Debian-12.2.0)
> (it's the same for all versions)
> 
> The resulting linux + busybox images ready for QEMU are here:
> http://intercity-vpn.de/mpc85xx/
> 
> If needed i can provide build instructions.
> Maybe somebody with more powerpc assembly knowledge can help here.
> 
> The underlying code is here:  
> https://git.busybox.net/busybox/tree/coreutils/test.c#n488
> But i can not spot the error:
> 
> static number_t getn(const char *s)
> {
>   char *p;
>   errno = 0;
>   r = strtol(s, , 10);
>   if (errno != 0)
> syntax(s, "out of range");
>   return r;
> }
> 
> Best Greetings,
> Bastian Bittorf

It looks like the powerpc spe longjmp code is clobbering the value
argument. Try the attached patch.
diff --git a/src/setjmp/powerpc/longjmp.S b/src/setjmp/powerpc/longjmp.S
index 611389fe..465e4cd7 100644
--- a/src/setjmp/powerpc/longjmp.S
+++ b/src/setjmp/powerpc/longjmp.S
@@ -42,10 +42,10 @@ longjmp:
bl 1f
.hidden __hwcap
.long __hwcap-.
-1: mflr 4
-   lwz 5, 0(4)
-   lwzx 4, 4, 5
-   andis. 4, 4, 0x80
+1: mflr 6
+   lwz 5, 0(6)
+   lwzx 6, 6, 5
+   andis. 6, 6, 0x80
beq 1f
.long 0x11c35b01 /* evldd 14,88(3) */
.long 0x11e36301 /* ... */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel