Message ID | 20230110072434.3863-13-w@1wt.eu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2603474wrt; Mon, 9 Jan 2023 23:30:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcVpSVmzbL8LpqQWObrIA3L9MvIShfrBpVNUQfV7ZrPSZQuybcdH1L4ECIH6Di5XQBdF3G X-Received: by 2002:a05:6a21:3d0d:b0:b2:6191:fdef with SMTP id bi13-20020a056a213d0d00b000b26191fdefmr92732091pzc.43.1673335817595; Mon, 09 Jan 2023 23:30:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673335817; cv=none; d=google.com; s=arc-20160816; b=RfXzTA6nFSfyl+XRkStOm1VP3VHJL9pe8GfcBxGcl6suUcK2GCMvm5OSAo6DGQiQI7 r2Nqqt1lj/1JYRrmQg6Qlje1b1yPbAEBysGP6P0n2wNIokjKnsyzBGuL7jgPKVDZI5TN xFsQgShz0bkEq+63CSGC22sjdhpBZ35LIJqkCc3W8fqcHsY9ifH+jvc1hiyCUVuJHpMu qP3dfpj8DQlpjUCSV+u0QzBuV7VAkELta5oiJYd5yxbe1dkzr1CCMFZCEbyr4DzkkpmX 0bWuSHDpcB6enfBk6WySPRZBHA+wsi/BhBVVXEuYomRTKMKVJY7b7c2Tjpem917QHwgK XyQw== 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=81USXGTkCPKZqMGb+QvzuKCpzL/xOLwEiDo4QWbYbFY=; b=IBYiPSlPDKnXJkeNTa0mwqeCtl5AoMLrqqqidHBPrEBt4qqm6Ul5JYPCOlLZIZIwUO ojNrKzx+XYsVOYRcNQWbptp6P0bTmqirhfimvgaWEwuWyuMqKF9T7jJ6OOlCDJ4QUGBm fRA7zbl+GrnkYctbOcwt5WByB6ke1A7cz0i1ltFGrJJsZgSGM1XcFYyAfKuoJ2JGBdHo 3p42SmIcy1j3Okrl+KVyE8WpksibI8hjk6FtlAuN6ZbuXBw+dzcQa4lzcCI7toSDWfpr jyG/MS4alzzVvdWpb6lwbqLKWKizgtWCJeva6T5DtKP2c61QoVI8Cdjv/XIQ95RQCUlS pwmA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a056a00140100b005764c8f3918si11281838pfu.262.2023.01.09.23.30.05; Mon, 09 Jan 2023 23:30:17 -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 S237835AbjAJH37 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 02:29:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237888AbjAJH33 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 02:29:29 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BCD7053725 for <linux-kernel@vger.kernel.org>; Mon, 9 Jan 2023 23:27:03 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 30A7OcV3003939; Tue, 10 Jan 2023 08:24:38 +0100 From: Willy Tarreau <w@1wt.eu> To: "Paul E. McKenney" <paulmck@kernel.org> Cc: linux-kernel@vger.kernel.org, Sven Schnelle <svens@linux.ibm.com>, Willy Tarreau <w@1wt.eu> Subject: [PATCH v2 12/22] tools/nolibc: export environ as a weak symbol on s390 Date: Tue, 10 Jan 2023 08:24:24 +0100 Message-Id: <20230110072434.3863-13-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754619778338110301?= X-GMAIL-MSGID: =?utf-8?q?1754619778338110301?= |
Series |
nolibc: usability improvements (errno, environ, auxv)
|
|
Commit Message
Willy Tarreau
Jan. 10, 2023, 7:24 a.m. UTC
From: Sven Schnelle <svens@linux.ibm.com> The environ is retrieved from the _start code and is easy to store at this moment. Let's declare the variable weak and store the value into it. By not being static it will be visible to all units. By being weak, if some programs already declared it, they will continue to be able to use it. This was tested on s390 both with environ inherited from _start and extracted from envp. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Willy Tarreau <w@1wt.eu> --- tools/include/nolibc/arch-s390.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h index b58f64d47b82..039b454e79f0 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -159,6 +159,8 @@ struct sys_stat_struct { _arg1; \ }) +char **environ __attribute__((weak)); + /* startup code */ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void) { @@ -174,6 +176,8 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void) "la %r4,8(%r4)\n" /* advance pointer */ "jnz 0b\n" /* no -> test next pointer */ /* yes -> r4 now contains start of envp */ + "larl %r1,environ\n" + "stg %r4,0(%r1)\n" "aghi %r15,-160\n" /* allocate new stackframe */ "xc 0(8,%r15),0(%r15)\n" /* clear backchain */