Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5881451rwl; Mon, 9 Jan 2023 00:46:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXs35qkcpUJOh6WFwSCHYvii4gy0L/Fc9Y1bTZEaCfmIAwZYhuXDhLyUmyVO63l0DGEob/3o X-Received: by 2002:a50:e606:0:b0:498:b9f9:752c with SMTP id y6-20020a50e606000000b00498b9f9752cmr4880692edm.10.1673253987757; Mon, 09 Jan 2023 00:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673253987; cv=none; d=google.com; s=arc-20160816; b=mmNZ2KSkMUDWfH9Fqaq3StOPFKMLgevohT2Ht8ZBALU1CIdXII7UMYcaIGcrwOgIRX o1Qyi8hPTFzZ3IuRtO02KniM0u3J/AcWaOYRDR/eaH0xxztYnmic/fElpzsDvKNM3pju iPr5jt0oWhqcJbfdTQRWJ3xifUUMSViyfO/xCdR5GXHPn+SDOmPtOKgnOnoVkiwTaGhX V1Yi2tqqwMxkXIoBYoyDCPmCDsmjrZfMbOJKTHpjEHeh2cWf8zkpo0ucptzRqtud8e+i 4VVENsK5CALBuD45+Hn9bMSC3Q/jBvzUy47gM6byElKKfid9SpCEIa2fRQ7oF1cREqkS UyjQ== 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=o7yABujHdiA8OEZPT2EI1HMFPklnZo1FZ93QgHy9zVPd9boevhyTw8clvrZaNAtM1u ahhchJCxNH1tApf83rFxJz3R3d0leks+KVGFVR2xy6iNrqhiBl2ju+cKThrx5jnzccoW jBLcTjGOYlLWi93fSaMcg5Up8l/MmJlceCgcljorJ0FaMMJ9NFRiVtbTPRxiomWSmJNC E3JlxJefHCwX+NIKyxgLfgHaCVwjsQTrH1zlfcyFsqXkOWWU86E252R3maVgLVHc6h3Z PB72lRVSE3QG90p1N+gcRqKWxtfl4NJeeTHVcHOVjy9HCFEHHJbxlwBC3D7Kf6cxAwPR tbZQ== 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 b13-20020a056402278d00b0047010e04c4dsi10359094ede.481.2023.01.09.00.46.14; Mon, 09 Jan 2023 00:46:27 -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 S236914AbjAIInf (ORCPT + 54 others); Mon, 9 Jan 2023 03:43:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236859AbjAIIm1 (ORCPT ); Mon, 9 Jan 2023 03:42:27 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 53E9F13F68 for ; Mon, 9 Jan 2023 00:42:26 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 3098gDhN027431; Mon, 9 Jan 2023 09:42:13 +0100 From: Willy Tarreau To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Sven Schnelle , Willy Tarreau Subject: [PATCH 12/22] tools/nolibc: export environ as a weak symbol on s390 Date: Mon, 9 Jan 2023 09:41:58 +0100 Message-Id: <20230109084208.27355-13-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> 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 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 Signed-off-by: Willy Tarreau --- 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 */ -- 2.17.5