Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7410145rwl; Mon, 9 Jan 2023 23:56:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXujdT0GPBoXatMCe5eF4TUbrod7kgdLcP84VE7pVIMy1Yv+H9QMo28QP6iKNYvP6AY3W9Lr X-Received: by 2002:a05:6a20:7d9b:b0:b5:9d81:4171 with SMTP id v27-20020a056a207d9b00b000b59d814171mr13921846pzj.24.1673337395670; Mon, 09 Jan 2023 23:56:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673337395; cv=none; d=google.com; s=arc-20160816; b=qWB3UGUAZOZ64zcPW6fADpk+VTl17oUwTR2QCbqbTljWypTbEZlGGWp2UXxg1hCOVL iBPIKsC4CK/MXpW5DDrH2iz5qTsy20BQOt+Drs+Jo6BBNpwgNFNNcoPJ79d63YR4JAUv z5yJEJqAt091x6Drm1sewD9VB/o7zkJBZBVGos7+OiRdeztqxACJDQ7+vIH7//479Zrm eqEo3BnJDOEZaHw95vt/cAbcRPPt/BarqlieevnX8tfdheojOc0EZ8KKYMnvzx8SX16D 4vyBJ+dibb/FOw2/a2eTToAAQVS9jzaVHVQt0qJaHrjiIAfs5EV6Kra8OnZBWE6Vep03 pKLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=BTmW/a8oWe2Rsop8ETEaSRskumvGGeaS+OrLw75nfdc=; b=QiOukrqj69RIosaNwc7YriTCJB7xFY0TCvY1lMhu+csG5L9/E9giM5i1qWFVoTl+hK Xu2WnPTqLNGPZfVR/D2mnFhfkgVsbxlpz+PXopj/t4GIAxYDf13kQphQEkhrBrWHfthp 2Z7pTcBC9ZHgl8Oktnwn1z0NMnqG4CFaaFBKaBbSGtc21EJ3+/r3xEIFyiL9CzB7EKG7 344PSN/Nv+SM1g70w+PWLFt34m6fl6Y+WZUIe35Ysc6e5Hf6yofRolH8IVdUVK8E85eW Ri11ZvDO4SrSRUTzXvuIGSnQjqv+BytKzKbbbiTLvLtqxe8VR7uAf4NuaZ+gJGNrN/Mg ubxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a63e811000000b004780e6f20adsi11261523pgh.522.2023.01.09.23.56.29; Mon, 09 Jan 2023 23:56:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237639AbjAJHZR (ORCPT + 53 others); Tue, 10 Jan 2023 02:25:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235424AbjAJHZC (ORCPT ); Tue, 10 Jan 2023 02:25:02 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D000B49179 for ; Mon, 9 Jan 2023 23:24:54 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 30A7Oeqb003946; Tue, 10 Jan 2023 08:24:40 +0100 From: Willy Tarreau To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Sven Schnelle , Willy Tarreau Subject: [PATCH v2 19/22] tools/nolibc: add auxiliary vector retrieval for s390 Date: Tue, 10 Jan 2023 08:24:31 +0100 Message-Id: <20230110072434.3863-20-w@1wt.eu> X-Mailer: git-send-email 2.17.5 In-Reply-To: <20230110072434.3863-1-w@1wt.eu> References: <20230110072434.3863-1-w@1wt.eu> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-s390.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 { }) char **environ __attribute__((weak)); +const unsigned long *_auxv __attribute__((weak)); /* 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" + /* 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 */ -- 2.17.5