From patchwork Fri Nov 3 15:58:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuan Tan X-Patchwork-Id: 13444658 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19B53C4332F for ; Fri, 3 Nov 2023 15:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WFq4gpyrqCAd9NblLMNfqmR3btNX45E5Q6ib1tlUN2g=; b=P0paLojKdEhumh zlePrcIgsIPEXMm7hnn1L6hSz+fNjUXoHFIW6Xc2qQwEtn2rGymgYvOz9+snP/44FsgYfCmTnPqc+ L7gFl/6IfIzqGeGxclwqa8okz/z8RfGFhsxTZ30XuMCHBLbID2bGrt99UD8ScK92lonD6aKiWgUqs F9x6itAwQkMWwHDM5vsJ9CXutid2SmO1w2bkb26ETESl89F7PvEY+kUcK/02yposjlIZe+vPbQTOZ oh4JhwOej81kWeXtm/y3OcRznD/nuE7P00Af5uIMs/Nle13FUsbnHYVLuS51M9/9+OxItqy2GWXHv LM8fdbkp7PLp24gSAsrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qywZw-00BjTX-2X; Fri, 03 Nov 2023 15:59:24 +0000 Received: from bg4.exmail.qq.com ([43.155.67.158]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qywZt-00BjSD-0F for linux-riscv@lists.infradead.org; Fri, 03 Nov 2023 15:59:22 +0000 X-QQ-mid: bizesmtp87t1699027144tuxhh48b Received: from main2-ubuntu.tail147f4.ts.net ( [202.201.15.117]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 03 Nov 2023 23:59:01 +0800 (CST) X-QQ-SSF: 01200000000000B06000000A0000000 X-QQ-FEAT: LE7C6P2vL8TDvuFtQgm7U5nmg5IefRLiYgMU7BisqY8a+MfFY5YFw57t6eU2N mHG9XUzklv0HbI1UYbnludIhogZCI7W/IazcZj+b/17hSpDlk9STyb/1qy8aOE2wUbOzCOZ EJn/pf7LRNuuDgsl1ei03i4F64rI0B4WYb761k/inK0WMo/2LPTxfduiL64kC54tN2qYj6t hSep7h9sssI09uh7yXGRmhB/6Z75f2XrvS/dhZRHxDT6hhxRWQRSbLi4gjCZaegiLml9nXo uSCfn4EBkxIyImAQMxNPNtmyG7cYWqYRM00FNDOSz631ECpoP+OjLEe1sXE5O7xcvql3Riv 8CaSaqWCZoYQNtMBmJ3hnYreg2Te9iyb3F76nRBVtDUVxQ8ajDjjBSD9mAMXg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6960832744754887515 From: Yuan Tan To: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org Cc: linux@weissschuh.net, palmer@rivosinc.com, paul.walmsley@sifive.com, paulburton@kernel.org, paulmck@kernel.org, tim.bird@sony.com, tsbogend@alpha.franken.de, w@1wt.eu, tanyuan@tinylab.org, i@maskray.me Subject: [PATCH v1 03/14] compiler: add unique __SECTION_NAME() Date: Fri, 3 Nov 2023 23:58:59 +0800 Message-Id: <3c10b123c7ec27fbd942dd9a07d877743616c935.1699025537.git.tanyuan@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_085921_420744_A1B4FF49 X-CRM114-Status: UNSURE ( 5.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Zhangjin Wu The new section helper is added for LD_DEAD_CODE_DATA_ELIMINATION to generate unique section name (strigified). Signed-off-by: Zhangjin Wu Signed-off-by: Yuan Tan --- include/linux/compiler.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 405b19cf6cf3..5a9cc3209b12 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -227,11 +227,25 @@ static inline void *offset_to_ptr(const int *off) #endif /* __ASSEMBLY__ */ +/* Import __stringify. */ +#ifndef __stringify +#include +#endif + /* Quite-unique ID. */ #ifndef __QUITE_UNIQUE_ID # define __QUITE_UNIQUE_ID(prefix) __PASTE(__PASTE(prefix, __LINE__), __COUNTER__) #endif +/* Quite-unique Section NAME. */ +#ifndef __SECTION_NAME +#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION +# define __SECTION_NAME(prefix) __stringify(__QUITE_UNIQUE_ID(prefix.)) +#else +# define __SECTION_NAME(prefix) __stringify(prefix) +#endif +#endif + /* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))