On 8/31/26 06:32, Thomas Weißschuh wrote:
Extend the existing parisc support to also handle 64-bit mode.
Some peculiarities:
* The nonstandard ftruncate64 system call requires a workaround.
* The linker defaults to main() as entry point, which needs to be
switched to _start() explicitly.
* The linker defaults to dynamic linking, which needs to be disabled
explicitly.
* With the default -Os, gcc does not use 64-bit multiplication
instructions, requiring libgcc. Use -O2 instead.
* There is no qemu-user available.
* CONFIG_COMPAT needs to be disabled to avoid build errors due to a
missing 32-bit vDSO compiler.
Signed-off-by: Thomas Weißschuh <[email protected]>
---
Changes in v2:
- Rebase on latest nolibc/for-next.
- Fix typo in comment.
- Reorder conditions in run-tests.sh.
- Fix llvm=1 check in run-tests.sh.
- Link to v1:
https://patch.msgid.link/[email protected]
---
tools/include/nolibc/arch-parisc.h | 26 +++++++++++++++++++++++---
tools/include/nolibc/stdlib.h | 2 +-
tools/testing/selftests/nolibc/Makefile.nolibc | 5 +++++
tools/testing/selftests/nolibc/run-tests.sh | 10 +++++++---
4 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/tools/include/nolibc/arch-parisc.h
b/tools/include/nolibc/arch-parisc.h
index 417043ecbc53..5c595ef88a62 100644
--- a/tools/include/nolibc/arch-parisc.h
+++ b/tools/include/nolibc/arch-parisc.h
@@ -7,9 +7,7 @@
#ifndef _NOLIBC_ARCH_PARISC_H
#define _NOLIBC_ARCH_PARISC_H
-#if defined(__LP64__)
-#error 64-bit not supported
-#endif
+#include <linux/unistd.h>
#include "compiler.h"
#include "crt.h"
@@ -167,9 +165,15 @@
void __attribute__((weak, noreturn)) __nolibc_entrypoint
__nolibc_no_stack_protector _start(void)
{
__asm__ volatile (
+#ifdef __LP64__
+ ".import __gp\n" /* Set up the dp register */
+ "ldil L%__gp, %dp\n"
+ "ldo R%__gp(%r27), %dp\n"
change to:
"ldo R%__gp(%dp), %dp\n"
+#else
".import $global$\n" /* Set up the dp register */
"ldil L%$global$, %dp\n"
"ldo R%$global$(%r27), %dp\n"
change to:
"ldo R%$global$(%dp), %dp\n"
Helge