Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1131083pxb; Thu, 4 Mar 2021 04:14:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQfRknxa1C9yf0CIN+0+n062EgqUf87AOYXz53h9NTpukdI1HmdGwuXc2VW4dY/6hLP3AQ X-Received: by 2002:a17:906:d1d5:: with SMTP id bs21mr3990314ejb.242.1614860097930; Thu, 04 Mar 2021 04:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614860097; cv=none; d=google.com; s=arc-20160816; b=sUCCCbhbqoNq1vnzs0mj4MsYTCwsKhLOqw6KalWeHjF5WklRMcllGsxM+7/Dkbh0oW nPT86yUC94RAY6/UYOoJzHOOr+FiW9jWJonPCsE5BiOQ2HTPX1PCE+RB2A8PNxq679GV A4cdowGp1IXhWsXpFUD25HGPadlRqdD//99jPC+e4DjEGqNxeglSclbrC5Waq5yJEivp 9qlYH/6Hn3jL9TBTVVLGxyDDPeuoLLCL18mf3a6puwnVkZ5xyz2J74yoxa1G90JlGjB9 d5UJ5mEYoDd3FPY/jpYVF/9zP6XIrOJVaqySe0z6/56PdmIZEQQ29p42ioeCM29JKqvo U2pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4mYRxjaYFimzJkE35k0hSqse9qtwA1S+xm+5PuBe57Q=; b=O1cDBLNAaMMm8mCvJlsfWUwHRAa7wOVuD5d9UpBKUTzUVP+D8Fe54+yvJuQScAPIBL 4Cgqcr2O7OduusUj59PS6RMiT+avaLDCLX85c6+JMka2Z1vjd06x9Ovkjop+hudYoYdz 49vZktqhj40A4xQaYx5pbzcN0MvAYH7csOdHG/9s1CuJkzT2tXcNflOSQQgCTAEBDI6e HGQ2RwKdCaXIX0a0Ur7TZ/fI9Fn3cnIZv2IV9aDC4qnb+XGGwJWS2cvuY4/qx/SwpKQr EcO8qaCS1lXKyqaSnv/Ljhm80b8Oswbu9S5j5B8mzx53SnaWWZP5PU1jRMeY1szQamOw 3UeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F0vX3h+V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id se21si12645886ejb.558.2021.03.04.04.14.35; Thu, 04 Mar 2021 04:14:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F0vX3h+V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580294AbhCCSdm (ORCPT + 99 others); Wed, 3 Mar 2021 13:33:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49819 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236269AbhCCRLg (ORCPT ); Wed, 3 Mar 2021 12:11:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614791397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mYRxjaYFimzJkE35k0hSqse9qtwA1S+xm+5PuBe57Q=; b=F0vX3h+V6dwrQiQhV5ncOVcDy9wsgLwZ1KXU+QPplG4VhiVGrNJFMIuE7S+bz5T4hxqCEj r3k0ZCPKE1ugi92PXjEvtjBMMDzkRG9IdADgV+K1tnx6Y7rxlUipKB4jFFXyPBuXrE2l4m SQHW3BEoJemN7qxTDBcmyrnxirh0ZFk= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-ok1-c--hPKyq9Pue_3FKAA-1; Wed, 03 Mar 2021 12:09:55 -0500 X-MC-Unique: ok1-c--hPKyq9Pue_3FKAA-1 Received: by mail-wr1-f71.google.com with SMTP id v1so2494336wru.7 for ; Wed, 03 Mar 2021 09:09:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4mYRxjaYFimzJkE35k0hSqse9qtwA1S+xm+5PuBe57Q=; b=hiPEm2RF5clunDnbMWrifFj3FDava/AUNQTwLcL1DNxS6Ij1wpz7ZQU5t4ryeiKFBv iFuwntlid5B9dKkIGELtZHYhpnod8dSIYlMAJlpV4q3akJrCiZpUmE+97Wvm81eXl6Hn 7CnnxPnrfyFBqcGhXPL5j4PvFb9VGha8KSE0ByJdHAyt/NuMAnrPj23BoCHxtXmftv7u otToLPBvolzFgMMx5tnKKAnIs3tPL+bn2IiblymywqGIbxkRmTmR266pKbsGMxYEeaLh qxUcceiGYYn0J5CucqCw0B8u2MNHf3zxVsPkrioBD4cSW+VxUcajlM3uNzuQ8h6qe5a2 k69w== X-Gm-Message-State: AOAM532OGyuZ6cbJ/gqAnaeultaCtyQ+SignGedOFMMqrCpmKIPdkc/+ VA7zmZ4coknW5OVux6AGQZm7Fco8YlO0uGmeqr+pAhzzsUL/KtmT5h+zz+P8XZElX+v12H6Q3GN A67M9Kj2l0Ua//WNesn3lnDR367BZlJl9E0zE7rnZYA6hmWeDyRbUbLqo03njK58g3Fk/loSq1p ew X-Received: by 2002:adf:ef4c:: with SMTP id c12mr28586351wrp.112.1614791394001; Wed, 03 Mar 2021 09:09:54 -0800 (PST) X-Received: by 2002:adf:ef4c:: with SMTP id c12mr28586331wrp.112.1614791393855; Wed, 03 Mar 2021 09:09:53 -0800 (PST) Received: from redfedo.redhat.com ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id r7sm33066226wre.25.2021.03.03.09.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 09:09:53 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, ardb@kernel.org, masahiroy@kernel.org, jpoimboe@redhat.com, peterz@infradead.org, ycote@redhat.com, Julien Thierry Subject: [RFC PATCH v2 11/13] objtool: arm64: Handle supported relocations in alternatives Date: Wed, 3 Mar 2021 18:09:30 +0100 Message-Id: <20210303170932.1838634-12-jthierry@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210303170932.1838634-1-jthierry@redhat.com> References: <20210303170932.1838634-1-jthierry@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.25.4