Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3429729rwp; Sat, 15 Jul 2023 02:27:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlFqSXqxJ/Y90Y9THqgUpUQUjYbSdF93jx5dU3z26Jj0ZXIA8toN5x6hywB4zH+uekKlURSH X-Received: by 2002:a17:906:f90c:b0:992:58fc:bcb8 with SMTP id lc12-20020a170906f90c00b0099258fcbcb8mr5437475ejb.56.1689413244963; Sat, 15 Jul 2023 02:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689413244; cv=none; d=google.com; s=arc-20160816; b=lWULL1vH4iJswPBI8SiEnCFkRuDewPQ5kjmYR3dAtAvVOXYDxi6m9gz8LL1zmwFtmU 82BgyeRh/pGuO2vUeo/Ld0rrQOhNlEaoU6g0+9+pHPetaiKdyi1XPDhqlxyOHPHTF6H5 wJoPKao4bi1w7aAvTyt9Qe9EGe9U87kAj/yshl1G/hFXhyp6XlwSdSs5kq9oS+EN6aP6 MU8Iv6Rw4g4F+HQUqyc0PmBgGFKzzxWD4I/Vpyz1sMTzNBwR04WLyo1M8NtzkaDR7VnL 319kLk1ONaIkHhNQimMupEVr7GSPIuVwwBedqN2ZyXtjCTncmbhdvWJjatc0ZSlCeoIk CLsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=najTnWOEpQsRjN4Kdl+2QhZpg6Yt2gk85/ikGTePftQ=; fh=vs4UAhjsqOR6YINwX+Rc6iaEZOnGwtAYSpGexnX2DnE=; b=jqPWbHfesWfR+NOozQ/yGoRKi45Kqf2YDB6n4pRIRq5243heljcyXTgqcvft0ZEVKf zJOz2W3QlaUxtCzqj8Y7Y/L2Br8p+DEc9OH+UuFhUdy01kbPYg587t3vLdgKvEyc6Brg q3wCFfW0ePeZ/1HUdQvOABMo0QKuXH5ATUh96A+2JLdJ2Wu7fjYdpRXi/YS4DUgKCN0X ZYJTedDBk5T1y79WRRKQeTreKviWFreO5RpNH5QE6mDYZ3A0jdi+H5oSbYpBaFrVbuH7 t2NdpjBMH4rUrC0xmLFDwp4yowXzQhN4PPIqWxb61CyO7PuBBUafGGZJR9g0ujDbCuDC z+8w== 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 lu14-20020a170906face00b0098df7d0e09csi1377470ejb.923.2023.07.15.02.27.01; Sat, 15 Jul 2023 02:27:24 -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 S231145AbjGOJXq (ORCPT + 99 others); Sat, 15 Jul 2023 05:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbjGOJXh (ORCPT ); Sat, 15 Jul 2023 05:23:37 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC103AB1; Sat, 15 Jul 2023 02:23:15 -0700 (PDT) X-QQ-mid: bizesmtp89t1689412983tno1gxiu Received: from linux-lab-host.localdomain ( [119.123.131.162]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 15 Jul 2023 17:23:01 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: q+EIYT+FhZrAovjZxRoSnSnHnPax2IuslwuJRGRN5fECtY6fP4y4nhEUwUr/c 0bUAu3pmDk1aSDl4lKKLg/ti7sgCj9P1l9zM7AlbSwJ9g1kmLPDAv7iBZaL7RVeJg2OAGsd Q3g+9mb1+8fYLInhCmAesMAPF0dyndoVARHSEkyG5j75YuiVCHIa9ljZXUB60Kves7wTdtK +g9HISe8gYOHfbGwfbnntiU5x79dPmmm7PI6lMjuYKcxEXkS25r7nNeCk8rbHRUO478mvRG wjVA7qrK1isT0gBDvlf/mfn8sPPDY2DT1UBycINpobsCb8RB2Y6zCCwoTlA7/Wla4DEo35o x50tunzZrYf50+kTeFX2f8Q7jx9zg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5920392168960088624 From: Zhangjin Wu To: thomas@t-8ch.de Cc: arnd@arndb.de, falcon@tinylab.org, 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 Date: Sat, 15 Jul 2023 17:23:01 +0800 Message-Id: <20230715092301.339180-1-falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <34b21ba5-7b59-4b3b-9ed6-ef9a3a5e06f7@t-8ch.de> References: <34b21ba5-7b59-4b3b-9ed6-ef9a3a5e06f7@t-8ch.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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 > 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) > Great, it works and it is minimal enough ;-) Thanks very much. > > > > 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. > Yeah, but let's reserve it as-is for we have the working omit-frame-pointer now. Best regards, Zhangjin > Thomas