Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp581267rdf; Fri, 3 Nov 2023 08:59:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnx3WH7TOLggn0YHAT6Vs+LCBBD29G39d8rGHRGU7YhmgiK0qOJTR40D6GL07S+vPRP2EJ X-Received: by 2002:a17:902:6b89:b0:1cc:6101:20c7 with SMTP id p9-20020a1709026b8900b001cc610120c7mr11474441plk.46.1699027165917; Fri, 03 Nov 2023 08:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027165; cv=none; d=google.com; s=arc-20160816; b=LVkPBAz48klzVaQS90AQdap0YlbKVgtx7jHDTlwegpagdS5beNtPZswyJacMixv4fB /lc5/xRHpgMn3kJDh/81SeRcNKB0zWhmuVP3vOTd9DvQMB/ng8bbg/gUwA5uFdcfxHrb kqVe/J4FgyE5uoVBl8HrGrjpnConu0XLHiuTaeQRoHOOlqGt8/e5XTDm1pmzJqUCTtYE KqvfSZFkL657rewlaKTtDpiGPOt3/PjSpkv/LaAN3lZvvrghVJjyf/cL+g332xeTKlTm zdY7QoYl25RRLcMR9aJK1nWZJomQQBLdANl5NpaaKWOOyybXLweojldEvkjvjCpzC2O0 xFDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=wBvMquVlqkpWEA6y6cYzf5eyErtSgM6WKlT76e6tEtQ=; fh=NvW3CO3GtIHRKW4YFObS4dEX0yL9bbz2APezTtyZGhQ=; b=B4YvovuIWZSpXqUrClPpjf7+fTjAKb68vCwNo/PqKWSI0Uf1spLEBz0E1pceQ2F4gQ wwHfNumana6C9MsQXSg2g/Irjz0kbeed4uEV3Fz9PSjIayJSGrpBIyBPbA+pPWEjQFG7 bRoysrIJOAfe7RFPMMuyCMhFeLecZEJri3f+MVUp9MFXObKToigdk+mxWmNw54YTnJcw wL1gu1jv603JvdVn1d9DKPtdMAeE6XtMcKfLiDFC+/whFT0nJOUyMofpcDZUNvffv+GI GShgnicaQvM+PY7GzxyQxJhRNdIChyJJY6mmUX4gohkHbpdH6H/f7C+OjiXiEPK3who4 OUtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id lc12-20020a170902fa8c00b001c9c733c422si1726005plb.95.2023.11.03.08.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 08:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DB19183C1E00; Fri, 3 Nov 2023 08:59:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344505AbjKCP7V (ORCPT + 99 others); Fri, 3 Nov 2023 11:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344558AbjKCP7U (ORCPT ); Fri, 3 Nov 2023 11:59:20 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5C9D4F; Fri, 3 Nov 2023 08:59:17 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 08:59:25 -0700 (PDT) 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])) -- 2.34.1