Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2849246rwb; Fri, 11 Nov 2022 16:15:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KwrKMRtgq3UZhbDrBov4vIUkcGu40Xcicnv2We2KEDvq+88uBiQqGkeZcA0ji2BueI07b X-Received: by 2002:a05:6a00:2985:b0:56b:f0ef:10aa with SMTP id cj5-20020a056a00298500b0056bf0ef10aamr5075878pfb.6.1668212122252; Fri, 11 Nov 2022 16:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668212122; cv=none; d=google.com; s=arc-20160816; b=UGChG4BItuoVzuCrXnNWpHjmfeIhoIuuN2APmF1xH3p/nRCqIdVtHf36sIIXXMB9bz 8yKVkIjdJP5I86kZqDcABa+TdgdZRFunNBHvqIn7wP+uTMfGdE2WR3Awk1GYqAwENcTd MhPqlo6Y1LMpmGeFQ23/VQ0jbuZA3s7WddIJsucM6aT+mb/2uQuNvjp+NLwF7qXcYDnl dkQ/IgIuNZ9lvtq35/AawhWA9pIBE4BFVczfITt3XjZoDLPms3uJSKZgzC336VN5BiBu ie8KKRwglDxDWHYV3G7RRhOh8xfIc/xhi2BtmXsYr8FfIYgaCZFj25L0kES6Aae0df9s aVSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=l8JT9M13sckQglSYnz67/MNWb2IU6rTVr9QN4GzMX8A=; b=aIFeKVOQ51avsayHi4rw/LVsdxXAvUjaX1vhheDWxfWBEZm+pMnftUGaY5VL7rEp/s u4gVTCVg+CXJRnJF4xuUmwfY5Fm47UzDNF9oz1ClKJjlfIwrvoR4ulbeHCSoJODS0+1/ xOARmru98w9LwOTJubTDxkwpYP5Y05jObjxheeECH9WCBZRXtUHSSZ82WS7xWvT9ikxG YX3R4JdCYnssjAeRUlpEqEDngOdE0ynx8B/HPJLPdQlCT6Fc9qXiZIAWvYy4GfrMIUPF S17fd58YKFgZ2ARjb+JZk2dcewVHp7TgOoyeANk6fPzWIucfBWzee38bvGGbUcAmCWTh axEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KPKerYFj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk3-20020a17090b224300b0020b27227d6dsi4770475pjb.6.2022.11.11.16.15.09; Fri, 11 Nov 2022 16:15:22 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KPKerYFj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbiKKX6z (ORCPT + 91 others); Fri, 11 Nov 2022 18:58:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbiKKX6x (ORCPT ); Fri, 11 Nov 2022 18:58:53 -0500 Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4A063FB for ; Fri, 11 Nov 2022 15:58:52 -0800 (PST) Received: by mail-vk1-xa2d.google.com with SMTP id e2so2479451vkd.13 for ; Fri, 11 Nov 2022 15:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=l8JT9M13sckQglSYnz67/MNWb2IU6rTVr9QN4GzMX8A=; b=KPKerYFjBPH1VGbukvGHkYJOu29d46QpHerJau0XCCuhI6njFbTssvaZt3CfuaSe32 XolT/a1CPngFAHqPMlzf6/VK+25cv9nt00C3cZ9d5Rbeu67Gs3RoLzzk4aSwWD1FeNud ujP4tlNpGBsQxwDvlVm1bHcJHjnM5YkYOX+OpaEXIXYHdbxGywMYdB8d+7xztrWiu6Qe W3eDUYTV2UDyqlpLUpv+oZqLyuLl2JPMBfR/HC4RdY9qrC/UY4sBTNbcrlxPqFUrVlQD 8gXW8w7xEYm7FIyp84wSy+qi3ghHcEWdZ77ecFbFqDDQzTVxNnU2GOJuNevfL6RacsKy un2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l8JT9M13sckQglSYnz67/MNWb2IU6rTVr9QN4GzMX8A=; b=uYRho4peeOMg/O8z7xBWaGwnFMufuXwZGRs3ah7E2BcVU1llAvXjUXOkCn+OsYRYcr 2gBAklN/tpBFPV7u7ezS2kfYTW5zWJnFqKGJPXSGZ1Htj7z/0nfgKHxRW4RWArNOcY9o nBCqPgVgyVXjKdwgnXHG0f4uNhkcAv2IybIvIDwlzQcjms4PLJL8HiK2Xpkuzf6kjsyt pgCzm/pt6S6a0nfGog8TgXX/nqwFDu7+L/Kor1wOYdqv2AeqffYcGzOMXM6nZOVlIN4t 7KkK/roHfr9WaKylq6qoUpIFa7dT5Pmw2U6M/4ROwW5rVvIRQWETbxglrE43onnmRpIZ 3CQw== X-Gm-Message-State: ANoB5pktBe/NqWCCmhhncyAS59AQqCOZm5D/Z7j4Pk8dsal0tPv2JkwS BVKy+rUmWjYs4TLW8q+dY8yHV4x68ocY3Dt+PudnCFhpYEE= X-Received: by 2002:a1f:ac58:0:b0:3b5:719e:d7fa with SMTP id v85-20020a1fac58000000b003b5719ed7famr2204478vke.15.1668211130888; Fri, 11 Nov 2022 15:58:50 -0800 (PST) MIME-Version: 1.0 References: <20221111235341.567987-1-jim.cromie@gmail.com> In-Reply-To: <20221111235341.567987-1-jim.cromie@gmail.com> From: jim.cromie@gmail.com Date: Fri, 11 Nov 2022 16:58:24 -0700 Message-ID: Subject: Re: [PATCH 1/1] vmlinux.lds.h: improve BOUNDED_SECTION macros To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 crap, missed something. lemme fix and resend. On Fri, Nov 11, 2022 at 4:53 PM Jim Cromie wrote: > > 1- replace _s_ & _e_ with the more visibly obvious _BEGIN_ & _END_. > > 2- add a new _HDR_ linker symbol before the KEEP(*(.gnu.linkonce.##_sec_)). > This gives the optional header record an extern'd name/address, > which is "_hdr_", b4/after the _sec_/_label_. > > 3- move existing _BEGIN_ linker symbol after the KEEP. > This insures the extern'd name always points at the data, > independent of whether a header has been defined. > > NOTE: if (start - hdr) { /* section has a header record */ } > > Signed-off-by: Jim Cromie > --- > include/asm-generic/vmlinux.lds.h | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index cfad4511cd68..c9b204b0364c 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -199,20 +199,22 @@ > # endif > #endif > > -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _s_, _e_) \ > - _s_##_label_ = .; \ > +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ > + _HDR_##_label_ = .; \ > KEEP(*(.gnu.linkonce.##_sec_)) \ > + _BEGIN_##_label_ = .; \ > KEEP(*(_sec_)) \ > - _e_##_label_ = .; > + _END_##_label_ = .; > > -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _s_, _e_) \ > - _label_##_s_ = .; \ > +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ > + _label_##_HDR_ = .; \ > KEEP(*(.gnu.linkonce.##_sec_)) \ > + _label_##_BEGIN_ = .; \ > KEEP(*(_sec_)) \ > - _label_##_e_ = .; > + _label_##_END_ = .; > > #define BOUNDED_SECTION_BY(_sec_, _label_) \ > - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) > + BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop, _hdr_) > > #define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) > > -- > 2.38.1 >