From patchwork Tue Jun 20 07:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youling Tang X-Patchwork-Id: 110328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3503699vqr; Tue, 20 Jun 2023 01:11:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46GvuYpxTMu+HPY033rwRQqToYrFVN54jyT32fY/pKOaou1YqXB75Yb7M0KbptY+d0i5Z1 X-Received: by 2002:a17:902:f7cf:b0:1b3:d27b:32b0 with SMTP id h15-20020a170902f7cf00b001b3d27b32b0mr12259232plw.7.1687248660468; Tue, 20 Jun 2023 01:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687248660; cv=none; d=google.com; s=arc-20160816; b=WrIQjAdK03rRxn6u8F75dvsGqeCBI5VFBq90dyJv3TJ4ZuBv3ONw4RgGWe21LgQVsY 4eKdcKv3WyvUhJRtVIflTHXupDqYXlwpiw+zeRm90G7yg56NCh7ONr6foWpZdPhvpfKS Bim1XqT1xILOWI+0Sy0tPRjtQUzM0l9YpGBp1zb4w9nCH/DIMf/7WDHmf6v4PcvO2yxJ MVJRjc41nEVpTH+F5Yu5jAz84WDUYBhK6ceAKoqZgX+ULp0QWxhGTU4wBfpe1CLsKMY8 4ArHfRpxGnxZ5ASdER2MuLBWZI4jVFCgOSA6zvLI4sgIo6F+ti+phtSevXBvWg5RWyra J0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=93ICXbSQyvfRrX88WZsQiok9lzGmilc4WN79+LOiwJ8=; b=Lh8crn5laGtu0mrhOaQ7lKBprX3sIN13q6T0zMNqqpF/i5tydDCuEzqX1+2isQ0YCt y102PVeHcwX3Tqri9G9ixPrtsXiKmE+A2DVQ9LmYl9db1z78kJ2HO/Hgl6Qttrj1A0ZZ GdrfsjvmxobV4/kjpEfan7+/ohYPsyBeubdLHIe5VU7m4LljR9YNTcQwRH77tSCY8gJ5 cHvILbEc/Z/IoCbNucjzQ0dzXmSINQjpi9oEm7oI3bGQqFBDDEqE0EW8iKWq77LwYrF2 1ZhvxhpIbOg6WOjoqplcKV/gIyznondpiHX1wIickexb1VIskW+W6Hd2k5CUcibsWGfA On5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a170902bd8900b001b5621062c4si1376805pls.151.2023.06.20.01.10.47; Tue, 20 Jun 2023 01:11:00 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbjFTHvE (ORCPT + 99 others); Tue, 20 Jun 2023 03:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231574AbjFTHu3 (ORCPT ); Tue, 20 Jun 2023 03:50:29 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 092371704; Tue, 20 Jun 2023 00:50:26 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Cxe+pBWpFkmhsHAA--.14556S3; Tue, 20 Jun 2023 15:50:25 +0800 (CST) Received: from bogon.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxPMo+WpFkp2chAA--.19067S3; Tue, 20 Jun 2023 15:50:24 +0800 (CST) From: Youling Tang To: Josh Poimboeuf , Peter Zijlstra , Huacai Chen , madvenka@linux.microsoft.com Cc: chenzhongjin@huawei.com, WANG Xuerui , Xi Ruoyao , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, tangyouling00@gmail.com, youling.tang@outlook.com Subject: [RFC PATCH v1 11/23] objtool: Add annotate_reachable() for objtools Date: Tue, 20 Jun 2023 15:50:07 +0800 Message-Id: <1687247415-32057-2-git-send-email-tangyouling@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1687247415-32057-1-git-send-email-tangyouling@loongson.cn> References: <1687247415-32057-1-git-send-email-tangyouling@loongson.cn> X-CM-TRANSID: AQAAf8AxPMo+WpFkp2chAA--.19067S3 X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoW7Zw13Cr45Gw48GFW7KrWrCrX_yoW8Xr15pF 97CrykKF4YvrsFkr1a9w4rKr13K3y8CF1UGrZFq3s8Aa47t3Z3WwnFvanxAay8Cr95t3y3 WFnIq3WDWFyxCFbCm3ZEXasCq-sJn29KB7ZKAUJUUUU3529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUmIb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E 14v26r4UJVWxJr1ln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6x kI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v2 6Fy26r45twAv7VC2z280aVAFwI0_Gr1j6F4UJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2 IYc2Ij64vIr41lF7xvrVCFI7AF6II2Y40_Zr0_Gr1UMxkF7I0En4kS14v26r126r1DMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v26r126r1DMI 8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AK xVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26w1j6s0DMIIF0xvE2Ix0cI 8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVW8Jr0_Cr1UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa 73UjIFyTuYvjxUgc10UUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769208450904580874?= X-GMAIL-MSGID: =?utf-8?q?1769208450904580874?= x86 removed annotate_reachable and replaced it with ASM_REACHABLE which is not suitable for LoongArch micro. Re-add annotation_reachable() for LoongArch. Signed-off-by: Chen Zhongjin Signed-off-by: Youling Tang --- include/linux/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 947a60b801db..6b33de8bf7c3 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -117,6 +117,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, */ #define __stringify_label(n) #n +#define __annotate_reachable(c) ({ \ + asm volatile(__stringify_label(c) ":\n\t" \ + ".pushsection .discard.reachable\n\t" \ + ".long " __stringify_label(c) "b - .\n\t" \ + ".popsection\n\t"); \ +}) +#define annotate_reachable() __annotate_reachable(__COUNTER__) + #define __annotate_unreachable(c) ({ \ asm volatile(__stringify_label(c) ":\n\t" \ ".pushsection .discard.unreachable\n\t" \ @@ -129,6 +137,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #define __annotate_jump_table __section(".rodata..c_jump_table") #else /* !CONFIG_OBJTOOL */ +#define annotate_reachable() #define annotate_unreachable() #define __annotate_jump_table #endif /* CONFIG_OBJTOOL */