From nobody Fri Dec 19 18:43:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBD1AC5479D for ; Mon, 9 Jan 2023 08:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236762AbjAIItx (ORCPT ); Mon, 9 Jan 2023 03:49:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236868AbjAIIsP (ORCPT ); Mon, 9 Jan 2023 03:48:15 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5DA2165B7 for ; Mon, 9 Jan 2023 00:43:43 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 3098gF7A027438; Mon, 9 Jan 2023 09:42:15 +0100 From: Willy Tarreau To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Sven Schnelle , Willy Tarreau Subject: [PATCH 19/22] tools/nolibc: add auxiliary vector retrieval for s390 Date: Mon, 9 Jan 2023 09:42:05 +0100 Message-Id: <20230109084208.27355-20-w@1wt.eu> X-Mailer: git-send-email 2.17.5 In-Reply-To: <20230109084208.27355-1-w@1wt.eu> References: <20230109084208.27355-1-w@1wt.eu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sven Schnelle In the _start block we now iterate over envp to find the auxiliary vector after the NULL. The pointer is saved into an _auxv variable that is marked as weak so that it's accessible from multiple units. Signed-off-by: Sven Schnelle Signed-off-by: Willy Tarreau --- tools/include/nolibc/arch-s390.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s= 390.h index 039b454e79f0..6b0e54ed543d 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -160,6 +160,7 @@ struct sys_stat_struct { }) =20 char **environ __attribute__((weak)); +const unsigned long *_auxv __attribute__((weak)); =20 /* startup code */ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(= void) @@ -179,6 +180,15 @@ void __attribute__((weak,noreturn,optimize("omit-frame= -pointer"))) _start(void) "larl %r1,environ\n" "stg %r4,0(%r1)\n" =20 + /* search for auxv */ + "lgr %r5,%r4\n" /* start at envp */ + "1:\n" + "clg %r0,0(%r5)\n" /* entry zero? */ + "la %r5,8(%r5)\n" /* advance pointer */ + "jnz 1b\n" /* no -> test next pointer */ + "larl %r1,_auxv\n" /* yes -> store value in _auxv */ + "stg %r5,0(%r1)\n" + "aghi %r15,-160\n" /* allocate new stackframe */ "xc 0(8,%r15),0(%r15)\n" /* clear backchain */ "brasl %r14,main\n" /* ret value of main is arg to exit */ --=20 2.17.5