Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3855448pxb; Fri, 11 Feb 2022 09:10:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+G906JA4+wzRgZUOgU2w557xaYKHXZqc/x/ek1aR8Pu6fQWs88M5GfAMdoVWpyAnstuBe X-Received: by 2002:a50:f09c:: with SMTP id v28mr3029197edl.5.1644599455338; Fri, 11 Feb 2022 09:10:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644599455; cv=none; d=google.com; s=arc-20160816; b=QDel7C0oJQK7nRvPEeprUkJu/sjXjtd8ul7UHXAY9+mj9SVnXxnsa9FVF183gaVIs9 U0pbkernP9bBbk16vMEIv1YsX8Sq7i9VTvR3HRdNXbfrHUj+xj/3wOYFYGW6Zkcd5J6F xD2w6uq/cQfWpUMO4nkR/gnncUwq6OReX+/zjT61f+QDfxCMCjvb0wVno2GTUfIobppL Pzccx5PixyyZQ044OZNEponHo61VuxHEQXfRtmlrgNkigXcaU4lmKu9fLDOB4HHQkEw0 jyekhEPuFhD5+4goPEslBQC/bo/6ENCDX2tE2/45WkK/CNJkmpFDamYiXTwrRWmO7NMF 97wA== 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; bh=jNm5Sass78OBD9qhUWi72n5OkyUGbjalFN3bxbeFLW0=; b=r0kIx0MmzhiPAZrOuzUEj1m4TEHjoh7YM9DRju+R515thNb4TzcUu2fLD/UPSVP3hV +hK0UOrG+/rTOA5fmkN8j/avGDV0cZO1jLvajmy+C6tKzy5mWUsVijBGlICicsmZmA7c MpF3Vt0/8Cs1uKnwemdSkrgCtbMsFAuT8/qZVa7BazcAwvuBkceaBSJ/6FFuqXafVs2s ofzoHUJJK8iKuCEx2iZ6VfDNLD246SsanEJlPGckGGv7+2W6D4FEE43NYeV72OXKXbgs /ZdopHExAxRJvGZGbY1/nK52UuElEXCqZrChuLWS7R7isLTfQbbB6mRIS8o9V4+SA8G8 7Llw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20si15033792eje.135.2022.02.11.09.10.26; Fri, 11 Feb 2022 09:10:55 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350517AbiBKNZF (ORCPT + 99 others); Fri, 11 Feb 2022 08:25:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239313AbiBKNZE (ORCPT ); Fri, 11 Feb 2022 08:25:04 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D46D5D54 for ; Fri, 11 Feb 2022 05:25:02 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7C42C1042; Fri, 11 Feb 2022 05:25:02 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.87.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 11A773F718; Fri, 11 Feb 2022 05:24:58 -0800 (PST) Date: Fri, 11 Feb 2022 13:24:49 +0000 From: Mark Rutland To: Nick Desaulniers Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , acme@redhat.com, ardb@kernel.org, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, jpoimboe@redhat.com, jslaby@suse.cz, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de, will@kernel.org, llvm@lists.linux.dev, James Y Knight Subject: Re: [PATCH v2 2/7] linkage: add SYM_{ENTRY,START,END}_AT() Message-ID: References: <20220125113200.3829108-1-mark.rutland@arm.com> <20220125113200.3829108-3-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, 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 Fri, Feb 11, 2022 at 11:32:27AM +0000, Mark Rutland wrote: > On Thu, Feb 10, 2022 at 05:20:10PM -0800, Nick Desaulniers wrote: > > On Thu, Feb 10, 2022 at 6:52 AM Mark Rutland wrote: > For the expression > > > > > .if (qwerty_fiqin_end - qwerty_fiqin_start) > (0x200 - 0x1c) > > > > can you use local labels (`.L` prefix) rather than symbolic > > references? or is there a risk of them not being unique per TU? > > For the problem in this patch I might be able to do something of that shape, > but I'll need to factor the SYM_*() helpers differently so that I can use > labels for the primary definition. FWIW, that refactoring turned out to be easier than I expected, and I actually prefer the new structure. I've ended up dropping this patch, and in the next patch I leave SYM_FUNC_START() unchanged, but calculate the size in SYM_FUNC_END() and propagate that to all the aliases pre-calculated: diff --git a/include/linux/linkage.h b/include/linux/linkage.h index dbf8506decca..027ab1618bf8 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -165,7 +165,18 @@ #ifndef SYM_END #define SYM_END(name, sym_type) \ .type name sym_type ASM_NL \ - .size name, .-name + .set .L__sym_size_##name, .-name ASM_NL \ + .size name, .L__sym_size_##name +#endif + +/* SYM_ALIAS -- use only if you have to */ +#ifndef SYM_ALIAS +#define SYM_ALIAS(alias, name, sym_type, linkage) \ + linkage(alias) ASM_NL \ + .set alias, name \ + .type alias sym_type ASM_NL \ + .set .L__sym_size_##alias, .L__sym_size_##name ASM_NL \ + .size alias, .L__sym_size_##alias #endif I still think that in future we *might* want to be able to use two non-label symbols (in the same section/fragment/etc) to generate an absolute expression, but that's not a blocker for this series, and for the common cases (e.g. checking size) we can probably work around that as above. Thanks for looknig at this! Mark.