* [PATCH 0/3] tools/nolibc: add support for 32-bit parisc
@ 2026-04-07 16:37 Thomas Weißschuh
2026-04-07 16:37 ` [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Thomas Weißschuh
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-04-07 16:37 UTC (permalink / raw)
To: James E.J. Bottomley, Helge Deller, Willy Tarreau
Cc: linux-kernel, linux-parisc, Thomas Weißschuh
Extend nolibc to target the 32-bit parisc architecture.
64-bit is not yet supported.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
parisc: Makefile: use the regular compiler to build a native 32-bit vDSO
selftests/nolibc: avoid function pointer comparisons
tools/nolibc: add support for 32-bit parisc
arch/parisc/Makefile | 4 +
tools/include/nolibc/Makefile | 2 +-
tools/include/nolibc/arch-parisc.h | 178 +++++++++++++++++++++++++
tools/include/nolibc/arch.h | 2 +
tools/testing/selftests/nolibc/Makefile.nolibc | 6 +
tools/testing/selftests/nolibc/nolibc-test.c | 13 +-
tools/testing/selftests/nolibc/run-tests.sh | 4 +-
7 files changed, 203 insertions(+), 6 deletions(-)
---
base-commit: 65191c9bf8fdd00f8fe90e2caab330418eefb786
change-id: 20250804-nolibc-hppa-8c137b00ecf2
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 16:37 [PATCH 0/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh @ 2026-04-07 16:37 ` Thomas Weißschuh 2026-04-07 17:14 ` Helge Deller 2026-04-07 16:37 ` [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 3/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 16:37 UTC (permalink / raw) To: James E.J. Bottomley, Helge Deller, Willy Tarreau Cc: linux-kernel, linux-parisc, Thomas Weißschuh When building a native 32-bit kernel $(CC) the compiler is obviously able to compile 32-bit code. There is no need to force the user to configure a dedicated 32-bit compiler. Use the regular compiler for the 32-bit vDSO when it is sufficient. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- arch/parisc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 48ae3c79557a..57320e1d8396 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -39,6 +39,7 @@ endif export LD_BFD +ifdef CONFIG_64BIT # Set default 32 bits cross compilers for vdso. # This means that for 64BIT, both the 64-bit tools and the 32-bit tools # need to be in the path. @@ -48,6 +49,9 @@ CROSS32_COMPILE := $(call cc-cross-prefix, \ $(foreach a,$(CC_ARCHES_32), \ $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) CROSS32CC := $(CROSS32_COMPILE)gcc +else +CROSS32CC := $(CC) +endif export CROSS32CC # Set default cross compiler for kernel build -- 2.53.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 16:37 ` [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Thomas Weißschuh @ 2026-04-07 17:14 ` Helge Deller 2026-04-07 18:06 ` Thomas Weißschuh 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 17:14 UTC (permalink / raw) To: Thomas Weißschuh, James E.J. Bottomley, Willy Tarreau Cc: linux-kernel, linux-parisc Hi Thomas, On 4/7/26 18:37, Thomas Weißschuh wrote: > When building a native 32-bit kernel $(CC) the compiler is obviously > able to compile 32-bit code. There is no need to force the user to > configure a dedicated 32-bit compiler. > > Use the regular compiler for the 32-bit vDSO when it is sufficient. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> This part is quite fragile, especially since the kernel is often also cross built... I can add the series to for-next branch of the parisc git tree to see if this breaks somewhere. (unless you take care of it at another git tree?) Helge > --- > arch/parisc/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile > index 48ae3c79557a..57320e1d8396 100644 > --- a/arch/parisc/Makefile > +++ b/arch/parisc/Makefile > @@ -39,6 +39,7 @@ endif > > export LD_BFD > > +ifdef CONFIG_64BIT > # Set default 32 bits cross compilers for vdso. > # This means that for 64BIT, both the 64-bit tools and the 32-bit tools > # need to be in the path. > @@ -48,6 +49,9 @@ CROSS32_COMPILE := $(call cc-cross-prefix, \ > $(foreach a,$(CC_ARCHES_32), \ > $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) > CROSS32CC := $(CROSS32_COMPILE)gcc > +else > +CROSS32CC := $(CC) > +endif > export CROSS32CC > > # Set default cross compiler for kernel build > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 17:14 ` Helge Deller @ 2026-04-07 18:06 ` Thomas Weißschuh 2026-04-07 19:27 ` Helge Deller 0 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 18:06 UTC (permalink / raw) To: Helge Deller Cc: James E.J. Bottomley, Willy Tarreau, linux-kernel, linux-parisc Hi Helge, On 2026-04-07 19:14:23+0200, Helge Deller wrote: > On 4/7/26 18:37, Thomas Weißschuh wrote: > > When building a native 32-bit kernel $(CC) the compiler is obviously > > able to compile 32-bit code. There is no need to force the user to > > configure a dedicated 32-bit compiler. > > > > Use the regular compiler for the 32-bit vDSO when it is sufficient. > > > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > > This part is quite fragile, especially since the kernel is often also > cross built... I also used this patch during cross-building and it worked so far. > I can add the series to for-next branch of the parisc git tree to see if this > breaks somewhere. (unless you take care of it at another git tree?) I'd like to take the nolibc patches through the nolibc tree. If you want to take the Makefile patch through your tree into the v7.1 merge window that would also work, as I will only apply these patches for the next v7.2 cycle. Thomas ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 18:06 ` Thomas Weißschuh @ 2026-04-07 19:27 ` Helge Deller 2026-04-07 20:20 ` Helge Deller 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 19:27 UTC (permalink / raw) To: Thomas Weißschuh Cc: James E.J. Bottomley, Willy Tarreau, linux-kernel, linux-parisc On 4/7/26 20:06, Thomas Weißschuh wrote: > Hi Helge, > > On 2026-04-07 19:14:23+0200, Helge Deller wrote: >> On 4/7/26 18:37, Thomas Weißschuh wrote: >>> When building a native 32-bit kernel $(CC) the compiler is obviously >>> able to compile 32-bit code. There is no need to force the user to >>> configure a dedicated 32-bit compiler. >>> >>> Use the regular compiler for the 32-bit vDSO when it is sufficient. >>> >>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> >> >> This part is quite fragile, especially since the kernel is often also >> cross built... > > I also used this patch during cross-building and it worked so far. > >> I can add the series to for-next branch of the parisc git tree to see if this >> breaks somewhere. (unless you take care of it at another git tree?) > > I'd like to take the nolibc patches through the nolibc tree. > If you want to take the Makefile patch through your tree into the v7.1 > merge window that would also work, as I will only apply these patches > for the next v7.2 cycle. Ok I'll add patch #1 the to the parisc tree... Helge ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 19:27 ` Helge Deller @ 2026-04-07 20:20 ` Helge Deller 2026-04-07 21:27 ` Thomas Weißschuh 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 20:20 UTC (permalink / raw) To: Thomas Weißschuh; +Cc: linux-kernel, linux-parisc On 4/7/26 21:27, Helge Deller wrote: > On 4/7/26 20:06, Thomas Weißschuh wrote: >> Hi Helge, >> >> On 2026-04-07 19:14:23+0200, Helge Deller wrote: >>> On 4/7/26 18:37, Thomas Weißschuh wrote: >>>> When building a native 32-bit kernel $(CC) the compiler is obviously >>>> able to compile 32-bit code. There is no need to force the user to >>>> configure a dedicated 32-bit compiler. >>>> >>>> Use the regular compiler for the 32-bit vDSO when it is sufficient. >>>> >>>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> >>> >>> This part is quite fragile, especially since the kernel is often also >>> cross built... >> >> I also used this patch during cross-building and it worked so far. >> >>> I can add the series to for-next branch of the parisc git tree to see if this >>> breaks somewhere. (unless you take care of it at another git tree?) >> >> I'd like to take the nolibc patches through the nolibc tree. >> If you want to take the Makefile patch through your tree into the v7.1 >> merge window that would also work, as I will only apply these patches >> for the next v7.2 cycle. > Ok I'll add patch #1 the to the parisc tree... As I assumed.... it breaks immediately for me. On an x86-64, running "make ARCH=parisc palo" doesn't work. I think you set the "CROSS_COMPILE" variables. Just leave them out.... Helge ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 20:20 ` Helge Deller @ 2026-04-07 21:27 ` Thomas Weißschuh 2026-04-07 22:33 ` Helge Deller 0 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 21:27 UTC (permalink / raw) To: Helge Deller; +Cc: linux-kernel, linux-parisc On 2026-04-07 22:20:34+0200, Helge Deller wrote: > On 4/7/26 21:27, Helge Deller wrote: > > On 4/7/26 20:06, Thomas Weißschuh wrote: > > > Hi Helge, > > > > > > On 2026-04-07 19:14:23+0200, Helge Deller wrote: > > > > On 4/7/26 18:37, Thomas Weißschuh wrote: > > > > > When building a native 32-bit kernel $(CC) the compiler is obviously > > > > > able to compile 32-bit code. There is no need to force the user to > > > > > configure a dedicated 32-bit compiler. > > > > > > > > > > Use the regular compiler for the 32-bit vDSO when it is sufficient. > > > > > > > > > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > > > > > > > > This part is quite fragile, especially since the kernel is often also > > > > cross built... > > > > > > I also used this patch during cross-building and it worked so far. > > > > > > > I can add the series to for-next branch of the parisc git tree to see if this > > > > breaks somewhere. (unless you take care of it at another git tree?) > > > > > > I'd like to take the nolibc patches through the nolibc tree. > > > If you want to take the Makefile patch through your tree into the v7.1 > > > merge window that would also work, as I will only apply these patches > > > for the next v7.2 cycle. > > Ok I'll add patch #1 the to the parisc tree... > As I assumed.... it breaks immediately for me. > On an x86-64, running "make ARCH=parisc palo" doesn't work. > I think you set the "CROSS_COMPILE" variables. Just leave them out.... Then let's ignore this series for this cycle. How are you configuring your compiler? Thomas ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO 2026-04-07 21:27 ` Thomas Weißschuh @ 2026-04-07 22:33 ` Helge Deller 0 siblings, 0 replies; 16+ messages in thread From: Helge Deller @ 2026-04-07 22:33 UTC (permalink / raw) To: Thomas Weißschuh; +Cc: linux-kernel, linux-parisc On 4/7/26 23:27, Thomas Weißschuh wrote: > On 2026-04-07 22:20:34+0200, Helge Deller wrote: >> On 4/7/26 21:27, Helge Deller wrote: >>> On 4/7/26 20:06, Thomas Weißschuh wrote: >>>> Hi Helge, >>>> >>>> On 2026-04-07 19:14:23+0200, Helge Deller wrote: >>>>> On 4/7/26 18:37, Thomas Weißschuh wrote: >>>>>> When building a native 32-bit kernel $(CC) the compiler is obviously >>>>>> able to compile 32-bit code. There is no need to force the user to >>>>>> configure a dedicated 32-bit compiler. >>>>>> >>>>>> Use the regular compiler for the 32-bit vDSO when it is sufficient. >>>>>> >>>>>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> >>>>> >>>>> This part is quite fragile, especially since the kernel is often also >>>>> cross built... >>>> >>>> I also used this patch during cross-building and it worked so far. >>>> >>>>> I can add the series to for-next branch of the parisc git tree to see if this >>>>> breaks somewhere. (unless you take care of it at another git tree?) >>>> >>>> I'd like to take the nolibc patches through the nolibc tree. >>>> If you want to take the Makefile patch through your tree into the v7.1 >>>> merge window that would also work, as I will only apply these patches >>>> for the next v7.2 cycle. >>> Ok I'll add patch #1 the to the parisc tree... >> As I assumed.... it breaks immediately for me. >> On an x86-64, running "make ARCH=parisc palo" doesn't work. >> I think you set the "CROSS_COMPILE" variables. Just leave them out.... > > Then let's ignore this series for this cycle. Ok. > How are you configuring your compiler? Haven't configured since long time, because the default cross compilers from Fedora and Debian just work. I think 0-day team does build own compiler. By the way... I just sent a patch series to the parisc mailing list which allows building the 64-bit kernel with COMPAT=n. Helge ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons 2026-04-07 16:37 [PATCH 0/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Thomas Weißschuh @ 2026-04-07 16:37 ` Thomas Weißschuh 2026-04-07 17:20 ` Helge Deller 2026-04-07 16:37 ` [PATCH 3/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 16:37 UTC (permalink / raw) To: James E.J. Bottomley, Helge Deller, Willy Tarreau Cc: linux-kernel, linux-parisc, Thomas Weißschuh The upcoming parisc support would require libgcc to implement function pointer comparisons. As we try to avoid the libgcc dependency rework the logic to work without such comparisons. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- tools/testing/selftests/nolibc/nolibc-test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index d3c4facb54c0..de4e87586d75 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -647,20 +647,25 @@ int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const return 0; } +enum strtox_func { + strtox_func_strtol, + strtox_func_strtoul, +}; + #define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_errno) \ - do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, func, input, base, expected, chars, expected_errno); } while (0) + do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, strtox_func_ ## func, input, base, expected, chars, expected_errno); } while (0) static __attribute__((unused)) -int expect_strtox(int llen, void *func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno) +int expect_strtox(int llen, enum strtox_func func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno) { char *endptr; int actual_errno, actual_chars; intmax_t r; errno = 0; - if (func == strtol) { + if (func == strtox_func_strtol) { r = strtol(input, &endptr, base); - } else if (func == strtoul) { + } else if (func == strtox_func_strtoul) { r = strtoul(input, &endptr, base); } else { result(llen, FAIL); -- 2.53.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons 2026-04-07 16:37 ` [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons Thomas Weißschuh @ 2026-04-07 17:20 ` Helge Deller 2026-04-07 18:11 ` Thomas Weißschuh 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 17:20 UTC (permalink / raw) To: Thomas Weißschuh, James E.J. Bottomley, Willy Tarreau Cc: linux-kernel, linux-parisc On 4/7/26 18:37, Thomas Weißschuh wrote: > The upcoming parisc support would require libgcc to implement function > pointer comparisons. As we try to avoid the libgcc dependency rework > the logic to work without such comparisons. Instead of working around at this specific code, I think it makes more sense to simply add the __canonicalize_funcptr_for_compare() symbol somewhere. Code is in arch/parisc/kernel/real2.S: ENTRY_CFI(__canonicalize_funcptr_for_compare) #ifdef CONFIG_64BIT bve (%r2) #else bv %r0(%r2) #endif copy %r26,%r28 ENDPROC_CFI(__canonicalize_funcptr_for_compare) Or am I missing something? Btw, since you want to avoid libgcc, I think this is quite hard, since gcc automatically adds lots of parisc specific millicode functions (see the "$$" symbols in parisc_ksyms.c) and many of the gcc helper functions (e.g. __muldi3). So, I'm not sure if it makes sense to try to avoid libgcc.... Helge > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > --- > tools/testing/selftests/nolibc/nolibc-test.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > index d3c4facb54c0..de4e87586d75 100644 > --- a/tools/testing/selftests/nolibc/nolibc-test.c > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > @@ -647,20 +647,25 @@ int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const > return 0; > } > > +enum strtox_func { > + strtox_func_strtol, > + strtox_func_strtoul, > +}; > + > #define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_errno) \ > - do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, func, input, base, expected, chars, expected_errno); } while (0) > + do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, strtox_func_ ## func, input, base, expected, chars, expected_errno); } while (0) > > static __attribute__((unused)) > -int expect_strtox(int llen, void *func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno) > +int expect_strtox(int llen, enum strtox_func func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno) > { > char *endptr; > int actual_errno, actual_chars; > intmax_t r; > > errno = 0; > - if (func == strtol) { > + if (func == strtox_func_strtol) { > r = strtol(input, &endptr, base); > - } else if (func == strtoul) { > + } else if (func == strtox_func_strtoul) { > r = strtoul(input, &endptr, base); > } else { > result(llen, FAIL); > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons 2026-04-07 17:20 ` Helge Deller @ 2026-04-07 18:11 ` Thomas Weißschuh 0 siblings, 0 replies; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 18:11 UTC (permalink / raw) To: Helge Deller Cc: James E.J. Bottomley, Willy Tarreau, linux-kernel, linux-parisc On 2026-04-07 19:20:12+0200, Helge Deller wrote: > On 4/7/26 18:37, Thomas Weißschuh wrote: > > The upcoming parisc support would require libgcc to implement function > > pointer comparisons. As we try to avoid the libgcc dependency rework > > the logic to work without such comparisons. > > Instead of working around at this specific code, I think it makes more sense > to simply add the __canonicalize_funcptr_for_compare() symbol somewhere. > Code is in arch/parisc/kernel/real2.S: > ENTRY_CFI(__canonicalize_funcptr_for_compare) > #ifdef CONFIG_64BIT > bve (%r2) > #else > bv %r0(%r2) > #endif > copy %r26,%r28 > ENDPROC_CFI(__canonicalize_funcptr_for_compare) > > Or am I missing something? nolibc is license more liberally than the rest of the kernel. So lifting code from there is problematic. Also users should still be able to use libgcc if they so desire, so this function could conflict. > Btw, since you want to avoid libgcc, I think this is quite hard, since > gcc automatically adds lots of parisc specific millicode functions (see the "$$" symbols > in parisc_ksyms.c) and many of the gcc helper functions (e.g. __muldi3). The only one I ran into was $$dyncall. But that was mitigated by using --mfast-indirect-calls. This option does not support shared libraries or nested functions, but both are irrelevant for nolibc anyways. > So, I'm not sure if it makes sense to try to avoid libgcc.... It works for the current version of nolibc-test. If a user uses features that do require libgcc support then they can always just use it. We only want to avoid forcing it on users. Thomas ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/3] tools/nolibc: add support for 32-bit parisc 2026-04-07 16:37 [PATCH 0/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons Thomas Weißschuh @ 2026-04-07 16:37 ` Thomas Weißschuh 2026-04-07 17:33 ` Helge Deller 2 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 16:37 UTC (permalink / raw) To: James E.J. Bottomley, Helge Deller, Willy Tarreau Cc: linux-kernel, linux-parisc, Thomas Weißschuh Extend nolibc to target the 32-bit parisc architecture. 64-bit is not yet supported. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- tools/include/nolibc/Makefile | 2 +- tools/include/nolibc/arch-parisc.h | 178 +++++++++++++++++++++++++ tools/include/nolibc/arch.h | 2 + tools/testing/selftests/nolibc/Makefile.nolibc | 6 + tools/testing/selftests/nolibc/run-tests.sh | 4 +- 5 files changed, 190 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile index 7455097cff69..81187126bf93 100644 --- a/tools/include/nolibc/Makefile +++ b/tools/include/nolibc/Makefile @@ -17,7 +17,7 @@ endif # it defaults to this nolibc directory. OUTPUT ?= $(CURDIR)/ -architectures := arm arm64 loongarch m68k mips powerpc riscv s390 sh sparc x86 +architectures := arm arm64 loongarch m68k mips parisc powerpc riscv s390 sh sparc x86 arch_files := arch.h $(addsuffix .h, $(addprefix arch-, $(architectures))) all_files := \ byteswap.h \ diff --git a/tools/include/nolibc/arch-parisc.h b/tools/include/nolibc/arch-parisc.h new file mode 100644 index 000000000000..5918f45132bb --- /dev/null +++ b/tools/include/nolibc/arch-parisc.h @@ -0,0 +1,178 @@ +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ +/* + * parisc/hppa (32 and 64) specific definitions for NOLIBC + * Copyright (C) 2026 Thomas Weißschuh <linux@weissschuh.net> + */ + +#ifndef _NOLIBC_ARCH_PARISC_H +#define _NOLIBC_ARCH_PARISC_H + +#if defined(__LP64__) +#error 64-bit not supported +#endif + +#include "compiler.h" +#include "crt.h" + +/* Syscalls for parisc : + * - syscall number is passed in r20 + * - arguments are in r26 to r21 + * - the system call is performed by calling "ble 0x100(%sr2, %r0)", + * the instruction after that is executed first, use it to load the number + * - syscall return comes in r28 + * - the arguments are cast to long and assigned into the target + * registers which are then simply passed as registers to the asm code, + * so that we don't have to experience issues with register constraints. + */ + +#define _NOLIBC_SYSCALL_CLOBBERLIST \ + "memory", "%r1", "%r2", "%r4", "%r20", "%r29", "%r31" + +#define __nolibc_syscall0(num) \ +({ \ + register long _ret __asm__ ("r28"); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %1, %%r20\n\t" \ + : "=r"(_ret) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall1(num, arg1) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %2, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall2(num, arg1, arg2) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + register long _arg2 __asm__ ("r25") = (long)(arg2); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %3, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1), "+r"(_arg2) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall3(num, arg1, arg2, arg3) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + register long _arg2 __asm__ ("r25") = (long)(arg2); \ + register long _arg3 __asm__ ("r24") = (long)(arg3); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %4, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall4(num, arg1, arg2, arg3, arg4) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + register long _arg2 __asm__ ("r25") = (long)(arg2); \ + register long _arg3 __asm__ ("r24") = (long)(arg3); \ + register long _arg4 __asm__ ("r23") = (long)(arg4); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %5, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + register long _arg2 __asm__ ("r25") = (long)(arg2); \ + register long _arg3 __asm__ ("r24") = (long)(arg3); \ + register long _arg4 __asm__ ("r23") = (long)(arg4); \ + register long _arg5 __asm__ ("r22") = (long)(arg5); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %6, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ + "+r"(_arg5) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ +({ \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") = (long)(arg1); \ + register long _arg2 __asm__ ("r25") = (long)(arg2); \ + register long _arg3 __asm__ ("r24") = (long)(arg3); \ + register long _arg4 __asm__ ("r23") = (long)(arg4); \ + register long _arg5 __asm__ ("r22") = (long)(arg5); \ + register long _arg6 __asm__ ("r21") = (long)(arg6); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %7, %%r20\n\t" \ + : "=r"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ + "+r"(_arg5), "+r"(_arg6) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#ifndef NOLIBC_NO_RUNTIME +/* startup code */ +void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void) +{ + __asm__ volatile ( + ".import $global$\n" /* Set up the dp register */ + "ldil L%$global$, %dp\n" + "ldo R%$global$(%r27), %dp\n" + + "ldo -4(%r24), %r26\n" /* The sp register is special on parisc. + * r24 points to argv. Subtract 4 to get &argc. + * Pass that as first argument to _start_c. + */ + + "b,n _start_c\n" + ); + __nolibc_entrypoint_epilogue(); +} +#endif /* NOLIBC_NO_RUNTIME */ + +#endif /* _NOLIBC_ARCH_PARISC_H */ diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h index a3adaf433f2c..6dc45a78e972 100644 --- a/tools/include/nolibc/arch.h +++ b/tools/include/nolibc/arch.h @@ -28,6 +28,8 @@ #include "arch-m68k.h" #elif defined(__sh__) #include "arch-sh.h" +#elif defined(__hppa__) +#include "arch-parisc.h" #else #error Unsupported Architecture #endif diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc index f30bc68470cc..e9494f3cbc03 100644 --- a/tools/testing/selftests/nolibc/Makefile.nolibc +++ b/tools/testing/selftests/nolibc/Makefile.nolibc @@ -64,6 +64,7 @@ ARCH_s390x = s390 ARCH_sparc32 = sparc ARCH_sparc64 = sparc ARCH_sh4 = sh +ARCH_parisc32 = parisc ARCH := $(or $(ARCH_$(XARCH)),$(XARCH)) # kernel image names by architecture @@ -92,6 +93,7 @@ IMAGE_sparc32 = arch/sparc/boot/image IMAGE_sparc64 = arch/sparc/boot/image IMAGE_m68k = vmlinux IMAGE_sh4 = arch/sh/boot/zImage +IMAGE_parisc32 = vmlinux IMAGE = $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) @@ -121,6 +123,7 @@ DEFCONFIG_sparc32 = sparc32_defconfig DEFCONFIG_sparc64 = sparc64_defconfig DEFCONFIG_m68k = virt_defconfig DEFCONFIG_sh4 = rts7751r2dplus_defconfig +DEFCONFIG_parisc32 = defconfig DEFCONFIG = $(DEFCONFIG_$(XARCH)) EXTRACONFIG_x32 = -e CONFIG_X86_X32_ABI @@ -159,6 +162,7 @@ QEMU_ARCH_sparc32 = sparc QEMU_ARCH_sparc64 = sparc64 QEMU_ARCH_m68k = m68k QEMU_ARCH_sh4 = sh4 +QEMU_ARCH_parisc32 = hppa QEMU_ARCH = $(QEMU_ARCH_$(XARCH)) QEMU_ARCH_USER_ppc64le = ppc64le @@ -199,6 +203,7 @@ QEMU_ARGS_sparc32 = -M SS-5 -m 256M -append "console=ttyS0,115200 panic=-1 $( QEMU_ARGS_sparc64 = -M sun4u -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_m68k = -M virt -append "console=ttyGF0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_sh4 = -M r2d -serial file:/dev/stdout -append "console=ttySC1,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" +QEMU_ARGS_parisc32 = -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS = -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_ARGS_EXTRA) # OUTPUT is only set when run from the main makefile, otherwise @@ -215,6 +220,7 @@ CFLAGS_i386 = $(call cc-option,-m32) CFLAGS_x32 = -mx32 CFLAGS_arm = -marm CFLAGS_armthumb = -mthumb -march=armv6t2 +CFLAGS_parisc32 = -mfast-indirect-calls CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh index 3917cfb8fdc4..981a680cebfb 100755 --- a/tools/testing/selftests/nolibc/run-tests.sh +++ b/tools/testing/selftests/nolibc/run-tests.sh @@ -28,6 +28,7 @@ all_archs=( sparc32 sparc64 m68k sh4 + parisc32 ) archs="${all_archs[@]}" @@ -116,6 +117,7 @@ crosstool_arch() { s390*) echo s390;; sparc*) echo sparc64;; x32*) echo x86_64;; + parisc32) echo hppa;; *) echo "$1";; esac } @@ -185,7 +187,7 @@ test_arch() { exit 1 esac printf '%-15s' "$arch:" - if [ "$arch" = "m68k" -o "$arch" = "sh4" ] && [ "$llvm" = "1" ]; then + if [ "$arch" = "m68k" -o "$arch" = "sh4" -o "$arch" = "parisc32" ] && [ "$llvm" = "1" ]; then echo "Unsupported configuration" return fi -- 2.53.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] tools/nolibc: add support for 32-bit parisc 2026-04-07 16:37 ` [PATCH 3/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh @ 2026-04-07 17:33 ` Helge Deller 2026-04-07 18:14 ` Thomas Weißschuh 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 17:33 UTC (permalink / raw) To: Thomas Weißschuh, James E.J. Bottomley, Willy Tarreau, John David Anglin Cc: linux-kernel, linux-parisc On 4/7/26 18:37, Thomas Weißschuh wrote: > Extend nolibc to target the 32-bit parisc architecture. > 64-bit is not yet supported. Adding 64-bit would be very cool. Dave Anglin is currently working on adding 64-bit userspace support to gcc/glibc (dynamic loader), but that takes some time. In the meantime a 64-bit nolibc would be cool for testing. Helge > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > --- > tools/include/nolibc/Makefile | 2 +- > tools/include/nolibc/arch-parisc.h | 178 +++++++++++++++++++++++++ > tools/include/nolibc/arch.h | 2 + > tools/testing/selftests/nolibc/Makefile.nolibc | 6 + > tools/testing/selftests/nolibc/run-tests.sh | 4 +- > 5 files changed, 190 insertions(+), 2 deletions(-) > > diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile > index 7455097cff69..81187126bf93 100644 > --- a/tools/include/nolibc/Makefile > +++ b/tools/include/nolibc/Makefile > @@ -17,7 +17,7 @@ endif > # it defaults to this nolibc directory. > OUTPUT ?= $(CURDIR)/ > > -architectures := arm arm64 loongarch m68k mips powerpc riscv s390 sh sparc x86 > +architectures := arm arm64 loongarch m68k mips parisc powerpc riscv s390 sh sparc x86 > arch_files := arch.h $(addsuffix .h, $(addprefix arch-, $(architectures))) > all_files := \ > byteswap.h \ > diff --git a/tools/include/nolibc/arch-parisc.h b/tools/include/nolibc/arch-parisc.h > new file mode 100644 > index 000000000000..5918f45132bb > --- /dev/null > +++ b/tools/include/nolibc/arch-parisc.h > @@ -0,0 +1,178 @@ > +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ > +/* > + * parisc/hppa (32 and 64) specific definitions for NOLIBC > + * Copyright (C) 2026 Thomas Weißschuh <linux@weissschuh.net> > + */ > + > +#ifndef _NOLIBC_ARCH_PARISC_H > +#define _NOLIBC_ARCH_PARISC_H > + > +#if defined(__LP64__) > +#error 64-bit not supported > +#endif > + > +#include "compiler.h" > +#include "crt.h" > + > +/* Syscalls for parisc : > + * - syscall number is passed in r20 > + * - arguments are in r26 to r21 > + * - the system call is performed by calling "ble 0x100(%sr2, %r0)", > + * the instruction after that is executed first, use it to load the number > + * - syscall return comes in r28 > + * - the arguments are cast to long and assigned into the target > + * registers which are then simply passed as registers to the asm code, > + * so that we don't have to experience issues with register constraints. > + */ > + > +#define _NOLIBC_SYSCALL_CLOBBERLIST \ > + "memory", "%r1", "%r2", "%r4", "%r20", "%r29", "%r31" > + > +#define __nolibc_syscall0(num) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %1, %%r20\n\t" \ > + : "=r"(_ret) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall1(num, arg1) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %2, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall2(num, arg1, arg2) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + register long _arg2 __asm__ ("r25") = (long)(arg2); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %3, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1), "+r"(_arg2) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall3(num, arg1, arg2, arg3) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + register long _arg2 __asm__ ("r25") = (long)(arg2); \ > + register long _arg3 __asm__ ("r24") = (long)(arg3); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %4, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall4(num, arg1, arg2, arg3, arg4) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + register long _arg2 __asm__ ("r25") = (long)(arg2); \ > + register long _arg3 __asm__ ("r24") = (long)(arg3); \ > + register long _arg4 __asm__ ("r23") = (long)(arg4); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %5, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + register long _arg2 __asm__ ("r25") = (long)(arg2); \ > + register long _arg3 __asm__ ("r24") = (long)(arg3); \ > + register long _arg4 __asm__ ("r23") = (long)(arg4); \ > + register long _arg5 __asm__ ("r22") = (long)(arg5); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %6, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ > + "+r"(_arg5) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#define __nolibc_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ > +({ \ > + register long _ret __asm__ ("r28"); \ > + register long _arg1 __asm__ ("r26") = (long)(arg1); \ > + register long _arg2 __asm__ ("r25") = (long)(arg2); \ > + register long _arg3 __asm__ ("r24") = (long)(arg3); \ > + register long _arg4 __asm__ ("r23") = (long)(arg4); \ > + register long _arg5 __asm__ ("r22") = (long)(arg5); \ > + register long _arg6 __asm__ ("r21") = (long)(arg6); \ > + \ > + __asm__ volatile ( \ > + "ble 0x100(%%sr2, %%r0)\n\t" \ > + "ldi %7, %%r20\n\t" \ > + : "=r"(_ret), \ > + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ > + "+r"(_arg5), "+r"(_arg6) \ > + : "i"(num) \ > + : _NOLIBC_SYSCALL_CLOBBERLIST \ > + ); \ > + _ret; \ > +}) > + > +#ifndef NOLIBC_NO_RUNTIME > +/* startup code */ > +void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void) > +{ > + __asm__ volatile ( > + ".import $global$\n" /* Set up the dp register */ > + "ldil L%$global$, %dp\n" > + "ldo R%$global$(%r27), %dp\n" > + > + "ldo -4(%r24), %r26\n" /* The sp register is special on parisc. > + * r24 points to argv. Subtract 4 to get &argc. > + * Pass that as first argument to _start_c. > + */ > + > + "b,n _start_c\n" > + ); > + __nolibc_entrypoint_epilogue(); > +} > +#endif /* NOLIBC_NO_RUNTIME */ > + > +#endif /* _NOLIBC_ARCH_PARISC_H */ > diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h > index a3adaf433f2c..6dc45a78e972 100644 > --- a/tools/include/nolibc/arch.h > +++ b/tools/include/nolibc/arch.h > @@ -28,6 +28,8 @@ > #include "arch-m68k.h" > #elif defined(__sh__) > #include "arch-sh.h" > +#elif defined(__hppa__) > +#include "arch-parisc.h" > #else > #error Unsupported Architecture > #endif > diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc > index f30bc68470cc..e9494f3cbc03 100644 > --- a/tools/testing/selftests/nolibc/Makefile.nolibc > +++ b/tools/testing/selftests/nolibc/Makefile.nolibc > @@ -64,6 +64,7 @@ ARCH_s390x = s390 > ARCH_sparc32 = sparc > ARCH_sparc64 = sparc > ARCH_sh4 = sh > +ARCH_parisc32 = parisc > ARCH := $(or $(ARCH_$(XARCH)),$(XARCH)) > > # kernel image names by architecture > @@ -92,6 +93,7 @@ IMAGE_sparc32 = arch/sparc/boot/image > IMAGE_sparc64 = arch/sparc/boot/image > IMAGE_m68k = vmlinux > IMAGE_sh4 = arch/sh/boot/zImage > +IMAGE_parisc32 = vmlinux > IMAGE = $(objtree)/$(IMAGE_$(XARCH)) > IMAGE_NAME = $(notdir $(IMAGE)) > > @@ -121,6 +123,7 @@ DEFCONFIG_sparc32 = sparc32_defconfig > DEFCONFIG_sparc64 = sparc64_defconfig > DEFCONFIG_m68k = virt_defconfig > DEFCONFIG_sh4 = rts7751r2dplus_defconfig > +DEFCONFIG_parisc32 = defconfig > DEFCONFIG = $(DEFCONFIG_$(XARCH)) > > EXTRACONFIG_x32 = -e CONFIG_X86_X32_ABI > @@ -159,6 +162,7 @@ QEMU_ARCH_sparc32 = sparc > QEMU_ARCH_sparc64 = sparc64 > QEMU_ARCH_m68k = m68k > QEMU_ARCH_sh4 = sh4 > +QEMU_ARCH_parisc32 = hppa > QEMU_ARCH = $(QEMU_ARCH_$(XARCH)) > > QEMU_ARCH_USER_ppc64le = ppc64le > @@ -199,6 +203,7 @@ QEMU_ARGS_sparc32 = -M SS-5 -m 256M -append "console=ttyS0,115200 panic=-1 $( > QEMU_ARGS_sparc64 = -M sun4u -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_m68k = -M virt -append "console=ttyGF0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_sh4 = -M r2d -serial file:/dev/stdout -append "console=ttySC1,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > +QEMU_ARGS_parisc32 = -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" Does it make sense to use the qemu "-nographic" option for parisc (and some other architectures) ? That way everything runs much faster on the text console, and (at least) for parisc you don't need the "console=ttyS0" entry. > QEMU_ARGS = -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_ARGS_EXTRA) > > # OUTPUT is only set when run from the main makefile, otherwise > @@ -215,6 +220,7 @@ CFLAGS_i386 = $(call cc-option,-m32) > CFLAGS_x32 = -mx32 > CFLAGS_arm = -marm > CFLAGS_armthumb = -mthumb -march=armv6t2 > +CFLAGS_parisc32 = -mfast-indirect-calls > CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) > CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) > CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) > diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh > index 3917cfb8fdc4..981a680cebfb 100755 > --- a/tools/testing/selftests/nolibc/run-tests.sh > +++ b/tools/testing/selftests/nolibc/run-tests.sh > @@ -28,6 +28,7 @@ all_archs=( > sparc32 sparc64 > m68k > sh4 > + parisc32 > ) > archs="${all_archs[@]}" > > @@ -116,6 +117,7 @@ crosstool_arch() { > s390*) echo s390;; > sparc*) echo sparc64;; > x32*) echo x86_64;; > + parisc32) echo hppa;; > *) echo "$1";; > esac > } > @@ -185,7 +187,7 @@ test_arch() { > exit 1 > esac > printf '%-15s' "$arch:" > - if [ "$arch" = "m68k" -o "$arch" = "sh4" ] && [ "$llvm" = "1" ]; then > + if [ "$arch" = "m68k" -o "$arch" = "sh4" -o "$arch" = "parisc32" ] && [ "$llvm" = "1" ]; then > echo "Unsupported configuration" > return > fi > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] tools/nolibc: add support for 32-bit parisc 2026-04-07 17:33 ` Helge Deller @ 2026-04-07 18:14 ` Thomas Weißschuh 2026-04-07 18:40 ` Helge Deller 0 siblings, 1 reply; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 18:14 UTC (permalink / raw) To: Helge Deller Cc: James E.J. Bottomley, Willy Tarreau, John David Anglin, linux-kernel, linux-parisc On 2026-04-07 19:33:05+0200, Helge Deller wrote: > On 4/7/26 18:37, Thomas Weißschuh wrote: > > Extend nolibc to target the 32-bit parisc architecture. > > 64-bit is not yet supported. > > Adding 64-bit would be very cool. It is on my roadmap. But the 64-bit kernel I tried didn't seem to boot. Also it would be nice if CONFIG_COMPAT could be disabled. > Dave Anglin is currently working on adding 64-bit userspace support > to gcc/glibc (dynamic loader), but that takes some time. > In the meantime a 64-bit nolibc would be cool for testing. Nice. Do you have instructions to run the 64-bit kernel in QEMU? Is qemu-user support planned? Thomas ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] tools/nolibc: add support for 32-bit parisc 2026-04-07 18:14 ` Thomas Weißschuh @ 2026-04-07 18:40 ` Helge Deller 2026-04-07 18:50 ` Thomas Weißschuh 0 siblings, 1 reply; 16+ messages in thread From: Helge Deller @ 2026-04-07 18:40 UTC (permalink / raw) To: Thomas Weißschuh Cc: James E.J. Bottomley, Willy Tarreau, John David Anglin, linux-kernel, linux-parisc On 4/7/26 20:14, Thomas Weißschuh wrote: > On 2026-04-07 19:33:05+0200, Helge Deller wrote: >> On 4/7/26 18:37, Thomas Weißschuh wrote: >>> Extend nolibc to target the 32-bit parisc architecture. >>> 64-bit is not yet supported. >> >> Adding 64-bit would be very cool. > > It is on my roadmap. But the 64-bit kernel I tried didn't seem to boot. Just in case you used qemu, you need to use "-machine C3700" or "-machine A400". The default B160L is a 32-bit only machine. > Also it would be nice if CONFIG_COMPAT could be disabled. Ah... never thought about that. Will check, but I don't think the kernel will become much smaller. >> Dave Anglin is currently working on adding 64-bit userspace support >> to gcc/glibc (dynamic loader), but that takes some time. >> In the meantime a 64-bit nolibc would be cool for testing. > > Nice. Do you have instructions to run the 64-bit kernel in QEMU? As mentioned above, I think the "-machine C3700" should be sufficient. Some more info is at: https://parisc.docs.kernel.org/en/latest/qemu.html > Is qemu-user support planned? 32-bit qemu user works great and is used on many debian buildd machines. 64-bit is on my todo list, I just need time to do it :-) Helge ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] tools/nolibc: add support for 32-bit parisc 2026-04-07 18:40 ` Helge Deller @ 2026-04-07 18:50 ` Thomas Weißschuh 0 siblings, 0 replies; 16+ messages in thread From: Thomas Weißschuh @ 2026-04-07 18:50 UTC (permalink / raw) To: Helge Deller Cc: James E.J. Bottomley, Willy Tarreau, John David Anglin, linux-kernel, linux-parisc On 2026-04-07 20:40:39+0200, Helge Deller wrote: > On 4/7/26 20:14, Thomas Weißschuh wrote: > > On 2026-04-07 19:33:05+0200, Helge Deller wrote: > > > On 4/7/26 18:37, Thomas Weißschuh wrote: > > > > Extend nolibc to target the 32-bit parisc architecture. > > > > 64-bit is not yet supported. > > > > > > Adding 64-bit would be very cool. > > > > It is on my roadmap. But the 64-bit kernel I tried didn't seem to boot. > > Just in case you used qemu, you need to use "-machine C3700" or "-machine A400". > The default B160L is a 32-bit only machine. Thanks, I'll try that. > > Also it would be nice if CONFIG_COMPAT could be disabled. > > Ah... never thought about that. Will check, but I don't think > the kernel will become much smaller. It's not about size for me but about simplifying the toolchain setup. > > > Dave Anglin is currently working on adding 64-bit userspace support > > > to gcc/glibc (dynamic loader), but that takes some time. > > > In the meantime a 64-bit nolibc would be cool for testing. > > > > Nice. Do you have instructions to run the 64-bit kernel in QEMU? > > As mentioned above, I think the "-machine C3700" should be sufficient. > Some more info is at: https://parisc.docs.kernel.org/en/latest/qemu.html > > > Is qemu-user support planned? > 32-bit qemu user works great and is used on many debian buildd machines. > 64-bit is on my todo list, I just need time to do it :-) 32-bit qemu user is indeed used by the proposed patches. I'm looking forward to the 64-bit support. Thomas ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-04-07 22:33 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-04-07 16:37 [PATCH 0/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Thomas Weißschuh 2026-04-07 17:14 ` Helge Deller 2026-04-07 18:06 ` Thomas Weißschuh 2026-04-07 19:27 ` Helge Deller 2026-04-07 20:20 ` Helge Deller 2026-04-07 21:27 ` Thomas Weißschuh 2026-04-07 22:33 ` Helge Deller 2026-04-07 16:37 ` [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons Thomas Weißschuh 2026-04-07 17:20 ` Helge Deller 2026-04-07 18:11 ` Thomas Weißschuh 2026-04-07 16:37 ` [PATCH 3/3] tools/nolibc: add support for 32-bit parisc Thomas Weißschuh 2026-04-07 17:33 ` Helge Deller 2026-04-07 18:14 ` Thomas Weißschuh 2026-04-07 18:40 ` Helge Deller 2026-04-07 18:50 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®