Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp41168pxh; Thu, 7 Apr 2022 13:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyglukqN3BAQDxn44lwTIihu1leEi4KjjMiOC0PFfWl2LE8Vwhw/DydCwAxFBwQ993QFSdL X-Received: by 2002:a65:654f:0:b0:378:b8f6:ebe4 with SMTP id a15-20020a65654f000000b00378b8f6ebe4mr12521936pgw.399.1649362924811; Thu, 07 Apr 2022 13:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649362924; cv=none; d=google.com; s=arc-20160816; b=ZHiAST6vmAzsyrffNBq9q+LbDJQnVM5bEO8qlGw4DGvra6o8L9FNRq0L2EqYSmoL4p Ekn1EZbwuIXiI4Q05r6Oe59fjPBxUtKrveX0Aj2MJn/qwgwxf7JM3F5B4sZHk0cOH5qR ZVy5JJ/GK4R8kR4JhN+WOXQsYnqaOcBxWUr/7Y4vRdkoMiKqrfTXekaslQD844pmub85 9wS6TulSGpVHH+E0foejqIbgPomk+4+ckQThDyJnyLj5MgQL00R0dr0wKFfCvTOTfShP aBKgPeDzN5iV4D5XRx9q1rXpjSZSk5nCc2+s0PN1B7DN9b9nbHrMGTTUCftWZ5QSs+Vz yJfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=J4T76AiGmylkObyr4VKsyOiDqJysXrqni3Ql9oPXPFk=; b=f1tMQyD6SovyQuFB3tcLJ2OyeQEa1EEaKTvQR/6kH9DbRwahRtlqlbW2SO+VCdIKhA 3Mxokh2fQ+UlLdYQ68f5OZKF97CFW3gRvuFnSY+KZnsgP1rMC3KWQu0aVzeUPUl5oDDK D0Bqb7oeQ/Vo4LC2jKAn/O33jPq1e6kQHemp6chxrZg2hFzW/YVZPi3lP5+9vHICxSd6 daRXCerpLE+9dxFHI90PYNQhRgdGJu6QGbfzz+U5k86oTUmyw1+T+n2Kze3yBTi18uSc 0pf4PCrblSWNQaUPOebTHjQVNGN4b7IuGRhCsjNAsMI9KgBOahvSzBJmVmp8w4uDRSNU suEg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 201-20020a6301d2000000b0039cbfa0d068si3928796pgb.3.2022.04.07.13.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:22:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6A14340884; Thu, 7 Apr 2022 12:39:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245164AbiDGMFs (ORCPT + 99 others); Thu, 7 Apr 2022 08:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240664AbiDGMEi (ORCPT ); Thu, 7 Apr 2022 08:04:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C8E5C1CAC for ; Thu, 7 Apr 2022 05:02:36 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KZ0MP3VlvzgYVw; Thu, 7 Apr 2022 20:00:49 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 7 Apr 2022 20:02:34 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 7 Apr 2022 20:02:34 +0800 From: Chen Zhongjin To: , CC: , , , , , , , , Subject: [RFC PATCH v3 11/13] objtool: arm64: Handle supported relocations in alternatives Date: Thu, 7 Apr 2022 20:01:39 +0800 Message-ID: <20220407120141.43801-12-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220407120141.43801-1-chenzhongjin@huawei.com> References: <20220407120141.43801-1-chenzhongjin@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Julien Thierry Based on get_alt_insn() in arch/arm64/kernel/alternative.c, arm64 alternative code adapts offsets for static branches and adrp instructions. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/objtool/arch/arm64/special.c b/tools/objtool/arch/arm64/special.c index 45f283283091..a70b91e8bd7d 100644 --- a/tools/objtool/arch/arm64/special.c +++ b/tools/objtool/arch/arm64/special.c @@ -10,7 +10,11 @@ bool arch_support_alt_relocation(struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc) { - return false; + u32 opcode = *(u32 *)(insn->sec->data->d_buf + insn->offset); + + return aarch64_insn_is_branch_imm(opcode) || + aarch64_insn_is_adrp(opcode) || + !aarch64_insn_uses_literal(opcode); } -- 2.17.1