Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp659220ybz; Fri, 24 Apr 2020 07:10:30 -0700 (PDT) X-Google-Smtp-Source: APiQypLvPHnrNoZSzSaFB3T4jPmrBmvzasp9llZ2QryyJepopXsSa5BWc5lXW9RQ7+Q6SzAfE8pE X-Received: by 2002:a50:9f8f:: with SMTP id c15mr6857401edf.377.1587737430277; Fri, 24 Apr 2020 07:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587737430; cv=none; d=google.com; s=arc-20160816; b=iX5BNTpQ0isFhkDKPaVd2bdgSUOqjguRi0M4QDQcjtRc9TKpV3p+AxT05LnEnW83S1 fp3pHtIn0No5iw+IwSkJYhCsUmNl5fFZBtjstpy1wochclUfmFo0W2P430sP5S7zPmUO 1N8p7XiemQpy7YC4onn8aXeN+kzZ8+ti9WIH0m8kuMpbrkgYFqmf8aBvxY/o24aBfbSI gEiJbM4CX55uFCHFUvF/HcbIRgWzDANJdWXkynTEgU3rcK6qaOONLR9YTVMVjExjkKWB Jzg2qFpc1Hcq0qRZNzEHWWrhiqnqEnhqXO7nO3iz1hqElkQoO0rC9d67mQ11RuoTSeEN y1Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=V4VoDrSf/kdQzD7N9kYHdPXIfercZb/SRAj5TcNwbEw=; b=pKEnVSVFG5Gnq0dHFcbgaixWUZxRGAuUMyPGIE/4yueaC7ciTkYA6apMqixuvDfDVb kNUFXf8dGei4k5RndodAdJ2nwp9SL/W4VXCD2GEC0Vz+SF2QW6aflLyKFDCXUIcf0eWg 85J5EM0LSV2A77VIxsOdWXYxADhz9mrF6YlR+xD5lUI6vN5GhD1saI85P2GMvpGeGv+y 2PsNVubIFsLNxf0U0iVxRWReBV9gif5Nto5teHs0OYGo7+ThO/aeUtlpTg57pB/QSWQh B+HFzWe/W+Fz/K+bfmBU0sIM7dfhaORNhNEE6iZzphmgPlUrIqGGXH5lyl1Q4shX/tR7 njPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si3008515edp.320.2020.04.24.07.10.01; Fri, 24 Apr 2020 07:10:30 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727971AbgDXOHg (ORCPT + 99 others); Fri, 24 Apr 2020 10:07:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:36964 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726993AbgDXOHf (ORCPT ); Fri, 24 Apr 2020 10:07:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D7E86AEC3; Fri, 24 Apr 2020 14:07:33 +0000 (UTC) Date: Fri, 24 Apr 2020 16:07:33 +0200 (CEST) From: Miroslav Benes To: Peter Zijlstra cc: jpoimboe@redhat.com, alexandre.chartre@oracle.com, linux-kernel@vger.kernel.org, jthierry@redhat.com, tglx@linutronix.de, x86@kernel.org Subject: Re: [PATCH 4/8] objtool: Add support for intra-function calls In-Reply-To: Message-ID: References: <20200423125013.452964352@infradead.org> <20200423125042.794350465@infradead.org> <20200423152243.GV20730@hirez.programming.kicks-ass.net> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > --- > > diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c > index 6340ea0dd527..be6520155cfd 100644 > --- a/tools/objtool/arch/x86/decode.c > +++ b/tools/objtool/arch/x86/decode.c > @@ -100,6 +100,7 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, > rex_x = 0, modrm = 0, modrm_mod = 0, modrm_rm = 0, > modrm_reg = 0, sib = 0; > struct stack_op *op = NULL; > + struct symbol *sym; > > x86_64 = is_x86_64(elf); > if (x86_64 == -1) > @@ -496,22 +497,24 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, > *type = INSN_RETURN; > break; > > - case 0xcf: /* iret */ > - *type = INSN_EXCEPTION_RETURN; > - > - ADD_OP(op) { > - /* add $40, %rsp */ > - op->src.type = OP_SRC_ADD; > - op->src.reg = CFI_SP; > - op->src.offset = 5*8; > - op->dest.type = OP_DEST_REG; > - op->dest.reg = CFI_SP; > - } > - break; > - > case 0xca: /* retf */ > case 0xcb: /* retf */ > + case 0xcf: /* iret */ > *type = INSN_CONTEXT_SWITCH; > + > + sym = find_symbol_by_offset(sec, offset); sym = find_symbol_containing(sec, offset); of course > + if (sym && sym->type == STT_FUNC) { > + *type = INSN_OTHER; > + > + ADD_OP(op) { > + /* add $40, %rsp */ > + op->src.type = OP_SRC_ADD; > + op->src.reg = CFI_SP; > + op->src.offset = 5*8; > + op->dest.type = OP_DEST_REG; > + op->dest.reg = CFI_SP; > + } > + } > break;