Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp585609rdf; Fri, 3 Nov 2023 09:04:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBkttFw2KY+gqfY1sUaayTY5Z9saBzw3nr989LBX65UOgsngd2p0KfDDvt9ywMsPacPBmf X-Received: by 2002:a05:6808:bc6:b0:3b2:dd49:4e9d with SMTP id o6-20020a0568080bc600b003b2dd494e9dmr29852702oik.6.1699027442250; Fri, 03 Nov 2023 09:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027442; cv=none; d=google.com; s=arc-20160816; b=XoozoNvJBM8Ma8jJITH36k40n0wvMpJMke8AIx1GVq/+ZBCEuHA/W3DaLZm16FmfHR hhwqK9KvRamnGwyTUbSzYzZ6yl+Tptyra9V4tKe8iF2JSDX39JP9c487gFYyMAowD7J+ ltycnP9MeLFdT9dpfsFxBbvgCtNUoP27YIvP0t0xFq2tQ46IJ4nP8DWwjq6TfEVOxL1r BnvjTT8w7IdHe47O+VwJ0SAQULYuLgx9HD5Lj/ToKGIjiA72/a0Flffi6Cwqzz+L3lHi lS4CJH8z26WTMQ16yGxTTNKrCtQPjcpJBMp1cPB4XbykUPqKi+cTOECXWpWPPT0YENlb WsHQ== 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=1kK6ZuSLmouKcwypfTS0Df9pjPt7VBA9e17wwKRHkSM=; fh=NvW3CO3GtIHRKW4YFObS4dEX0yL9bbz2APezTtyZGhQ=; b=cmUHhDs3dHFiCoRAY/uDPcg1xM6UrwyKvFYvVmaBCJlceY1GQ0K/WHWgDhcBhTzA/c 8Cl73IR7y0n6/W2cG9qjXkEaAqQ2+wPzMu2SJw23EAvDmaDFobXZnT0hVtUiZXyu+xXx iuKkwpnhKSdVTsbt6YBbnLTHBQzfO3xRTNKe6BpB9JoDOcs02wOD9UkaV2UZPmbEZFUZ m30SpGN4px3cfPd1kFPJsX2agClBFLo2VIhMoJk1eMzMIaOpP92dlOThay0cVR/S8Qlc DUQGkVwqRXOP4EJHmbZ8EzP1ojdVNTClGCMJKtBRpDFDODTQesN9FZBdKzDKtuhHVSml OBtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id fg17-20020a056808641100b003b2f4311ef1si762680oib.297.2023.11.03.09.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 4F57182CC479; Fri, 3 Nov 2023 09:03:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344453AbjKCQDV (ORCPT + 99 others); Fri, 3 Nov 2023 12:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234637AbjKCQDQ (ORCPT ); Fri, 3 Nov 2023 12:03:16 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60516D5B; Fri, 3 Nov 2023 09:03:10 -0700 (PDT) X-QQ-mid: bizesmtp71t1699027375tdhm453g Received: from main2-ubuntu.tail147f4.ts.net ( [202.201.15.117]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 04 Nov 2023 00:02:52 +0800 (CST) X-QQ-SSF: 01200000000000B06000000A0000000 X-QQ-FEAT: NcwpCxVQ7UNhf+mNoYKTlmUzCKrTx3/uLfRK9iw8b01sSRqpsgDYV8WUoq0+F bEVqW3uxHwMcq7cQk2v9IJTcEH5r/B/VLMPT6wOIogDyXcUP+URvzaHAuu/LDdBPo2y2PfX 7Mvj8Mqe2Ivk0sKa4LuqIN72w9m3gc5Lcqg/zqWO640FM0vG0kG9EircxCKhMl7uzB00yoH 1GP93ZVIalqTmrPj4vUjf6sev/hgXIrNQSDbJHjlwx52aJ9EmGcU4IM89eMwaKIUIKHp/FG vghOQ3hDkGX/eU+m4e94hHqprk/L/vOU8YSOvFJylFesXI+PLvYCD4xzTz8P1EhFUlvtRb/ xog9r+mNfQz65z8LEQVxAy/3lxXueH3B9eIMSnlsByWsQU4YjU= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14770929756585809619 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 11/14] DCE/DSE: riscv: build reference for .pushsection in C functions Date: Sat, 4 Nov 2023 00:02:50 +0800 Message-Id: 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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 09:03:53 -0700 (PDT) Add the SECTION_SHF_LINK_ORDER method and the SECTION_SHF_GROUP method to refactor __ASM_EXTABLE_RAW, so it won't produce orphan sections anymore. Signed-off-by: Yuan Tan Signed-off-by: Zhangjin Wu --- arch/riscv/include/asm/asm-extable.h | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/asm-extable.h b/arch/riscv/include/asm/asm-extable.h index d0be5a838242..7164d871e038 100644 --- a/arch/riscv/include/asm/asm-extable.h +++ b/arch/riscv/include/asm/asm-extable.h @@ -13,6 +13,21 @@ #ifdef __ASSEMBLY__ +#if defined(CONFIG_SECTION_SHF_LINK_ORDER_SUPPORT) +#define __ASM_EXTABLE_PUSH_SECTION \ + __LABEL_NAME(.L__ex_table) : \ + .pushsection __SECTION_NAME(__ex_table), "ao", __LABEL_NAME(.L__ex_table) + +#elif defined(CONFIG_SECTION_SHF_GROUP_SUPPORT) +#define __ASM_EXTABLE_PUSH_SECTION \ + .attach_to_group __SECTION_NAME(__ex_table); \ + .pushsection __SECTION_NAME(__ex_table), "a?" + +#else +#define __ASM_EXTABLE_PUSH_SECTION \ + .pushsection __SECTION_NAME(__ex_table), "a" +#endif + #define __ASM_EXTABLE_RAW(insn, fixup, type, data) \ .pushsection __SECTION_NAME(__ex_table), "a"; \ .balign 4; \ @@ -32,8 +47,23 @@ #include #include -#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \ - ".pushsection " __SECTION_NAME(__ex_table) ", \"a\"\n" \ +#ifdef CONFIG_SECTION_SHF_LINK_ORDER_SUPPORT +#define __ASM_EXTABLE_PUSH_SECTION \ + __LABEL_NAME(.L__ex_table) ":" \ + ".pushsection " __SECTION_NAME(__ex_table) ", \"ao\"," __LABEL_NAME(.L__ex_table) "\n" + +#elif defined(CONFIG_SECTION_SHF_GROUP_SUPPORT) +#define __ASM_EXTABLE_PUSH_SECTION \ + ".attach_to_group " __SECTION_NAME(__ex_table) "\n" \ + ".pushsection " __SECTION_NAME(__ex_table) ", \"a?\"\n" + +#else +#define __ASM_EXTABLE_PUSH_SECTION \ + ".pushsection " __SECTION_NAME(__ex_table) ", \"a\"\n" +#endif + +#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \ + __ASM_EXTABLE_PUSH_SECTION \ ".balign 4\n" \ ".long ((" insn ") - .)\n" \ ".long ((" fixup ") - .)\n" \ -- 2.34.1