Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1963198ybg; Thu, 30 Jul 2020 07:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAPmvlfhf+mgG6Iswvzuv4mULu9qkO2ovDFuyd3zb7fYltiBM/Oe0Y8QwWW6lxhtPaOcar X-Received: by 2002:a05:6402:1f8:: with SMTP id i24mr2789383edy.251.1596118333740; Thu, 30 Jul 2020 07:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596118333; cv=none; d=google.com; s=arc-20160816; b=CrsZORsvFuQWw6BkA6yFRshMzeXd3FDmMFQ4ITtPTJZx1BNSlPr+XGU0SVSr2qjjnI HqFpWaan/i4FuaAcPULl8rvc8LlhINt5eNHt0h8iGLc5lQbtsggdOgyOq+yJ2cd3j+fA fioA2JQZAHFAlnVhr2HYR3oIiHtSgvHAQnKvtkUzeGQ8n5jdsL6KqDbMjktI0/7pOtry icNDIVBBXXaghgSO7O9UmNzRFOBphnXQ44uDH7EOEMY8clLntCctyZzdDAHBN0eTbk2u RhpvMykJi6hc71YydzbuRiqB03ibpVNJZ1YAnbLitnhINAgHz7ZoCOKAqsXplWEfcIKS qw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6WINITRrttu57H5Ow4z7uhB5cozF06t59zUSHHbIkJc=; b=VJWJR3/wYUnV4P8YCRtVLciQNIOTye8vTL4oF0Fehm9U7A24dyot53Q9g/BpLr79Sd TQxivhhLVRW9SbVgx3w/IvwuJXdbzJU2L2QVMnAGf23068vPUQ78HhhazCFKYHjxNvQA dOV1WyKs3x/4O8OCpT+NpcRaJ/N49czftN7nnJBAtbhxefPGsk4u1KefIObIss/QJlPl 7hnvl2D8voE1PdyHGJWiz3iJCZ+Bv6veOJ+VNm266wdI3Zz+IPs5kRC/wKXLGm2pxlLY v792AbOpEIgguEygcO4Kzz8nT3yaQy0DYlVxI3LkOs4l2b8eOxrUicK3gM6mOA/fiorD oWew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bgHF5Mq7; 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 r9si3175975ejp.629.2020.07.30.07.11.50; Thu, 30 Jul 2020 07:12:13 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bgHF5Mq7; 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 S1729252AbgG3OJp (ORCPT + 99 others); Thu, 30 Jul 2020 10:09:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37742 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727776AbgG3OJp (ORCPT ); Thu, 30 Jul 2020 10:09:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596118184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6WINITRrttu57H5Ow4z7uhB5cozF06t59zUSHHbIkJc=; b=bgHF5Mq7oppZWu8k7EZ+2oaf9bcMuMgWorlfJ68sdo0be5e1NwszUR/8uop3BKP/V3Cpxc nWXxGp3ZB8KNq84zEHb6Yl1IugflVmhZPl84V3R7s//indNmeup/xfdykzoEl2b0EoN8Vj BCmm8f3MRT7ASwoUYglPRecDk6KiAaA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-59XMCS6XOra8IvyfMPGEGg-1; Thu, 30 Jul 2020 10:09:40 -0400 X-MC-Unique: 59XMCS6XOra8IvyfMPGEGg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98C71106F8C4; Thu, 30 Jul 2020 14:09:39 +0000 (UTC) Received: from treble (ovpn-119-23.rdu2.redhat.com [10.10.119.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2B6C8A181; Thu, 30 Jul 2020 14:09:38 +0000 (UTC) Date: Thu, 30 Jul 2020 09:09:36 -0500 From: Josh Poimboeuf To: Julien Thierry Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mhelsley@vmware.com, mbenes@suse.cz Subject: Re: [PATCH v3 1/4] objtool: Move object file loading out of check Message-ID: <20200730140936.uvw73r655356lhtm@treble> References: <20200730094143.27494-1-jthierry@redhat.com> <20200730094143.27494-2-jthierry@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200730094143.27494-2-jthierry@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 30, 2020 at 10:41:40AM +0100, Julien Thierry wrote: > +struct objtool_file *objtool_setup_file(const char *_objname) > +{ > + if (objname) { > + if (strcmp(objname, _objname)) { > + WARN("won't handle more than one file at a time"); > + return NULL; > + } > + return &file; > + } > + objname = _objname; > + > + file.elf = elf_open_read(objname, O_RDWR); > + if (!file.elf) > + return NULL; > + > + INIT_LIST_HEAD(&file.insn_list); > + hash_init(file.insn_hash); > + file.c_file = find_section_by_name(file.elf, ".comment"); > + file.ignore_unreachables = no_unreachable; > + file.hints = false; > + > + return &file; > +} How about calling it objtool_open_read()? It's (sort of) a wrapper around elf_open_read(). -- Josh