Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp4072589rwp; Sat, 15 Jul 2023 16:09:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbNaIpYTG2x+g587JIiA0tGrN0EesGmqg51zcI86klrnS0Tp6+auGgezJ8B8bJLgh13+h+ X-Received: by 2002:a05:6402:40ce:b0:51e:5390:8cca with SMTP id z14-20020a05640240ce00b0051e53908ccamr2871896edb.3.1689462544615; Sat, 15 Jul 2023 16:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689462544; cv=none; d=google.com; s=arc-20160816; b=tud7vpxW1Z695pjKwRIi3KUnX8TcnfRhCD3xfL+qtCr/LfRtmrEGZh2YiBmSg3bXT8 BhtNETIByT3csXo1AUnBAaYFb4uLclLY1Qt8Y91b0BwuH6FPqlWSuDLLPTh7IxCxWlZs SVVH5fj+3RYjSQ7x7jrCWwHVoZAkHAfoeomP3Xw3WwxkySF/nNjrIl9DNv+nbm5hPkki /zEjSTE2lRNl9PPRmnDKWS4iodm27RJZRPIJpI4yLdJZQNreSVHJKaRZSIRFYTJAEy3a 8kabKR3247mzKnh/XEQv5ExkPGP/pZpT8Eyfbm6Lyh+4QYFQIEtkxQHPkLtpYbgW4TAi sxUQ== 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=CDImlj8kwysMulxT8wJsN939PAgHUF7V78xCSrlS1Gk=; fh=tcl19X2u8PtEELiqC9wF/fi8DNcGozPCtYGeW6FgzSg=; b=SX1mibQF9ZZak7EU5T60pUcKrWP0Oz0EDvrvX9HyjUc9/MN2YrVPu0HjQM7iTzSx36 nlQny54S3nLSAugKgrdp6onJyNneQy8ij0q0oqo1ITvuugAX6CNHinfVr7W/HqIa1ACu IoZ0xzXjUGn7RtxfGmGOBtcvWcUZTN9IPFbhg5hUfNl06AJ0xTsd6EUjRcsSbftdLqlU pUuozpHWOSEf90Je7O9G90PwGgosfwSIyETZ5lBAUskcmIfjhwLsn5XQ0/jjWQV1csSR 0gcYH4pZ+BkuRvPcZLapSEZCv/LslOZkbBOJt0lT0iutNRuIKelXMYbT65XgAwGD6/s3 0ZzQ== 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 n8-20020aa7db48000000b0051df74b43f1si10798562edt.539.2023.07.15.16.08.29; Sat, 15 Jul 2023 16:09:04 -0700 (PDT) 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 S229584AbjGOW1O (ORCPT + 99 others); Sat, 15 Jul 2023 18:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjGOW1N (ORCPT ); Sat, 15 Jul 2023 18:27:13 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FA191993; Sat, 15 Jul 2023 15:27:11 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 36FMQw5g028157; Sun, 16 Jul 2023 00:26:58 +0200 Date: Sun, 16 Jul 2023 00:26:58 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, thomas@t-8ch.de Subject: Re: [PATCH v4 00/18] tools/nolibc: shrink arch support Message-ID: <20230715222658.GA27708@1wt.eu> References: 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, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Zhangjin, On Sun, Jul 16, 2023 at 02:16:36AM +0800, Zhangjin Wu wrote: > Hi, Willy, Thomas > > Thanks very much for your careful review and great suggestions, now, we > get v4 revision of the arch shrink series [1], it mainly include a new > fixup for -O0 under gcc < 11.1.0, the stackprotector support for > _start_c(), new testcases for startup code and two new test targets. > > All of the tests passed or skipped (tinyconfig + few options + > qemu-system) for both -Os and -O0: (...) First, good news, it looks OK from the nolibc-test perspective and by looking at the code, so I merged all this into branch 20230715-nolibc-next-1 Second, bad news, my preinit code doesn't build anymore due to missing definitions for statx. It's built using the default method which involves just including nolibc.h (and getting linux includes from the default path). I could simplify it to this one-liner: $ printf "int test_stat(const char *p, struct stat *b) { return stat(p,b); }\n" | gcc -c -o test.o -xc - -nostdlib -include ./sysroot/x86/include/nolibc.h In file included from ././sysroot/x86/include/nolibc.h:98:0, from :32: ././sysroot/x86/include/sys.h:952:78: warning: 'struct statx' declared inside parameter list will not be visible outside of this definition or declaration int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf) ^~~~~ ././sysroot/x86/include/sys.h:962:74: warning: 'struct statx' declared inside parameter list will not be visible outside of this definition or declaration int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf) ^~~~~ ././sysroot/x86/include/sys.h: In function 'statx': ././sysroot/x86/include/sys.h:964:51: warning: passing argument 5 of 'sys_statx' from incompatible pointer type [-Wincompatible-pointer-types] return __sysret(sys_statx(fd, path, flags, mask, buf)); ^~~ ././sysroot/x86/include/sys.h:952:5: note: expected 'struct statx *' but argument is of type 'struct statx *' int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf) ^~~~~~~~~ ././sysroot/x86/include/sys.h: In function 'stat': ././sysroot/x86/include/sys.h:971:15: error: storage size of 'statx' isn't known struct statx statx; ^~~~~ ././sysroot/x86/include/sys.h:974:60: error: 'STATX_BASIC_STATS' undeclared (first use in this function) ret = __sysret(sys_statx(AT_FDCWD, path, AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &statx)); ^~~~~~~~~~~~~~~~~ ././sysroot/x86/include/sys.h:974:60: note: each undeclared identifier is reported only once for each function it appears in I finally found that it's due to the lack of -Isysroot/x86/include, so it used to get linux includes from those provided by glibc and these ones were missing statx since packaged for an older kernel. I knew that sooner or later I'd have to reinstall this machine but I can't get out of my head that to date I have yet not been convinced by the absolute necessity of this modification which is progressively adding more burden :-/ Time will tell... Cheers, Willy