Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1988239ybg; Thu, 30 Jul 2020 07:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwXfbFpnlh4t500WqcF0YuMUJfDZtE1a2KQ93IByjpDvloWc3+y5Jb+3SkCPPlWxG/v6dR X-Received: by 2002:a50:fe0a:: with SMTP id f10mr2941491edt.264.1596120222693; Thu, 30 Jul 2020 07:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596120222; cv=none; d=google.com; s=arc-20160816; b=ST6QtZui6EZOtHi6R/1Pkd2XZK/px20Bi0uOQkHrx8THuDWmEVWrmC0knjjqra4aAH y616iD0sMEG0CR1WDod2j85PDvAVY+jgalnZdZunmVVQv4uLxIa+vsljRWF+2xbd/Agm +fOe/z/k+e/1X15okl2XccMz2LTbTmkrNojqHRaPA5HEsaiIj+edliSp3Rr+C3fNbtjX Y0jg4TBNgFaLibl9xT6IdxvkGZXFw7ALZ7kexqL5HYB7N3VUongze6RmDsjOOJFHuxmI wpJtX6utPJJtdDIK37T4orVYk+fZIsu9boNxKJ+1f46vwoa9Gqzq6RuV1xu4I8tceELk LhWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=whEyUcY+ZzprUC9AdTz54JwJP2QolK0F7VwewK1gE8M=; b=m+lYo/cRAt5PebIih3mF6rfMna6ASr/xGy9kUi+a5fj9bTFUS1J4VpRevwvACGY+79 ikOKm31gD5pzPWCiZiADmkv2E0VUgzNEtVoYKsy3nF6L2qwKutfGgnsreYfVGrccPphx dhTf89h9O6AFA5ZPchdf2LV0e5aku2LfGp6t1vLlrqf1Y2FJ5T2vccP9m86upTDdUntw GnsB188HslR3Z0Igj/v1Avm1XFh3A0sQ1y3I6+tXx1v5iloHzjeOzSFvt2A+LHvGIINV hYt8SxiPM/6f9UzQBfLf2R+DjdYKdKkRK9kRLZpiUXYpAARadeEo+tD06eqgWh8Pf7xB AwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UKhoViOX; 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 i21si3183488eje.143.2020.07.30.07.43.20; Thu, 30 Jul 2020 07:43:42 -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=UKhoViOX; 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 S1729612AbgG3OnC (ORCPT + 99 others); Thu, 30 Jul 2020 10:43:02 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33426 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729387AbgG3OnB (ORCPT ); Thu, 30 Jul 2020 10:43:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596120180; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=whEyUcY+ZzprUC9AdTz54JwJP2QolK0F7VwewK1gE8M=; b=UKhoViOXz0j/L3IYS27aQzODnVKLMATPHW9vWgDE1Ui8OFHftewezRpMAyWsbgFSpCQbTA jqIvhjupVvfAJgkHCDAAXMJu57bD7tvu/Z588sfeigkzZdeaptg26920hVCJGucOwj0iUc 1oxKVmBS9IqZI/g9Z/mDFJ6IZiOLQfE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-79-5HbZ5gVxMum6Si9jUlejew-1; Thu, 30 Jul 2020 10:42:58 -0400 X-MC-Unique: 5HbZ5gVxMum6Si9jUlejew-1 Received: by mail-wr1-f70.google.com with SMTP id v4so8074356wrb.2 for ; Thu, 30 Jul 2020 07:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=whEyUcY+ZzprUC9AdTz54JwJP2QolK0F7VwewK1gE8M=; b=QrdZZy2dzpJsOXZ0o8uVSsVkySn28LCoGl56S1TRCsS20Qd6ZrGpIdgL/7sdAaDTLS 9NMgIbWHxy8sF1xIjyTIpHwf0hfhwjTfnp2vOXNKUuYdjbuwscK2YH0O9L7OCA56ziG/ n4bNucLNWWJx+BAHwnqSm9HBQ2LVxIR8Gyghb80GsqnkGHT1onFgZGGL7Jr5pvDpDfjA 36JkUqqajrxIrYrFImrSPAwanjcRG+mkr9e+KZhZzj/Wb+OOk9PjHOpqcfUmF2i2xaOE YIa0NpgA1IxDl/BJw/lLBshW8OzIpTCvKqqXa4/v4rqOw6gm5MLbbeTXmP8GbVLCd6ev r9eQ== X-Gm-Message-State: AOAM531Nb4koU/0artwpXcbOXvpNIaQQ+Wm9vDMjw9cM7M6bmcclasuE TA1dh9ND5+g7j09zrvuRh89p3JLxyMLYAJVF4SCjypYS1K3LX6qRbh35a7aANMm0USmrkU5Sv3V W0MZpWmd45xg1lb19l703mnvl X-Received: by 2002:a7b:c84f:: with SMTP id c15mr7299016wml.133.1596120176696; Thu, 30 Jul 2020 07:42:56 -0700 (PDT) X-Received: by 2002:a7b:c84f:: with SMTP id c15mr7299001wml.133.1596120176479; Thu, 30 Jul 2020 07:42:56 -0700 (PDT) Received: from ?IPv6:2a01:cb14:499:3d00:cd47:f651:9d80:157a? ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id l1sm11128047wrb.12.2020.07.30.07.42.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2020 07:42:55 -0700 (PDT) Subject: Re: [PATCH v3 1/4] objtool: Move object file loading out of check To: Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mhelsley@vmware.com, mbenes@suse.cz References: <20200730094143.27494-1-jthierry@redhat.com> <20200730094143.27494-2-jthierry@redhat.com> <20200730140936.uvw73r655356lhtm@treble> From: Julien Thierry Message-ID: Date: Thu, 30 Jul 2020 15:42:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200730140936.uvw73r655356lhtm@treble> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/20 3:09 PM, Josh Poimboeuf wrote: > 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(). > Sure, I'll update that. Thanks, -- Julien Thierry