Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp812667ybk; Wed, 13 May 2020 13:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrqkvCM1IQvZztPfmX8b0eK3ZpUs5FYHwdxD52E/zWxkcDApLIrTY3TASOlJd4Dv4o6Hnq X-Received: by 2002:aa7:c402:: with SMTP id j2mr1353007edq.284.1589403120277; Wed, 13 May 2020 13:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403120; cv=none; d=google.com; s=arc-20160816; b=KyDgCUh1gGT2KooxgTmHcreYu1XDRYr9wHHz0lLBQFKDaa6wtvZCepbYuC0gbDMA0l +aMLXH5w/3h/p56oiIIYwho+r4oI54JTnwa6lnUotwxMEzMJv67QMokYQvagCNUQG0Op 1avtE0jSI7YToVG6qSZud50FkH8W0if6y7/lQIwVwjgqxlJ9xQ6lPjywUGSSucVo4BBJ 3mxnDM+GmZR/sBJkxvFYCyN50Hy4OcWjtpavDkXzNgaifxlwFSQqu+YcGQUoNDPz14Y4 YxP3ZtUVAqUaMzIVCi9lHYLtQwYDoL+a5exezVIZD/3o8QGsVtwTu1STxPFbCjdy7ycS OOhw== 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:to:subject:dkim-signature; bh=q+xvrP5HCSZn98A/eBhzQxvMQQhmNlPPcvFZhur0b14=; b=HFeuen0N1MiqMyh0CzoL+G+ioOfXzk91DlheubomIwdiSmBNquXLf40vjn/Re6xE9d q+9NAcmj2lToOY5Qxdt9seeCLyDxYxEiGe9ursfUU2tNzd1kjXkMTzdz2LUBSOFDsrXL 4iL2OUmPpMwoBYuXKpDnPw8MpTaj7aZV5DsAnFlrjTNpTkfCdcpfmQ+RmC00En228U86 NElxuQ+sF1DD6vaJZVOxHLwC63VypxLv3N2zONa0SmS+1wlMiajHeEMahKDuFGcNvqnR c5VFKP2xRUe5EHNzRjoV10MqvIgN860kXrrTOPGpQ4Q+9hrFau7z3bGsrLBZdtWCTxDv 6Jwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SIyHO821; 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 dc9si470898ejb.370.2020.05.13.13.51.37; Wed, 13 May 2020 13:52:00 -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=SIyHO821; 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 S2389785AbgEMQ5u (ORCPT + 99 others); Wed, 13 May 2020 12:57:50 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34609 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727120AbgEMQ5t (ORCPT ); Wed, 13 May 2020 12:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589389068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q+xvrP5HCSZn98A/eBhzQxvMQQhmNlPPcvFZhur0b14=; b=SIyHO821M9SSpWD4oDcLk5kvUzKrs+N+wcwxYZ+gzVhiKiH+Du67mjKR1h71oZkOt8+jIC g9mJhlN5nnxgHipTc5wf3YO/hc+wfhl5iTxTpninQDRxTpV5aEKTsxIxKLlhPGs+92Z5Ye KGOIte+5mGwWMarw95GuXAHJ1X7S+yI= 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-447-_0ztxGaaMAmK_5lareSYIw-1; Wed, 13 May 2020 12:57:44 -0400 X-MC-Unique: _0ztxGaaMAmK_5lareSYIw-1 Received: by mail-wr1-f70.google.com with SMTP id g10so15270wrr.10 for ; Wed, 13 May 2020 09:57:44 -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:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=q+xvrP5HCSZn98A/eBhzQxvMQQhmNlPPcvFZhur0b14=; b=rjj9TastjyJ38bCF2OAkLx/u68/AQ88RvDcGl9nUQp2luLwQU8xtxMT/kC4kZ04Lo1 QnTbC02OTIVRECS/uwW8wGBRknafBGVFr7azODYAJLgQduviicJdXvHiM8Zj/8lLJOgF pFUR3mtER6lkYCEwwTb40Ol9DLeYM2r0DZMq7CJlCaTg7ECb1btItOO4FcTLKflbH/Zx D2TvWAqz1cuQiXX6RUNIJHnr9lNeH0/ycYApzUbNw5uLaECvd9KCiqlY2M5ZvJeyDsmD IkTLNGdiOP3UAjG3ldp3xkMu3OB8wqc5rCcDvXlipeWv//cFHK7BnOz2QWWpQE78m0bH 2aCw== X-Gm-Message-State: AGi0PuahmXYMJlMsKtsmea53K6BfstNOvqpoN1N9fb8FlkJPfYwSCgaa ixkAcH80vq5NjX8HE/oo7EXvJO+9JFFJSYdyAIg3uz5hQzIm1cssB8BfxqFT++EyZJjDUN6SkjH IYYjI8qjmBSu82LfLG626IwLB X-Received: by 2002:a1c:4b02:: with SMTP id y2mr21762726wma.115.1589389063667; Wed, 13 May 2020 09:57:43 -0700 (PDT) X-Received: by 2002:a1c:4b02:: with SMTP id y2mr21762710wma.115.1589389063368; Wed, 13 May 2020 09:57:43 -0700 (PDT) Received: from [192.168.1.27] (lfbn-lyo-1-134-107.w86-202.abo.wanadoo.fr. [86.202.218.107]) by smtp.gmail.com with ESMTPSA id d6sm116094wra.63.2020.05.13.09.57.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2020 09:57:42 -0700 (PDT) Subject: Re: [RFC][PATCH 4/5] objtool: Enable compilation of objtool for all architectures To: Matt Helsley , linux-kernel@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra , Miroslav Benes , Steven Rostedt References: <9f709ea2ae66cc03b3ff3329baa8f670ccd0e368.1588888003.git.mhelsley@vmware.com> <20200513155948.GI9040@rlwimi.vmware.com> From: Julien Thierry Message-ID: Date: Wed, 13 May 2020 17:55:31 +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: <20200513155948.GI9040@rlwimi.vmware.com> 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 5/13/20 4:59 PM, Matt Helsley wrote: > On Tue, May 12, 2020 at 06:04:56PM +0100, Julien Thierry wrote: >> Hi Matt, >> >> On 5/11/20 6:35 PM, Matt Helsley wrote: >>> objtool currently only compiles for x86 architectures. This is >>> fine as it presently does not support tooling for other >>> architectures. However, we would like to be able to convert other >>> kernel tools to run as objtool sub commands because they too >>> process ELF object files. This will allow us to convert tools >>> such as recordmcount to use objtool's ELF code. >>> >>> Since much of recordmcount's ELF code is copy-paste code to/from >>> a variety of other kernel tools (look at modpost for example) this >>> means that if we can convert recordmcount we can convert more. >>> >>> We define a "missing" architecture which contains weak definitions >>> for tools that do not exist on all architectures. In this case the >>> "check" and "orc" tools do not exist on all architectures. >>> >>> To test building for other architectures ($arch below): >>> >>> cd tools/objtool/arch >>> ln -s missing $arch >>> make O=build-$arch ARCH=$arch tools/objtool >>> >> >> Since the stuff under arch/missing is only weak symbols to make up for >> missing subcmd implementations, can we put everything in a file >> subcmd_defaults.c (name up for debate!) that would be always be compiled an >> linked. And some SUBCMD_XXX is set to "y", the corresponding object file >> gets compiled and overrides the weak symbols from subcmd_defaults.c . > > Hmm, I like keeping them separated along similar lines to the other > code because it makes it easier to see the intended correspondence and > likely will keep the files more readable / smaller. I could > just move them out of arch/missing and into missing_check.c and so forth. > > What do you think of that? > I do prefer that to the introduction of an arch/missing. Still, I'm not sure I see much benefit in splitting those small implementations in separate files, but it's not a problem either. This seems more a matter of taste rather than one approach working better than the other. So it's more up to what the maintainer prefer! :) >>> diff --git a/tools/objtool/Build b/tools/objtool/Build >>> index 66f44f5cd2a6..fb6e6faf6f10 100644 >>> --- a/tools/objtool/Build >>> +++ b/tools/objtool/Build >>> @@ -1,11 +1,12 @@ >>> objtool-y += arch/$(SRCARCH)/ >>> + >>> +objtool-$(SUBCMD_CHECK) += check.o >>> +objtool-$(SUBCMD_ORC) += orc_gen.o >>> +objtool-$(SUBCMD_ORC) += orc_dump.o >>> + >>> objtool-y += builtin-check.o >>> objtool-y += builtin-orc.o >>> -objtool-y += check.o >>> -objtool-y += orc_gen.o >>> -objtool-y += orc_dump.o >>> objtool-y += elf.o >>> -objtool-y += special.o >> >> I'm not convinced by the moving of special under arch/x86 and I didn't >> understand it at first. >> >> I guess you did it because it is only used by the check subcmd, which is >> currently only implemented by x86. Is that the reason? > > Yeah, that was the original reasoning and this is an artifact of the > previous patch set. > >> I feel that the proper way to do it would be to leave special.c/h where they >> are and have "objtool-$(SUBCMD_CHECK) += special.o". Unless there was some >> other motivation for it. > > This makes sense. I'll incorporate that in the next posting. > Great, thanks! -- Julien Thierry