From patchwork Fri Nov 11 23:53:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 19063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1031497wru; Fri, 11 Nov 2022 16:09:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf73wTFDGI66Uwd0ODSO3J6burpBLdc1LH/nIfOTic8vXcQO0jHfIt53Met97mFugWYs3OfB X-Received: by 2002:a17:90a:4804:b0:212:d6ed:cdf5 with SMTP id a4-20020a17090a480400b00212d6edcdf5mr4161560pjh.142.1668211786088; Fri, 11 Nov 2022 16:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668211786; cv=none; d=google.com; s=arc-20160816; b=njg2C1LLxiY5Cr0K74t79T9QmwyAkTJjW/1m9ZEiO26NQUn/GYJMLdPZbf3/aYyz9J yBhEkGTk42dvIVIjzG8wykwBM0Ic1K+1tJ0rf5z7eusAFR/p0xo/ohvABwTm9W0XTNZD Z3b3fV8aMVwzAqy0PtlWk/+N7pmDoNkpfGHMDscxzfBPlijsT3x4D3GBkKs1BZD6azpo w8kXLACyU7Zr8E3xGbtnbt1qFeCXpN5RhajcEO445ZScCj/TztSFqK6cJ7IwYz38Er+p XYK1Ke4i79VmgzwxUZ3LjiZZIKkVYesHCOVpbSxJWecoFScC+ZgHfkdZ5CJ/gu+SkgST MdDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mDC3yaSpzn6xQIRdL0a12mrbMLjfHFMInVN/5qQvsDc=; b=jg/iMJq/1pJWxyPkOmVnpve3jLNjiEnPTsbozYcuCua2gkVykUPv8CXCa891iU35Hb Tf/PQeQhEzN7ZPClytB7fLjMqf6tS++/QfYckLZ3E6VbF/zRgeBjyUPO9YtuKZt+ZCwX COCz6/3SivT865qVUyRaJIVFvz7R2r03SYwQxmyvLtZvRWZ5as2CnlpXTa5X/JPcWsog 2z/HeEgwHMzmxjrGmGn+n2v2LBM9BWaXNbyAMq5tFpdS5DdvDXgTc7ivx6rJLc8cEYWP nRtFevTFO7uejVwD8MIYn2h/foML+FCOhfDw2bQFmrRjLnnL2FtTEPzeopWCanZU/fQ/ 31gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MlQ6f2v1; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i129-20020a625487000000b005633c373dcbsi3224357pfb.147.2022.11.11.16.09.33; Fri, 11 Nov 2022 16:09:46 -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=MlQ6f2v1; 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 S234678AbiKKXxs (ORCPT + 99 others); Fri, 11 Nov 2022 18:53:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234689AbiKKXxq (ORCPT ); Fri, 11 Nov 2022 18:53:46 -0500 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 414BD27FEB for ; Fri, 11 Nov 2022 15:53:45 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id s10so4662807ioa.5 for ; Fri, 11 Nov 2022 15:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mDC3yaSpzn6xQIRdL0a12mrbMLjfHFMInVN/5qQvsDc=; b=MlQ6f2v1QjZgYotknfDEoyhiJJr3J0ffm+KlKSwJM0NbCdg/ok2Nq+ViySlaE34tgH Dj83WlRJC1i2sgx0Whctls3St3xX/gPWKxQ+Zxf4mj8VmdAQSQOKR7pPshjLil0qtKg0 TvrC5xTm/XxajPsWFmv4oy1DJyjdKa1SZZIvCx2JXtuRfJ9r4KVjPfYpd5TI4OCE165f Mok4UrbcI2R5lCere/OYYqrHu5PGUje9IHG89wKbPPi24skNKrRBoPtqWQLkdDnlZi7t Nk66wxKtm9+9Xt2pL2waiHfhiTquHAGExaxvrnncTgZqRl8zIt9zDfJvkRcM8E/OclrV ZhYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mDC3yaSpzn6xQIRdL0a12mrbMLjfHFMInVN/5qQvsDc=; b=qJuAWJHbA/7BFnx1LpEYB8pkZeahwq5m4liz1aOYLu4t+oIOFR7mgGEf4YNVVQ008g 65lu4sSFJVAAi9phk82+Gel40J3UmC5g3y+vYcSfvLEgJhKSfJr7U9l2MzoAskBM9DTH GSh1P92xsMb3LhxESCtrKlg199BF/K/lt/HUIogQwN5Aa7UxPYAis+KaDOgCz/gorkSB mffyY4gPPdc0siVVZJBfBPPgP75RKo1NKQ76AAQQCL21wTnlCn/SL+PLBSj6l5zEs2MM +Fk0wkCG8k3VBVNbRuzRP7cc++qY1mP/SVIbNjojIKBBpSpzVYt/TUjFhm8jhQs8z2HP G1YA== X-Gm-Message-State: ANoB5pkakMoQpz/UcB74laSRQIbTfNhzfzQMHTXp1ziUNC4MAIu/dJzt xPDr+sUFaHMmYgacQ2RgVWPBGP13rqSjMA== X-Received: by 2002:a02:ccd1:0:b0:375:4dc7:d3ed with SMTP id k17-20020a02ccd1000000b003754dc7d3edmr1847647jaq.262.1668210824268; Fri, 11 Nov 2022 15:53:44 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o18-20020a02cc32000000b003634aa4a55asm1249355jap.82.2022.11.11.15.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 15:53:43 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org Cc: Jim Cromie Subject: [PATCH 1/1] vmlinux.lds.h: improve BOUNDED_SECTION macros Date: Fri, 11 Nov 2022 16:53:41 -0700 Message-Id: <20221111235341.567987-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749246807208450381?= X-GMAIL-MSGID: =?utf-8?q?1749246841893473053?= 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)