Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10363673rwl; Mon, 2 Jan 2023 00:56:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFnTaU8SfDu13tV5tiHo0RvxTJRmJhxuneLmobx89GsXIj4cnK5XbIBWOZeYb2rxIqO6YH X-Received: by 2002:a17:902:c102:b0:192:8e05:1505 with SMTP id 2-20020a170902c10200b001928e051505mr23042183pli.31.1672649776609; Mon, 02 Jan 2023 00:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672649776; cv=none; d=google.com; s=arc-20160816; b=NoLhB+78gE2elG9mO8BTrrurqWkmPZwLASNOSOKt9joBbZp4ewGOOGjsC0snZ31jIn 2Y9c8a7QLPzLmXCpE7m9n6vAxG8qzXWVqWf3zBz+/es9P7ulizOY3yGyp/NmV5H4rFG9 G8osRx1pmsrrcOkYHPuaV0KZ7J1y8vnRCIUK6uw6NXAy6Gg2rUrrdwH3VJfH7SSnuWad aGulK1WXU1WCpqbE11ZggRyVGx5c03+BQGYLFFS8Ua6MMacxmHcCgWS5AzzZh3y6PFTb txOrr/Yfg8lvNvxAfMNQuLzrLFOETylx1DEd2v9TJDhGZeJSQ6Ns86pH3NxrvGhTddeK fPSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=YHs9RstUie0WLmc9mlN74esTjNd4m9zFnfDNnqf5Sx4=; b=WzE0WJLVEUTeVHTNM4Y03ayidKNYi7MFRuxEw8rHWS4njKPu4KVcpWQ6l1gjG8IBfs N+cdrhTqWFThTKaT/Z/BKp/opSIIOpXt5j67uVABiPYEoWyTRfYkODBp8xUcx2C1zA8d Pe86atFQl5TgQx6FHBuAcwEml5mozUPlVOQ87h7AHcdSkg3XU6YA9JoRmoCdicC95W9p eMY3TPto/QgA/q029HA9OtOpcXAeS/wZ8XLST2Il+cpNHYQq7hS/N5ORbGvbM+ZydEcW TsgVKoT4VIR7qF1sFGoAbix0YLmbfJwGmX0CSJASLy21VK1TGeRZkbhJU/VSZbnJQRI2 cQSQ== 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 w6-20020a170902e88600b0019107d41d49si32410490plg.36.2023.01.02.00.56.08; Mon, 02 Jan 2023 00:56:16 -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 S230408AbjABIl4 (ORCPT + 58 others); Mon, 2 Jan 2023 03:41:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231808AbjABIlw (ORCPT ); Mon, 2 Jan 2023 03:41:52 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8FC51262C for ; Mon, 2 Jan 2023 00:41:50 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 3028fMEv030128; Mon, 2 Jan 2023 09:41:22 +0100 Date: Mon, 2 Jan 2023 09:41:22 +0100 From: Willy Tarreau To: Sven Schnelle Cc: "Paul E . McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel@vger.kernel.org, hca@linux.ibm.com Subject: Re: [PATCH 2/5] nolibc: add support for s390 Message-ID: <20230102084122.GB29287@1wt.eu> References: <20221209141939.3634586-1-svens@linux.ibm.com> <20221209141939.3634586-3-svens@linux.ibm.com> <20221227213530.GA6390@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 Hi Sven, On Mon, Jan 02, 2023 at 09:17:04AM +0100, Sven Schnelle wrote: > > But with this addressed, I'm facing this next error: > > > > $ make nolibc-test LDFLAGS= ARCH=s390 CC=/f/tc/nolibc/gcc-12.2.0-nolibc/s390-linux/bin/s390-linux-gcc > > MKDIR sysroot/s390/include > > make[1]: Entering directory '/g/public/linux/master/tools/include/nolibc' > > make[2]: Entering directory '/g/public/linux/master' > > make[2]: Leaving directory '/g/public/linux/master' > > make[2]: Entering directory '/g/public/linux/master' > > INSTALL /g/public/linux/master/tools/testing/selftests/nolibc/sysroot/sysroot/include > > make[2]: Leaving directory '/g/public/linux/master' > > make[1]: Leaving directory '/g/public/linux/master/tools/include/nolibc' > > CC nolibc-test > > /tmp/ccCzaBgD.s: Assembler messages: > > /tmp/ccCzaBgD.s:9: Error: Unrecognized opcode: `lg' > > /tmp/ccCzaBgD.s:12: Error: Unrecognized opcode: `lay' > > /tmp/ccCzaBgD.s:15: Error: Unrecognized opcode: `lghi' > > make: *** [Makefile:108: nolibc-test] Error 1 > > > > Thus I'm wondering if specific options are required for the compiler > > (it's gcc 12.2.0 + binutils 2.39), if I'm not using the proper compiler, > > or if there's anything wrong in the asm code (e.g. maybe by accident you > > sent the patch from an earlier development branch), or anything else ? > > Hmm, tried this on my x86 laptop, and it looks like there are two things > here: > > The cross compiler needs -m64 to compile in 64bit mode. otherwise it > assumes 31bit mode, where both lg and lghi are not present. The other > thing is that lay was introduced with later generations of the > z/Architecture. Ah, this explains why along my various tests at some point I managed to remove two of these errors (likely with -m64)! > The kernel compiles with z10 as minimum architecture, so > i'm leaning towards enforcing the same arch for nolibc. What do you think? Sure, as long as this works for most users, that's likely fine. Alternately, are there equivalent sequences of instructions that achieve the same on older architectures, and would that be relevant ? One future improvement I'll need will be to store the envp value into a global "environ" variable, and run over it to catch the pointer that follows the NULL and save it into the "_auxv" variable. I've done it for all other archs here already: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git/log/?h=20221227-nolibc-weak-4 I'll give it a try once I'm able to build and test your code, and may ask you for some help if I don't succeed in doing it. If you want to do it yourself, please have a look at the last commits adding environ and auxv to any arch of your choice, such as x86_64. Thanks! Willy