[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ff44b8bb790c9ff2997ea0a280eb4e2445675ab8.camel@physik.fu-berlin.de>
Date: Wed, 25 Jun 2025 11:47:01 +0200
From: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
To: Thomas Weißschuh <linux@...ssschuh.net>, Yoshinori
Sato <ysato@...rs.sourceforge.jp>, Rich Felker <dalias@...c.org>, Willy
Tarreau <w@....eu>, Shuah Khan <shuah@...nel.org>
Cc: linux-sh@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 0/3] tools/nolibc: add support for SuperH
Hi Thomas,
On Mon, 2025-06-23 at 23:15 +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.
> Test instructions:
> $ 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
Here is the testrun of the nolibc-test on my SH7785LCR evaluation board:
glaubitz@...pitz:/srv/glaubitz/linux-nolibc$ cat /proc/cpuinfo
machine : SH7785LCR
processor : 0
cpu family : sh4a
cpu type : SH7785
cut : 7.x
cpu flags : fpu perfctr llsc
cache type : split (harvard)
icache size : 32KiB (4-way)
dcache size : 32KiB (4-way)
address sizes : 32 bits physical
bogomips : 599.99
glaubitz@...pitz:/srv/glaubitz/linux-nolibc$ uname -a
Linux tirpitz.buildd.org 6.5.0-rc2 #1 PREEMPT Mon Jul 17 14:17:32 UTC 2023 sh4a GNU/Linux
glaubitz@...pitz:/srv/glaubitz/linux-nolibc$ cd tools/testing/selftests/nolibc/
glaubitz@...pitz:/srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc$ make -f Makefile.nolibc ARCH=sh nolibc-test
MKDIR sysroot/sh/include
make[1]: Entering directory '/srv/glaubitz/linux-nolibc'
make[2]: Nothing to be done for 'outputmakefile'.
make[1]: Leaving directory '/srv/glaubitz/linux-nolibc'
make[1]: Entering directory '/srv/glaubitz/linux-nolibc/tools/include/nolibc'
make[2]: Entering directory '/srv/glaubitz/linux-nolibc'
UPD include/generated/uapi/linux/version.h
HOSTCC scripts/basic/fixdep
HOSTCC scripts/unifdef
WRAP arch/sh/include/generated/uapi/asm/ucontext.h
WRAP arch/sh/include/generated/uapi/asm/bitsperlong.h
WRAP arch/sh/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/sh/include/generated/uapi/asm/errno.h
WRAP arch/sh/include/generated/uapi/asm/fcntl.h
WRAP arch/sh/include/generated/uapi/asm/ioctl.h
WRAP arch/sh/include/generated/uapi/asm/ipcbuf.h
WRAP arch/sh/include/generated/uapi/asm/mman.h
(...)
HDRINST usr/include/asm/statfs.h
HDRINST usr/include/asm/types.h
HDRINST usr/include/asm/setup.h
HDRINST usr/include/asm/resource.h
HDRINST usr/include/asm/termios.h
HDRINST usr/include/asm/poll.h
make[2]: Leaving directory '/srv/glaubitz/linux-nolibc'
make[2]: Entering directory '/srv/glaubitz/linux-nolibc'
INSTALL /srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc/sysroot/sysroot/include
make[2]: Leaving directory '/srv/glaubitz/linux-nolibc'
make[1]: Leaving directory '/srv/glaubitz/linux-nolibc/tools/include/nolibc'
CC nolibc-test
In file included from sysroot/sh/include/arch.h:11,
from sysroot/sh/include/nolibc.h:96,
from sysroot/sh/include/stdio.h:8,
from nolibc-test.c:12:
sysroot/sh/include/crt.h:34:1: warning: ‘function’ attribute directive ignored [-Wattributes]
34 | {
| ^
In file included from sysroot/sh/include/arch.h:11,
from sysroot/sh/include/nolibc.h:96,
from sysroot/sh/include/errno.h:8,
from nolibc-test-linkage.c:5:
sysroot/sh/include/crt.h:34:1: warning: ‘function’ attribute directive ignored [-Wattributes]
34 | {
| ^
glaubitz@...pitz:/srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc$
glaubitz@...pitz:/srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc$ file ./nolibc-test
./nolibc-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), statically linked, BuildID[sha1]=b23b591a8deeb8b746636128821be1b577f3266b, not stripped
glaubitz@...pitz:/srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc$ ./nolibc-test
Running test 'startup'
0 argc = 1 [OK]
1 argv_addr = <0x7bd4b074> [OK]
2 argv_environ = <0x7bd4b074> [OK]
3 argv_total = 1 [OK]
4 argv0_addr = <0x7bd4b1c2> [OK]
5 argv0_str = <./nolibc-test> [OK]
6 argv0_len = 13 [OK]
7 environ_addr = <0x7bd4b07c> [OK]
8 environ_envp = <0x7bd4b07c> [OK]
9 environ_auxv = <0x7bd4b07c> [OK]
10 environ_total = 111 [OK]
11 environ_HOME = <0x7bd4b672> [OK]
12 auxv_addr = <0x7bd4b0ec> [OK]
13 auxv_AT_UID = 1000 [OK]
14 constructor = 3 [OK]
15 linkage_errno = <0x42003c> [OK]
16 linkage_constr = 3 [OK]
Errors during this test: 0
Running test 'syscall'
0 access = 0 [OK]
1 access_bad = -1 EPERM [OK]
2 clock_getres = 0 [OK]
3 clock_gettime = 0 [OK]
4 clock_settime = -1 EINVAL [OK]
5 getpid = 24641 [OK]
6 getppid = 17166 [OK]
7 gettid = 24641 [OK]
8 getpgid_self = 24641 [OK]
9 getpgid_bad = -1 ESRCH [OK]
10 kill_0 = 0 [OK]
11 kill_CONT = 0 [OK]
12 kill_BADPID = -1 ESRCH [OK]
13 sbrk_0 = <0x421000> [OK]
14 sbrk = 0 [OK]
15 brk = 0 [OK]
16 chdir_root = 0 [OK]
17 chdir_dot = 0 [OK]
18 chdir_blah = -1 ENOENT [OK]
19 chmod_argv0 = 0 [OK]
20 chmod_self = -1 EPERM [OK]
21 chown_self = -1 EPERM [OK]
22 chroot_root [SKIPPED]
23 chroot_blah = -1 ENOENT [OK]
24 chroot_exe = -1 ENOTDIR [OK]
25 close_m1 = -1 EBADF [OK]
26 close_dup = 0 [OK]
27 dup_0 = 3 [OK]
28 dup_m1 = -1 EBADF [OK]
29 dup2_0 = 100 [OK]
30 dup2_m1 = -1 EBADF [OK]
31 dup3_0 = 100 [OK]
32 dup3_m1 = -1 EBADF [OK]
33 execve_root = -1 EACCES [OK]
34 file_stream = 0 [OK]
35 fork = 0 [OK]
36 getdents64_root = 944 [OK]
37 getdents64_null = -1 ENOTDIR [OK]
38 directories = 0 [OK]
39 getrandom = 0 [OK]
40 gettimeofday_tv = 0 [OK]
41 gettimeofday_tv_tz = 0 [OK]
42 getpagesize = 0 [OK]
43 ioctl_tiocinq = 0 [OK]
44 link_root1 = -1 EEXIST [OK]
45 link_blah = -1 ENOENT [OK]
46 link_dir [SKIPPED]
47 link_cross = -1 EXDEV [OK]
48 lseek_m1 = -1 EBADF [OK]
49 lseek_0 = -1 ESPIPE [OK]
50 mkdir_root = -1 EEXIST [OK]
51 mmap_bad = <0xffffffff> EINVAL [OK]
52 munmap_bad = -1 EINVAL [OK]
53 mmap_munmap_good = 0 [OK]
54 open_tty = 3 [OK]
55 open_blah = -1 ENOENT [OK]
56 openat_dir = 0 [OK]
57 pipe = 0 [OK]
58 poll_null = 0 [OK]
59 poll_stdout = 1 [OK]
60 poll_fault = -1 EFAULT [OK]
61 prctl = -1 EFAULT [OK]
62 read_badf = -1 EBADF [OK]
63 rlimit = 0 [OK]
64 rmdir_blah = -1 ENOENT [OK]
65 sched_yield = 0 [OK]
66 select_null = 0 [OK]
67 select_stdout = 1 [OK]
68 select_fault = -1 EFAULT [OK]
69 stat_blah = -1 ENOENT [OK]
70 stat_fault = -1 EFAULT [OK]
71 stat_timestamps = 0 [OK]
72 symlink_root = -1 EEXIST [OK]
73 timer = 0 [OK]
74 timerfd = 0 [OK]
75 uname = 0 [OK]
76 uname_fault = -1 EFAULT [OK]
77 unlink_root = -1 EISDIR [OK]
78 unlink_blah = -1 ENOENT [OK]
79 wait_child = -1 ECHILD [OK]
80 waitpid_min = -1 ESRCH [OK]
81 waitpid_child = -1 ECHILD [OK]
82 write_badf = -1 EBADF [OK]
83 write_zero = 0 [OK]
84 syscall_noargs = 24641 [OK]
85 syscall_args = -1 EFAULT [OK]
86 namespace [SKIPPED]
Errors during this test: 0
Running test 'stdlib'
0 getenv_TERM = <screen.xterm-256color> [OK]
1 getenv_blah = <(null)> [OK]
2 setcmp_blah_blah = 0 [OK]
3 setcmp_blah_blah2 = -50 [OK]
4 setncmp_blah_blah = 0 [OK]
5 setncmp_blah_blah4 = 0 [OK]
6 setncmp_blah_blah5 = -53 [OK]
7 setncmp_blah_blah6 = -54 [OK]
8 strchr_foobar_o = <oobar> [OK]
9 strchr_foobar_z = <(null)> [OK]
10 strrchr_foobar_o = <obar> [OK]
11 strrchr_foobar_z = <(null)> [OK]
12 strlcat_0 = 3 <test> [OK]
13 strlcat_1 = 4 <test> [OK]
14 strlcat_5 = 7 <test> [OK]
15 strlcat_6 = 7 <testb> [OK]
16 strlcat_7 = 7 <testba> [OK]
17 strlcat_8 = 7 <testbar> [OK]
18 strlcpy_0 = 3 <test> [OK]
19 strlcpy_1 = 3 <> [OK]
20 strlcpy_2 = 3 <b> [OK]
21 strlcpy_3 = 3 <ba> [OK]
22 strlcpy_4 = 3 <bar> [OK]
23 strstr_foobar_foo = <foobar> [OK]
24 strstr_foobar_bar = <bar> [OK]
25 strstr_foobar_baz = <0x0> [OK]
26 memcmp_20_20 = 0 [OK]
27 memcmp_20_60 = -64 [OK]
28 memcmp_60_20 = 64 [OK]
29 memcmp_20_e0 = -192 [OK]
30 memcmp_e0_20 = 192 [OK]
31 memcmp_80_e0 = -96 [OK]
32 memcmp_e0_80 = 96 [OK]
33 limit_int8_max = 127 [OK]
34 limit_int8_min = -128 [OK]
35 limit_uint8_max = 255 [OK]
36 limit_int16_max = 32767 [OK]
37 limit_int16_min = -32768 [OK]
38 limit_uint16_max = 65535 [OK]
39 limit_int32_max = 2147483647 [OK]
40 limit_int32_min = -2147483648 [OK]
41 limit_uint32_max = 4294967295 [OK]
42 limit_int64_max = 9223372036854775807 [OK]
43 limit_int64_min = -9223372036854775808 [OK]
44 limit_uint64_max = -1 [OK]
45 limit_int_least8_max = 127 [OK]
46 limit_int_least8_min = -128 [OK]
47 limit_uint_least8_max = 255 [OK]
48 limit_int_least16_max = 32767 [OK]
49 limit_int_least16_min = -32768 [OK]
50 limit_uint_least16_max = 65535 [OK]
51 limit_int_least32_max = 2147483647 [OK]
52 limit_int_least32_min = -2147483648 [OK]
53 limit_uint_least32_max = 4294967295 [OK]
54 limit_int_least64_min = -9223372036854775808 [OK]
55 limit_int_least64_max = 9223372036854775807 [OK]
56 limit_uint_least64_max = -1 [OK]
57 limit_int_fast8_max = 127 [OK]
58 limit_int_fast8_min = -128 [OK]
59 limit_uint_fast8_max = 255 [OK]
60 limit_int_fast16_min = -2147483648 [OK]
61 limit_int_fast16_max = 2147483647 [OK]
62 limit_uint_fast16_max = 4294967295 [OK]
63 limit_int_fast32_min = -2147483648 [OK]
64 limit_int_fast32_max = 2147483647 [OK]
65 limit_uint_fast32_max = 4294967295 [OK]
66 limit_int_fast64_min = -9223372036854775808 [OK]
67 limit_int_fast64_max = 9223372036854775807 [OK]
68 limit_uint_fast64_max = -1 [OK]
69 sizeof_long_sane = 1 [OK]
70 limit_intptr_min = -2147483648 [OK]
71 limit_intptr_max = 2147483647 [OK]
72 limit_uintptr_max = 4294967295 [OK]
73 limit_ptrdiff_min = -2147483648 [OK]
74 limit_ptrdiff_max = 2147483647 [OK]
75 limit_size_max = 4294967295 [OK]
76 strtol_simple 35 = 35 [OK]
77 strtol_positive 35 = 35 [OK]
78 strtol_negative -35 = -35 [OK]
79 strtol_hex_auto 255 = 255 [OK]
80 strtol_base36 50507 = 50507 [OK]
81 strtol_cutoff 342391 = 342391 [OK]
82 strtol_octal_auto 9 = 9 [OK]
83 strtol_hex_00 0 = 0 [OK]
84 strtol_hex_FF 255 = 255 [OK]
85 strtol_hex_ff 255 = 255 [OK]
86 strtol_hex_prefix 255 = 255 [OK]
87 strtol_trailer 35 = 35 [OK]
88 strtol_overflow 2147483647 = 2147483647 [OK]
89 strtol_underflow -2147483648 = -2147483648 [OK]
90 strtoul_negative 4294967295 = 4294967295 [OK]
91 strtoul_overflow 4294967295 = 4294967295 [OK]
92 strerror_success = <errno=0> [OK]
93 strerror_EINVAL = <errno=22> [OK]
94 strerror_int_max = <errno=2147483647> [OK]
95 strerror_int_min = <errno=-2147483648> [OK]
96 tolower = 97 [OK]
97 tolower_noop = 97 [OK]
98 toupper = 65 [OK]
99 toupper_noop = 65 [OK]
100 abs = 10 [OK]
101 abs_noop = 10 [OK]
102 difftime = 0 [OK]
Errors during this test: 0
Running test 'printf'
0 empty "" = "" [OK]
1 simple "foo" = "foo" [OK]
2 string "foo" = "foo" [OK]
3 number "1234" = "1234" [OK]
4 negnumber "-1234" = "-1234" [OK]
5 unsigned "12345" = "12345" [OK]
6 char "c" = "c" [OK]
7 hex "f" = "f" [OK]
8 pointer "0x1" = "0x1" [OK]
9 uintmax_t "18446744073709551615" = "18446744073709551615" [OK]
10 intmax_t "-9223372036854775807" = "-9223372036854775807" [OK]
11 truncation "01234567890123456789" = "01234567890123456789" [OK]
12 string_width " 1" = " 1" [OK]
13 number_width " 1" = " 1" [OK]
14 width_trunc " " = " " [OK]
15 scanf = 0 [OK]
16 strerror = 0 [OK]
Errors during this test: 0
Running test 'protection'
0 -fstackprotector [OK]
Errors during this test: 0
Total number of errors: 0
Exiting with status 0
glaubitz@...pitz:/srv/glaubitz/linux-nolibc/tools/testing/selftests/nolibc$
Tested-by: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Powered by blists - more mailing lists