Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-03-29 10:51:47 [+0100], Thomas Weißschuh wrote: > > Does the following work for you when running kust "make nolibc-test"? I had to manually apply this on top of b4/nolibc-mips-n32. The resulting make produced the native 64bit binary. Sebastian
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-03-26 23:04:30+0100, Sebastian Andrzej Siewior wrote: > On 2025-03-26 22:51:54 [+0100], Thomas Weißschuh wrote: > > > mips32le works as-is. > > > For mips64le I had to s/-march=mips64r6/-march=mips64r2 to match the > > > ABI. Which makes me wonder: Why do do we need to pass -march here and > > > can't rely on toolchain defaults? > > > > The goal here is to have an as-wide-as-possible test matrix for > > nolibc-test, which will mostly be running on QEMU anyways. > > Also we need to run the correct QEMU user variant; by fixing the > > architecture this is easy to do. > > I would prefer to make distro users as in real hardware first class > citizen and not QEMU users. If you run qemu you can specify the ABI > anyway. Does the following work for you when running kust "make nolibc-test"? diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 58bcbbd029bc..27d5ceb20858 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -174,10 +174,13 @@ CFLAGS_s390x = -m64 CFLAGS_s390 = -m31 CFLAGS_mips32le = -EL -mabi=32 -fPIC CFLAGS_mips32be = -EB -mabi=32 +ifeq ($(origin XARCH),command line) +CFLAGS_ARCH = $(CFLAGS_$(XARCH)) +endif CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ $(call cc-option,-fno-stack-protector) $(call cc-option,-Wmissing-prototypes) \ - $(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA) + $(CFLAGS_ARCH) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA) LDFLAGS := LIBGCC := -lgcc @@ -232,7 +235,7 @@ all: run sysroot: sysroot/$(ARCH)/include -sysroot/$(ARCH)/include: | defconfig +sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot $(Q)$(MAKE) -C $(srctree) outputmakefile
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-03-26 22:51:54 [+0100], Thomas Weißschuh wrote: > > mips32le works as-is. > > For mips64le I had to s/-march=mips64r6/-march=mips64r2 to match the > > ABI. Which makes me wonder: Why do do we need to pass -march here and > > can't rely on toolchain defaults? > > The goal here is to have an as-wide-as-possible test matrix for > nolibc-test, which will mostly be running on QEMU anyways. > Also we need to run the correct QEMU user variant; by fixing the > architecture this is easy to do. I would prefer to make distro users as in real hardware first class citizen and not QEMU users. If you run qemu you can specify the ABI anyway. > Thomas Sebastian
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-03-26 21:54:34+0100, Sebastian Andrzej Siewior wrote: > On 2025-02-25 18:02:34 [+0100], Thomas Weißschuh wrote: > > Introduce support for the N32 and N64 ABIs. As preparation, the > > entrypoint is first simplified significantly. Thanks to Maciej for all > > the valuable information. > > > > Signed-off-by: Thomas Weißschuh > > Tested-by: Sebastian Andrzej Siewior [ICT > Loongson-3] Thanks! > mips32le works as-is. > For mips64le I had to s/-march=mips64r6/-march=mips64r2 to match the > ABI. Which makes me wonder: Why do do we need to pass -march here and > can't rely on toolchain defaults? The goal here is to have an as-wide-as-possible test matrix for nolibc-test, which will mostly be running on QEMU anyways. Also we need to run the correct QEMU user variant; by fixing the architecture this is easy to do. Thomas
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-02-25 18:02:34 [+0100], Thomas Weißschuh wrote: > Introduce support for the N32 and N64 ABIs. As preparation, the > entrypoint is first simplified significantly. Thanks to Maciej for all > the valuable information. > > Signed-off-by: Thomas Weißschuh Tested-by: Sebastian Andrzej Siewior [ICT Loongson-3] mips32le works as-is. For mips64le I had to s/-march=mips64r6/-march=mips64r2 to match the ABI. Which makes me wonder: Why do do we need to pass -march here and can't rely on toolchain defaults? Sebastian
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On Sat, Mar 01, 2025 at 03:47:52PM +, Maciej W. Rozycki wrote: > On Sat, 1 Mar 2025, Willy Tarreau wrote: > > > > Introduce support for the N32 and N64 ABIs. As preparation, the > > > entrypoint is first simplified significantly. Thanks to Maciej for all > > > the valuable information. > > > > > > Signed-off-by: Thomas Weißschuh > > > --- > > > Changes in v2: > > > - Clean up entrypoint first > > > - Annotate #endifs > > > - Link to v1: > > > https://lore.kernel.org/r/20250212-nolibc-mips-n32-v1-1-6892e58d1...@weissschuh.net > > > > OK I tested this series on my glinet (MIPS 24Kc, XARCH=mips32be) and > > it worked fine, confirming that the stack alignments were not needed > > and that the cleanup is quite welcome! > > I do hope it can wait two weeks until I'm back from my holiday. I mean > to double-check the code visually and verify it with my R3000 and R4000 > hardware (the latter for n64/n32 too), both of which are less forgiving > when it comes to instruction scheduling (I can check with a 74Kf too). Oh that would be great, thank you Maciej! Willy
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On 2025-03-01 15:47:52+, Maciej W. Rozycki wrote: > On Sat, 1 Mar 2025, Willy Tarreau wrote: > > > > Introduce support for the N32 and N64 ABIs. As preparation, the > > > entrypoint is first simplified significantly. Thanks to Maciej for all > > > the valuable information. > > > > > > Signed-off-by: Thomas Weißschuh > > > --- > > > Changes in v2: > > > - Clean up entrypoint first > > > - Annotate #endifs > > > - Link to v1: > > > https://lore.kernel.org/r/20250212-nolibc-mips-n32-v1-1-6892e58d1...@weissschuh.net > > > > OK I tested this series on my glinet (MIPS 24Kc, XARCH=mips32be) and > > it worked fine, confirming that the stack alignments were not needed > > and that the cleanup is quite welcome! > > I do hope it can wait two weeks until I'm back from my holiday. Absolutely. > I mean > to double-check the code visually and verify it with my R3000 and R4000 > hardware (the latter for n64/n32 too), both of which are less forgiving > when it comes to instruction scheduling (I can check with a 74Kf too). Your testing and feedback is very valuable, I'm happy to wait for it. Thanks, Thomas
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
On Sat, 1 Mar 2025, Willy Tarreau wrote: > > Introduce support for the N32 and N64 ABIs. As preparation, the > > entrypoint is first simplified significantly. Thanks to Maciej for all > > the valuable information. > > > > Signed-off-by: Thomas Weißschuh > > --- > > Changes in v2: > > - Clean up entrypoint first > > - Annotate #endifs > > - Link to v1: > > https://lore.kernel.org/r/20250212-nolibc-mips-n32-v1-1-6892e58d1...@weissschuh.net > > OK I tested this series on my glinet (MIPS 24Kc, XARCH=mips32be) and > it worked fine, confirming that the stack alignments were not needed > and that the cleanup is quite welcome! I do hope it can wait two weeks until I'm back from my holiday. I mean to double-check the code visually and verify it with my R3000 and R4000 hardware (the latter for n64/n32 too), both of which are less forgiving when it comes to instruction scheduling (I can check with a 74Kf too). Maciej
Re: [PATCH v2 0/4] tools/nolibc: MIPS: entrypoint cleanups and N32/N64 ABIs
Hi Thomas! On Tue, Feb 25, 2025 at 06:02:34PM +0100, Thomas Weißschuh wrote: > Introduce support for the N32 and N64 ABIs. As preparation, the > entrypoint is first simplified significantly. Thanks to Maciej for all > the valuable information. > > Signed-off-by: Thomas Weißschuh > --- > Changes in v2: > - Clean up entrypoint first > - Annotate #endifs > - Link to v1: > https://lore.kernel.org/r/20250212-nolibc-mips-n32-v1-1-6892e58d1...@weissschuh.net OK I tested this series on my glinet (MIPS 24Kc, XARCH=mips32be) and it worked fine, confirming that the stack alignments were not needed and that the cleanup is quite welcome! Tested-by: Willy Tarreau Willy