From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3226DEB64DC for ; Mon, 3 Jul 2023 10:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbjGCKLx (ORCPT ); Mon, 3 Jul 2023 06:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjGCKLw (ORCPT ); Mon, 3 Jul 2023 06:11:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E5718D; Mon, 3 Jul 2023 03:11:51 -0700 (PDT) Date: Mon, 3 Jul 2023 12:11:48 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1688379110; bh=JaQoe8ZfDwifbQM153siZCvI+TDzLOP02eBD2RQK1NA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sBDpJhgjTVhhWVzcennscDyTI4F6KXTA+3SID8ccsEI7fBqVLT0j+EFiRgGlpMteR dc1qrQ1p4Yw5N3lhTor9LB5hr3ZuMjHDPGHt4lROhnoRz6fPoHSaPfJZIsbTRT4aky DBGFNlobetNOHs0+g7q8GY1YyuOi8T2URyZvJTiI= 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, linux-riscv@lists.infradead.org, w@1wt.eu Subject: Re: [PATCH v1 03/11] tools/nolibc: include crt.h before arch.h Message-ID: <8efbbfe5-1c3f-46df-9bc3-2ba62015f17e@t-8ch.de> References: <20230703095832.493137-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703095832.493137-1-falcon@tinylab.org> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On 2023-07-03 17:58:32+0800, Zhangjin Wu wrote: > Hi, Thomas > > > > > On 2023-06-29 02:54:35+0800, Zhangjin Wu wrote: > > > The crt.h provides a new _start_c() function, which is required by the > > > new assembly _start entry of arch-.h (included by arch.h), let's > > > include crt.h before arch.h. > > > > > > This '#include "crt.h"' doesn't let the new _start_c() work immediately, > > > but it is a base of the coming patches to move most of the assembly > > > _start operations to the _start_c() function for every supported > > > architecture. > > > > Why don't the arch-*.h files include this new header? > > They are the users of the new symbol. > > > > I have tried so, but since crt.h itself is not architecture specific, add it > before arch.h will avoid every new arch porting add the same thing again and > again, currently, we only need to add once. I have even planned to move > compiler.h out of arch-*.h, but not yet ;-) While this saves a few lines of code in my opinion it hurts clarity to rely on implicitly pre-included things. > every new arch porting That doesn't seem like a very frequent occurrence :-) > And also, crt.h may require more features in the future, like init/fini > support, it may be not only used by arch-*.h files. Do you have a mechanism in mind that supports init/fini without needing an ELF parser at runtime? I guess an ELF parser would make it a complete no-go. Also the value added by init/fini seems fairly limited for a statically linked (tiny) application. > [..]