[PATCH 0/3] tools/nolibc: add support for SuperH

Thomas Weißschuh posted 3 patches 6 months, 1 week ago
There is a newer version of this series
tools/include/nolibc/arch-sh.h              | 162 ++++++++++++++++++++++++++++
tools/include/nolibc/arch.h                 |   2 +
tools/testing/selftests/nolibc/Makefile     |  15 ++-
tools/testing/selftests/nolibc/run-tests.sh |   3 +-
4 files changed, 177 insertions(+), 5 deletions(-)
[PATCH 0/3] tools/nolibc: add support for SuperH
Posted by Thomas Weißschuh 6 months, 1 week ago
Add support for SuperH/"sh" to nolibc.
Only sh4 is tested for now.

This is only tested on QEMU so far.
Additional testing would be very welcome.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
      selftests/nolibc: fix EXTRACONFIG variables ordering
      selftests/nolibc: use file driver for QEMU serial
      tools/nolibc: add support for SuperH

 tools/include/nolibc/arch-sh.h              | 162 ++++++++++++++++++++++++++++
 tools/include/nolibc/arch.h                 |   2 +
 tools/testing/selftests/nolibc/Makefile     |  15 ++-
 tools/testing/selftests/nolibc/run-tests.sh |   3 +-
 4 files changed, 177 insertions(+), 5 deletions(-)
---
base-commit: 6275a61db2f0586b8a5d651dfc7b4aacf9d0b2d6
change-id: 20250528-nolibc-sh-8b4e3bb8efcb

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/3] tools/nolibc: add support for SuperH
Posted by Rob Landley 5 months, 3 weeks ago
On 6/9/25 04:28, Thomas Weißschuh wrote:
> Add support for SuperH/"sh" to nolibc.
> Only sh4 is tested for now.
> 
> This is only tested on QEMU so far.
> Additional testing would be very welcome.

I ran this by Jeff Dionne (the j-core architect) who said:

 > Looks correct to me.  There are no endian assumptions that I can see.

So you can put

Acked-by: Rob Landley <rob@landley.net>
Acked-by: D. Jeff Dionne <jeff@coresemi.io>

But neither of us really have a build environment set up to do much with 
it. Is there a howto for this, or is just to run the kernel tests?

Rob
Re: [PATCH 0/3] tools/nolibc: add support for SuperH
Posted by Thomas Weißschuh 5 months, 3 weeks ago
Hi Rob,

On 2025-06-24 21:41:14-0500, Rob Landley wrote:
> On 6/9/25 04:28, Thomas Weißschuh wrote:
> > Add support for SuperH/"sh" to nolibc.
> > Only sh4 is tested for now.
> > 
> > This is only tested on QEMU so far.
> > Additional testing would be very welcome.
> 
> I ran this by Jeff Dionne (the j-core architect) who said:
> 
> > Looks correct to me.  There are no endian assumptions that I can see.
> 
> So you can put
> 
> Acked-by: Rob Landley <rob@landley.net>
> Acked-by: D. Jeff Dionne <jeff@coresemi.io>

Thanks!

> But neither of us really have a build environment set up to do much with it.
> Is there a howto for this, or is just to run the kernel tests?

v2 of the series [0] has some test instructions.
These should also work with v1, except that "-f Makefile.nolibc" needs
to be removed.

$ cd tools/testings/selftests/nolibc/
$ make -f Makefile.nolibc ARCH=sh CROSS_COMPILE=sh4-linux- nolibc-test
$ file nolibc-test
nolibc-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), statically linked, not stripped
$ ./nolibc-test
Running test 'startup'
0 argc = 1                                                        [OK]
...
Total number of errors: 0
Exiting with status 0

[0] https://lore.kernel.org/lkml/20250623-nolibc-sh-v2-0-0f5b4b303025@weissschuh.net/
Re: [PATCH 0/3] tools/nolibc: add support for SuperH
Posted by John Paul Adrian Glaubitz 5 months, 3 weeks ago
Hi Thomas,

On Wed, 2025-06-25 at 16:13 +0200, Thomas Weißschuh wrote:
> > But neither of us really have a build environment set up to do much with it.
> > Is there a howto for this, or is just to run the kernel tests?
> 
> v2 of the series [0] has some test instructions.
> These should also work with v1, except that "-f Makefile.nolibc" needs
> to be removed.
> 
> $ cd tools/testings/selftests/nolibc/

There is a typo here. It should be "testing". But I guess since this text doesn't
end up in the commits anyway, it's nothing to worry about. Unless it's part of
the documentation.

> $ make -f Makefile.nolibc ARCH=sh CROSS_COMPILE=sh4-linux- nolibc-test
> $ file nolibc-test
> nolibc-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), statically linked, not stripped
> $ ./nolibc-test
> Running test 'startup'
> 0 argc = 1                                                        [OK]
> ...
> Total number of errors: 0
> Exiting with status 0

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Re: [PATCH 0/3] tools/nolibc: add support for SuperH
Posted by John Paul Adrian Glaubitz 6 months, 1 week ago
Hi Thomas,

On Mon, 2025-06-09 at 11:28 +0200, Thomas Weißschuh wrote:
> Add support for SuperH/"sh" to nolibc.
> Only sh4 is tested for now.
> 
> This is only tested on QEMU so far.
> Additional testing would be very welcome.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (3):
>       selftests/nolibc: fix EXTRACONFIG variables ordering
>       selftests/nolibc: use file driver for QEMU serial
>       tools/nolibc: add support for SuperH
> 
>  tools/include/nolibc/arch-sh.h              | 162 ++++++++++++++++++++++++++++
>  tools/include/nolibc/arch.h                 |   2 +
>  tools/testing/selftests/nolibc/Makefile     |  15 ++-
>  tools/testing/selftests/nolibc/run-tests.sh |   3 +-
>  4 files changed, 177 insertions(+), 5 deletions(-)
> ---
> base-commit: 6275a61db2f0586b8a5d651dfc7b4aacf9d0b2d6
> change-id: 20250528-nolibc-sh-8b4e3bb8efcb

I have no experience with the selftest code but I can definitely test
on real hardware if you can point me to some instructions on how to
run the tests.

CC Geert.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Re: [PATCH 0/3] tools/nolibc: add support for SuperH
Posted by Thomas Weißschuh 6 months, 1 week ago
Hi Adrian,

On 2025-06-09 11:53:25+0200, John Paul Adrian Glaubitz wrote:
> On Mon, 2025-06-09 at 11:28 +0200, Thomas Weißschuh wrote:
> > Add support for SuperH/"sh" to nolibc.
> > Only sh4 is tested for now.
> > 
> > This is only tested on QEMU so far.
> > Additional testing would be very welcome.
> > 
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > Thomas Weißschuh (3):
> >       selftests/nolibc: fix EXTRACONFIG variables ordering
> >       selftests/nolibc: use file driver for QEMU serial
> >       tools/nolibc: add support for SuperH
> > 
> >  tools/include/nolibc/arch-sh.h              | 162 ++++++++++++++++++++++++++++
> >  tools/include/nolibc/arch.h                 |   2 +
> >  tools/testing/selftests/nolibc/Makefile     |  15 ++-
> >  tools/testing/selftests/nolibc/run-tests.sh |   3 +-
> >  4 files changed, 177 insertions(+), 5 deletions(-)
> > ---
> > base-commit: 6275a61db2f0586b8a5d651dfc7b4aacf9d0b2d6
> > change-id: 20250528-nolibc-sh-8b4e3bb8efcb
> 
> I have no experience with the selftest code but I can definitely test
> on real hardware if you can point me to some instructions on how to
> run the tests.

That would be much appreciated.
You can compile the selftests like this:

$ cd tools/testing/selftests/nolibc
$ make [CC= CFLAGS_EXTRA=] nolibc-test
$ ./nolibc-test

The test executable is fully self-contained, you can also cross-compile
it and copy it around.


Thomas