From nobody Mon Jun 15 07:37:43 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95BCD3ACA41; Wed, 8 Apr 2026 18:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; cv=none; b=OEpnaN2WhVAv/ATrQLb6az6N4WLDTTEqJl74CX2siG6so2XsyrqpsdYL81mrrUwCPfImiD38H4/XF8JjZf6Yn71qQhPuJPYNmF8N+k8N7P5oi8/7H12cT4NBBZxJFU//lirk3WdZj2AllQaIxoeN0yOQ0YTiY4Ul4JzcDrhS0HI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; c=relaxed/simple; bh=3CYQYj58rWURjXjzWDTOAFoGP8+nNKIEt/xhRRaDy7E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NHsMlQpEe4ipQji6Pxb2fni5s/p3YOQxQmgpikTdU3unNx+OE/mmpcrZI+KRRqZosSqTG8kKY/B1wDFwmr7tsPyUg1FF3igVmg9wknjoeDCiauGuXq6Kl/BP0m8mutMZP1yoHVTCv8ephZHEotGIZADf3dNLOlRYxfy0d9vzznQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=p8jZ72LX; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="p8jZ72LX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775672361; bh=3CYQYj58rWURjXjzWDTOAFoGP8+nNKIEt/xhRRaDy7E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=p8jZ72LXgDcy2dfoZM9ppjbHQ8Ks7rPlhX6U8H8dj2kK4uc2s0jrjusY80EsZKNBQ C8MHoIiOZFSLJmOriohLXSXv1nuhf+5uCesQUVc+DUeJwiQ6i+eXE8gM/YKW3hKiau Zzu9XiUQ1WpqSG/UaK0ZevuxHkXzWRnbzqJ6eYxA= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 08 Apr 2026 20:18:41 +0200 Subject: [PATCH v2 1/4] parisc: Makefile: move CROSS_COMPILE detection before CROSS32CC one Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260408-nolibc-hppa-v2-1-7fe404cb61e3@weissschuh.net> References: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> In-Reply-To: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775672360; l=1466; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=3CYQYj58rWURjXjzWDTOAFoGP8+nNKIEt/xhRRaDy7E=; b=15ZmkgcuCOqeHGD5wqvdcyAkj8w0SZhVROpftlgAxGLQgFNNQPIQ1DsG0cqzohsZMmt40RZpT mYAo2kkfzSYAbyaZbxDLmBV4BrwfoY27sA7QRZBBb6LndavGX1w7psf X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= An upcoming patch will define CROSS32CC in terms of CROSS_COMPILE, so make sure their order allows this. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/parisc/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 48ae3c79557a..92b769f4bbe7 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -39,6 +39,16 @@ endif =20 export LD_BFD =20 +# Set default cross compiler for kernel build +ifdef cross_compiling + ifeq ($(CROSS_COMPILE),) + CC_SUFFIXES =3D linux linux-gnu unknown-linux-gnu suse-linux + CROSS_COMPILE :=3D $(call cc-cross-prefix, \ + $(foreach a,$(CC_ARCHES), \ + $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) + endif +endif + # 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. @@ -50,16 +60,6 @@ CROSS32_COMPILE :=3D $(call cc-cross-prefix, \ CROSS32CC :=3D $(CROSS32_COMPILE)gcc export CROSS32CC =20 -# Set default cross compiler for kernel build -ifdef cross_compiling - ifeq ($(CROSS_COMPILE),) - CC_SUFFIXES =3D linux linux-gnu unknown-linux-gnu suse-linux - CROSS_COMPILE :=3D $(call cc-cross-prefix, \ - $(foreach a,$(CC_ARCHES), \ - $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) - endif -endif - ifdef CONFIG_DYNAMIC_FTRACE ifdef CONFIG_64BIT NOP_COUNT :=3D 8 --=20 2.53.0 From nobody Mon Jun 15 07:37:43 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 959A137F01B; Wed, 8 Apr 2026 18:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; cv=none; b=lt1SPYLnqlSflUXr+cThNFeLTGDlIWjB1MX0epfd/inLhdXugpqREOsxR2AKfqZN9DYlb8LmGIdGdJuyxXkGvEsbqu9BCB9AaPmUvctwby5BXqQEq+xmDKFlMtsjqrhpUSpIOLmJk6PevUKONmYNJC5EnzanSZnp2SGY78B40x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; c=relaxed/simple; bh=y+vuimZr1QEgf3cyUhn2VTovWRpjXL7ZNQrLPM/61Iw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gNahpXXL99+DovjVvNjVDX0MwH2sSMX84jHmSxIEI8kCV/xzJuZXSQIk6tI8k+tZazW8eXBGVFsvznQGqWkkYI+1HkOSwuEyPssy4XWj34GhgbMNf1IYFlGIP+SI2zMl65LXR9+7hzq2VF9FkfrSG9nCEZbsS37XYNd45+9x82E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=ATezhdn4; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="ATezhdn4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775672361; bh=y+vuimZr1QEgf3cyUhn2VTovWRpjXL7ZNQrLPM/61Iw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ATezhdn4Ag/qnLVEhQ5rqDOybLQDK21ojlshLWy7MYDPcxwUvSSTxopEJU/zLIn/J o6EkJu/DXayYoXo3O8+0N+VEHJXsNlzLvpZxKE+N1bkIF29/1qv04zrU7tCDD+30er TBhhBH/c2aSwdQUQLw4lpA2q6prhmfmVn3hs+4sw= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 08 Apr 2026 20:18:42 +0200 Subject: [PATCH v2 2/4] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260408-nolibc-hppa-v2-2-7fe404cb61e3@weissschuh.net> References: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> In-Reply-To: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775672360; l=1055; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=y+vuimZr1QEgf3cyUhn2VTovWRpjXL7ZNQrLPM/61Iw=; b=wryT14LPe5rt4Gv3eCYREHAqOcX/wbHPqHsHA0OghjaEs0wkS7jsBWzyqFr+f//yVHgpeR+hC UzfjWVDVjPKBCblHLRKuJYPOV1xwwENEhsnAwKzBrlT+LPHew2hk8X7 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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=C3=9Fschuh --- arch/parisc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 92b769f4bbe7..ab8a93e773fb 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -49,6 +49,7 @@ ifdef cross_compiling endif endif =20 +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. @@ -58,6 +59,9 @@ CROSS32_COMPILE :=3D $(call cc-cross-prefix, \ $(foreach a,$(CC_ARCHES_32), \ $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) CROSS32CC :=3D $(CROSS32_COMPILE)gcc +else +CROSS32CC :=3D $(CC) +endif export CROSS32CC =20 ifdef CONFIG_DYNAMIC_FTRACE --=20 2.53.0 From nobody Mon Jun 15 07:37:43 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95A52386550; Wed, 8 Apr 2026 18:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672372; cv=none; b=GdDZqi9cq4JjnnhWrj39M1Svwt1oG2xfr3oy9B8/ac0DmT5fPZQ71d1N5Xkpo3clRRfnigxz6+4hcSsKIS9tJoIymz/SRAz/KGLO8dYMC1XBvJnzZpmA2U1AiGli7cdoVIXbTbDu3JP6MdXLua+K+BxvyPRNeNSvYd53xc41Arg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672372; c=relaxed/simple; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K7UfGMQHqoUIqTIuNxDsdofxCMZZ6+/fy7QKDNiYELD8MgZcJBUeahXNRu7EXBCnnmwdC2YTyaFI5lBLYkUJb8rA6Rrs6wDdLgMb9ANgiZw1hOj3bzZky5ZM5SKILDIXJAzbQzcvSEjjtcvFBK4dCVE9bJTT9xM+me4ikWEM1Og= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=jlDmiUFl; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="jlDmiUFl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775672361; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jlDmiUFlAjfhb3ojLbg52HPPLdZ+Z6+jJi97gfgeNQZEU88CPfp8M1VP0ZZcUzlUb tUBRGWDF2vGuNPdvH5ACyrkopd1bZbsy5LUJfabmN3HnvcGKe7Iv5gjGQQbBAkjxtu lO7riqVZOibep/0Itw+YpGL8lopxRslK/vj5/3xs= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 08 Apr 2026 20:18:43 +0200 Subject: [PATCH v2 3/4] selftests/nolibc: avoid function pointer comparisons Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260408-nolibc-hppa-v2-3-7fe404cb61e3@weissschuh.net> References: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> In-Reply-To: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775672360; l=1867; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; b=Cdt3Bu1kA47eqpAuGiioO4c4haCsaxIj7mz5VBPXkgpNzXAH0EkWmJHBkI+fcfXoIt0MrOhbg BXyc/ool2vEAhMeAO3ScL8OEaaXZ6m1upngtOGxGcT3r6hvZ5XIOMMB X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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=C3=9Fschuh --- 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/s= elftests/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, s= ize_t val, int llen, const return 0; } =20 +enum strtox_func { + strtox_func_strtol, + strtox_func_strtoul, +}; + #define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_e= rrno) \ - do { if (!(cond)) result(llen, SKIPPED); else ret +=3D expect_strtox(llen= , func, input, base, expected, chars, expected_errno); } while (0) + do { if (!(cond)) result(llen, SKIPPED); else ret +=3D expect_strtox(llen= , strtox_func_ ## func, input, base, expected, chars, expected_errno); } wh= ile (0) =20 static __attribute__((unused)) -int expect_strtox(int llen, void *func, const char *input, int base, intma= x_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; =20 errno =3D 0; - if (func =3D=3D strtol) { + if (func =3D=3D strtox_func_strtol) { r =3D strtol(input, &endptr, base); - } else if (func =3D=3D strtoul) { + } else if (func =3D=3D strtox_func_strtoul) { r =3D strtoul(input, &endptr, base); } else { result(llen, FAIL); --=20 2.53.0 From nobody Mon Jun 15 07:37:43 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95ADC3AA4E4; Wed, 8 Apr 2026 18:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; cv=none; b=nKDKaEcLcg23qI0TOQnnFJVNru1wFFr+JYjNyDKXKD0JR3UHjIBEHqnzPeeB+j/8JL5RVxs4jfn8Cen4PQkXZhMO6symQFFihTSoMq84L3MIn9tjhnqN1E6MwBKJJprGyBSbuQrQWMYyl/JqedbaLS/I/UqI1TsVwpZeIsxyCek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672371; c=relaxed/simple; bh=IDlueQMvRY1IKD3JHLnZbBTtli7lXKkj6EB8pyD431U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YKIsEx9e4MZb2SU2QBb4f9Sh7y0KtT3hl0Uee74UYvMpFA6BtYyz3x5FA7QXn1rDO6LGRbF3RNYrtHgdbPurnejSq/iiSK98bEiJzNp/GZ727cBfSVAk1MBSgQwFQQg2uyL1n/6Ao/VtNqrhRLWaVuQ1TH9pQY/lEbazG6BypN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=NQLwA5Dw; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="NQLwA5Dw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775672361; bh=IDlueQMvRY1IKD3JHLnZbBTtli7lXKkj6EB8pyD431U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NQLwA5DwKnFHe5EO4WqfRy1J+pMEe3AJD2DxGpGzOFHYleY8g3n0RqmEEs/aVcnWy UpYn0efeKOcdLDWcrFPEaE3iHpBrzT++aa45YJDRD19UxVl1MACxRHvcBUQ70F2rNa aFGDzN1IXaT+t3gnh+M5NpCX3R57GodvbROKJfIU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 08 Apr 2026 20:18:44 +0200 Subject: [PATCH v2 4/4] tools/nolibc: add support for 32-bit parisc Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260408-nolibc-hppa-v2-4-7fe404cb61e3@weissschuh.net> References: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> In-Reply-To: <20260408-nolibc-hppa-v2-0-7fe404cb61e3@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775672360; l=14307; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IDlueQMvRY1IKD3JHLnZbBTtli7lXKkj6EB8pyD431U=; b=GYrfixImi68ILsb1HF6/HLr4i5rhVuv2CQ9ByawzqFYUVjQeIf21Ce/REHvqvdAkjd7YnE/p9 laEj/Yf1bCLDw5VaHvoWJxTeZAy0De0mbtnHEezMhehpGkfOS8tRlUF X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Extend nolibc to target the 32-bit parisc architecture. 64-bit is not yet supported. Signed-off-by: Thomas Wei=C3=9Fschuh --- 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 ?=3D $(CURDIR)/ =20 -architectures :=3D arm arm64 loongarch m68k mips powerpc riscv s390 sh spa= rc x86 +architectures :=3D arm arm64 loongarch m68k mips parisc powerpc riscv s390= sh sparc x86 arch_files :=3D arch.h $(addsuffix .h, $(addprefix arch-, $(architectures)= )) all_files :=3D \ byteswap.h \ diff --git a/tools/include/nolibc/arch-parisc.h b/tools/include/nolibc/arch= -parisc.h new file mode 100644 index 000000000000..8580be5c9c58 --- /dev/null +++ b/tools/include/nolibc/arch-parisc.h @@ -0,0 +1,178 @@ +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ +/* + * parisc/hppa (32-bit) specific definitions for NOLIBC + * Copyright (C) 2026 Thomas Wei=C3=9Fschuh + */ + +#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 nu= mber + * - 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 constraint= s. + */ + +#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" \ + : "=3Dr"(_ret) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall1(num, arg1) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %2, %%r20\n\t" \ + : "=3Dr"(_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") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %3, %%r20\n\t" \ + : "=3Dr"(_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") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %4, %%r20\n\t" \ + : "=3Dr"(_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") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %5, %%r20\n\t" \ + : "=3Dr"(_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") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r22") =3D (long)(arg5); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %6, %%r20\n\t" \ + : "=3Dr"(_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") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r22") =3D (long)(arg5); \ + register long _arg6 __asm__ ("r21") =3D (long)(arg6); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %7, %%r20\n\t" \ + : "=3Dr"(_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_protec= tor _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 =3D s390 ARCH_sparc32 =3D sparc ARCH_sparc64 =3D sparc ARCH_sh4 =3D sh +ARCH_parisc32 =3D parisc ARCH :=3D $(or $(ARCH_$(XARCH)),$(XARCH)) =20 # kernel image names by architecture @@ -92,6 +93,7 @@ IMAGE_sparc32 =3D arch/sparc/boot/image IMAGE_sparc64 =3D arch/sparc/boot/image IMAGE_m68k =3D vmlinux IMAGE_sh4 =3D arch/sh/boot/zImage +IMAGE_parisc32 =3D vmlinux IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) =20 @@ -121,6 +123,7 @@ DEFCONFIG_sparc32 =3D sparc32_defconfig DEFCONFIG_sparc64 =3D sparc64_defconfig DEFCONFIG_m68k =3D virt_defconfig DEFCONFIG_sh4 =3D rts7751r2dplus_defconfig +DEFCONFIG_parisc32 =3D defconfig DEFCONFIG =3D $(DEFCONFIG_$(XARCH)) =20 EXTRACONFIG_x32 =3D -e CONFIG_X86_X32_ABI @@ -159,6 +162,7 @@ QEMU_ARCH_sparc32 =3D sparc QEMU_ARCH_sparc64 =3D sparc64 QEMU_ARCH_m68k =3D m68k QEMU_ARCH_sh4 =3D sh4 +QEMU_ARCH_parisc32 =3D hppa QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 QEMU_ARCH_USER_ppc64le =3D ppc64le @@ -199,6 +203,7 @@ QEMU_ARGS_sparc32 =3D -M SS-5 -m 256M -append "conso= le=3DttyS0,115200 panic=3D-1 $( QEMU_ARGS_sparc64 =3D -M sun4u -append "console=3DttyS0,115200 panic=3D= -1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_m68k =3D -M virt -append "console=3DttyGF0,115200 panic=3D= -1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_sh4 =3D -M r2d -serial file:/dev/stdout -append "console= =3DttySC1,115200 panic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_parisc32 =3D -append "console=3DttyS0 panic=3D-1 $(TEST:%=3DNO= LIBC_TEST=3D%)" QEMU_ARGS =3D -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(Q= EMU_ARGS_EXTRA) =20 # OUTPUT is only set when run from the main makefile, otherwise @@ -215,6 +220,7 @@ CFLAGS_i386 =3D $(call cc-option,-m32) CFLAGS_x32 =3D -mx32 CFLAGS_arm =3D -marm CFLAGS_armthumb =3D -mthumb -march=3Darmv6t2 +CFLAGS_parisc32 =3D -mfast-indirect-calls CFLAGS_ppc =3D -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 =3D -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le =3D -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=3D= elfv2) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/se= lftests/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=3D( sparc32 sparc64 m68k sh4 + parisc32 ) archs=3D"${all_archs[@]}" =20 @@ -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" =3D "m68k" -o "$arch" =3D "sh4" ] && [ "$llvm" =3D "1" ]; th= en + if [ "$arch" =3D "m68k" -o "$arch" =3D "sh4" -o "$arch" =3D "parisc32" ] = && [ "$llvm" =3D "1" ]; then echo "Unsupported configuration" return fi --=20 2.53.0