From patchwork Thu Nov 17 17:16:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 21851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp522000wrr; Thu, 17 Nov 2022 09:20:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7VKBEDvlFPStlr76mFkL/9Wlb8s8ZWX1smtcY/4netCVoZmqNNtgKUDAOJ3Ke8Jy4jO/xB X-Received: by 2002:aa7:d816:0:b0:458:4868:814 with SMTP id v22-20020aa7d816000000b0045848680814mr3019192edq.190.1668705610690; Thu, 17 Nov 2022 09:20:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668705610; cv=none; d=google.com; s=arc-20160816; b=sIbj0BAebsSz6uwUpviVIeq4qJZ9CVL4RKFIIiNA52QfUQZbPGB+INW5uKNrS5/68s /oH2+SssRFwhQaLzHVg4EsRlKk4QNJmDLzEJwTBetyOuGtKmkBtSZKvmC+Hw4G6QrpLs aIcFn7BjMJD6RXAoFNVI2d6y0PdcmBioDDRA+oUuMmT7HAWtCZTv9v8zgnbdGypLFT1v h48VXQWkacFCSPt74TOkXUNo/U5e3lyHmN0a+WrK2DHR/Ie/YM++y80oMjt/9lU+DdVg Gtm5uOFr8TC4gZpQJvBCkyoWJ82uvWUw8GGhtTabPAxKSUV2jMQGeTiVOBnXVEgBnRl1 uvjg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g45vmLNr3T8L9tQdS63erVOB1IUABPfK3xYft3/SwQE=; b=ZcOK4/D6tcoYMA5/8fE+PlyO9xuiOge+K2ZGdesxEfuX7jVNK5uNOcJ2RGBbBV9ElT +iHHMpewRMVa2g0fTZpqUtyPmbBcot8B/TQRZj4SBYygRXW5hVOUagnBlcc9qjJHtM9M q0lwraU14zB1PlJw5ZSIDEJyKSVupFLrWIMNJpWmkhAt3U681nRuBJTTonU6SNZZ4GgU 9sofm9IcbsItnqrVxignp6WqcSFTQoStxHP9D3HWMzXWaBYhyjT9rijneK7ljWtDOERZ klEE5fIT9m4ALEq0JbxmKZZ0dTEneYlb159aWcKBzE9VlrC5KUPqhV4TeA8qOyf0WrJY GssQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eOQWrIYB; 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 cw18-20020a170906479200b007918f58458bsi1187495ejc.441.2022.11.17.09.19.46; Thu, 17 Nov 2022 09:20:10 -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=eOQWrIYB; 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 S240211AbiKQRQv (ORCPT + 99 others); Thu, 17 Nov 2022 12:16:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240195AbiKQRQo (ORCPT ); Thu, 17 Nov 2022 12:16:44 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B84786C0 for ; Thu, 17 Nov 2022 09:16:43 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id p184so1844066iof.11 for ; Thu, 17 Nov 2022 09:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g45vmLNr3T8L9tQdS63erVOB1IUABPfK3xYft3/SwQE=; b=eOQWrIYB2qxOjWkWNg310qcA4ou1hMsC9SKlnBGThNkTh8lQssJpdFuCNfkbcmMZZ2 TIP3gIme50FkzhTk0v3dumgy8sLrk5rVxJXtkC05iK93vLp8eMaJQZA7QpEzURHF2Y0l 5dqts3tfrh1kcD8TStlC64TvLsUOv5awaK3pMwtZHLKIel8xGt4lL0EcDeBkc9zbFC59 ZGc+77M3IGvV/hwwzC1ZhsuHgF0cuwRANOI+9CHSjCbfdHmRdCIXNMS4LfxvcvNHT2c8 yG49CFG6P5fTPqgOTBMmB6VrO96XMC9CvmJH8jwNhni3POc8j/g3ICRvY+7EyvUq4e89 QLPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g45vmLNr3T8L9tQdS63erVOB1IUABPfK3xYft3/SwQE=; b=uQtlwn97+CnAxI8dcb4go83Jka43zESElPInsUq/EMF0tREGOPt/Npgzd85eNGqK4v MaoW+yRuxzFwPpB1wS13XhA9esKCkA/24zaczjF1c+7VYsrt9a94cmBSFbOwSCrgoneE WpcgsiaDRpuGcK6mKiB2SyIpgRZVOK9V0DR1ESdKpmnT6GMOFguR2+2D/DjsB4PFqYGn 4znBSDYNIPBPNtF9m2YMOH6m5Ulrn9h3tKtUrVcrWjxHPhV7NX3ibSYT5LMiRY7ujYHm QG1d4ZdT//8d5Xeh4WglbXwV/oyM9eihrSfU++jMPh0P3Ii2ZRTSAYLe25Xi7u7D7oSP b2hg== X-Gm-Message-State: ANoB5pmG62p9cDN2VDVt75oak5YhlBhiSzNzsN4PA3cqe0tLQVxcrWcm nZtqZ5/fC2hfpmsj9s5Rf5desUkA/M+7tQ== X-Received: by 2002:a02:ccaf:0:b0:372:4b69:fe1f with SMTP id t15-20020a02ccaf000000b003724b69fe1fmr1440398jap.109.1668705402274; Thu, 17 Nov 2022 09:16:42 -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 o1-20020a92d381000000b002faf6559e90sm495322ilo.51.2022.11.17.09.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 09:16:41 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [PATCH 1/2] vmlinux.lds.h: fix BOUNDED_SECTION_(PRE|POST)_LABEL macros Date: Thu, 17 Nov 2022 10:16:32 -0700 Message-Id: <20221117171633.923628-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117171633.923628-1-jim.cromie@gmail.com> References: <20221117171633.923628-1-jim.cromie@gmail.com> 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?1749700639121493682?= X-GMAIL-MSGID: =?utf-8?q?1749764654077845982?= Commit 2f465b921bb8 ("vmlinux.lds.h: place optional header space in BOUNDED_SECTION") added BOUNDED_SECTION_(PRE|POST)_LABEL macros, encapsulating the basic boilerplate to KEEP/pack records into a section, and to mark the begin and end of the section with linker-symbols. But it tried to do extra, adding KEEP(*(.gnu.linkonce.##_sec_)) to optionally reserve a header record in front of the data. It wrongly placed the KEEP after the linker-symbol starting the section, so if a header was added, it would wind up in the data. Moving the KEEP to the "correct" place proved brittle, and too clever by half. The obvious safe fix is to remove the KEEP and restore the plain old boilerplate. The header can be added later, with separate macros. Also, the macro var-names: _s_, _e_ are nearly invisible, change them to more obvious names: _BEGIN_, _END_ Fixes: 2f465b921bb8 ("vmlinux.lds.h: place optional header space in BOUNDED_SECTION") Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b3ca56ac163f..c17f94785253 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -193,17 +193,15 @@ # endif #endif -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _s_, _e_) \ - _s_##_label_ = .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _BEGIN_##_label_ = .; \ KEEP(*(_sec_)) \ - _e_##_label_ = .; + _END_##_label_ = .; -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _s_, _e_) \ - _label_##_s_ = .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _label_##_BEGIN_ = .; \ KEEP(*(_sec_)) \ - _label_##_e_ = .; + _label_##_END_ = .; #define BOUNDED_SECTION_BY(_sec_, _label_) \ BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop)