Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3370405rwp; Sat, 15 Jul 2023 01:00:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEqu7iDQ9oaa71bmkmKgj0saQVhUkKu2XRYIdvAob23OJtJN8cRl29UglkdONGcWnXVXqnt X-Received: by 2002:a05:651c:b1e:b0:2b7:32d1:6c7d with SMTP id b30-20020a05651c0b1e00b002b732d16c7dmr885951ljr.2.1689408011741; Sat, 15 Jul 2023 01:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689408011; cv=none; d=google.com; s=arc-20160816; b=mKD3MmJneriVYcVg3LK/fWZLkUaucxZHua3sarKa1gmLxp98Osxt1wsImdTlM/pk6I duNhb7RvGsBq73Q2SXyYJ+lOr71Yx9YoxpXBh2iX1WaXSQYFHPGfz4dqNFfRzPep9W76 BJ/lRjrqEi2m8gn7lYsXgvDBuV2iMBTodWucvCuDGrzVgqV7/0Q2Y2Jdm0UN7w+O0d1S J8sIQB8f39igoNyxkFBW4cLMSwjWVvpbmaytfACih3hAcfOLhNUNIVK2MYBwqlXcWfTf zea05IVHmpRLvMkUjU7oJbA8PqEU5cIl2TgC4Ih9A86X5O56XFK/Lt4qz1tML2YCrh7U z1Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Dt5ZEYncysDN8FVPWYlS5t//4z+V1BU1pG/wuJCLuww=; fh=TuPQo+NkBQwnKbc1ovCICPoPS4sXtRS87zBVXND/h+Y=; b=LzVz+GHtlTBnITYIF8hebkhizZdLnJAwZovaZFlJNRf0rs2WHZ80K9ZVZ1pM75czJi +6gVguZKfLGpP9N7EuptqXyfiU/Ktuw3rVU4hvrYgLL4Q+NfGxsK+SJDij65d4nAZMSd UQsEmFi4q/ohc4VOb5YD/qUIRaKjliE3lBl5/uHpYcl5r2VObozddoSna8DzU3cv/YE0 3Guro7TL2kXHpJcW53qkqdRCWiTYmNAUWfVcgLefDwn/USfOFNZ8oR31Sztk5Q6x8Bu7 WGd+VV+TOqCUDec6IGHwReql/3sEqRRYfYhmvEorwQo8PK1EWw89IBaP9LWg5i73ubD2 jwPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=WYacgvwA; 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 le12-20020a170907170c00b00992fec0f917si10535721ejc.634.2023.07.15.00.59.47; Sat, 15 Jul 2023 01:00:11 -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; dkim=pass header.i=@t-8ch.de header.s=mail header.b=WYacgvwA; 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 S230095AbjGOHYz (ORCPT + 99 others); Sat, 15 Jul 2023 03:24:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjGOHYy (ORCPT ); Sat, 15 Jul 2023 03:24:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8882235B3; Sat, 15 Jul 2023 00:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1689405891; bh=+x+OBsCkEs63wx4/L6coA3g29HgWPJzDjcoTmoesRQg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WYacgvwA2hjXbvY0r8To3ttma0vgqHDk8I+HK/tsqeyrvUVICy9K2y33UTlKLi5yH UitXHcVQwTD4rUuYwxD18WVZ6E6Xv3EWWvRycsSE8XSAQCNzKHWb4eDUfGi8Mxhivk F/7i1SIXXhoLVEX7qMSoyiTmeo6c6PLRBsYfsD8U= Date: Sat, 15 Jul 2023 09:24:50 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Zhangjin Wu Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, w@1wt.eu Subject: Re: [PATCH v3 02/11] tools/nolibc: add new crt.h with _start_c Message-ID: <34b21ba5-7b59-4b3b-9ed6-ef9a3a5e06f7@t-8ch.de> References: <63476acf-9e65-4ab0-8e9b-bc35b12710d5@t-8ch.de> <20230714094723.140603-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230714094723.140603-1-falcon@tinylab.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 2023-07-14 17:47:23+0800, Zhangjin Wu wrote: > > On 2023-07-14 13:58:13+0800, Zhangjin Wu wrote: > [..] > > I was also not able to reproduce the issue. > > > > Thanks very much for your 'reproduce' result, It is so weird, just > rechecked the toolchain, 13.1.0 from https://mirrors.edge.kernel.org/ is > ok, gcc 9, gcc 10.3 not work. > > But even in the page of 13.1.0 [1], we still see this line: > > Most optimizations are completely disabled at -O0 or if an -O level is not set on the command line, even if individual optimization flags are specified. > > Not sure if "individual optimization flags" also means the optimize() > flags in gcc attributes. or the doc is not updated yet? > > And further found gcc 11.1.0 is ok, gcc 10.4 still not work, so, gcc > 11.1.0 may changed something to let the "individual optimization flags" > work with -O0. > > We may need to at least document this issue in some files, -O0 is not such a > frequently-used option, not sure if we still need -O0 work with the older gcc < > 11.1.0 ;-) It seems we can avoid the issue by enforcing optimizations for _start: diff --git a/tools/include/nolibc/arch-x86_64.h b/tools/include/nolibc/arch-x86_64.h index f5614a67f05a..b9d8b8861dc4 100644 --- a/tools/include/nolibc/arch-x86_64.h +++ b/tools/include/nolibc/arch-x86_64.h @@ -161,12 +161,9 @@ * 2) The deepest stack frame should be zero (the %rbp). * */ -void __attribute__((weak, noreturn, optimize("omit-frame-pointer"))) __no_stack_protector _start(void) +void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void) > > Willy, I'm not sure if the issues solved by the commit 7f8548589661 > ("tools/nolibc: make compiler and assembler agree on the section around > _start") still exist after we using _start_c()? > > Thomas, because we plan to move the stackprotector init to _start_c(), If using > pure assembly _start, we may also not need the __no_stack_protector macro too? It would probably not needed anymore in this case. Thomas