Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3040282pxb; Tue, 19 Jan 2021 12:07:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzM7zNFCxbrB+wocXkDuQkhuoxy79xveNp+l8Qd8aQC9Suq0l/xSllRfA5gsm/RcDZ6xOhR X-Received: by 2002:a05:6402:c92:: with SMTP id cm18mr4988648edb.367.1611086837603; Tue, 19 Jan 2021 12:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611086837; cv=none; d=google.com; s=arc-20160816; b=OuelfkvCk0Pl6naj33Dhu02MWaIapILpAq7A8e+dIF7LN+wgppa/BU1JoVztrt0+XJ AXFqSfOt7USba56Zah8h+3rrZdVAwflcwgJ4j1OGPzJdf0jTqkis8EWLBGH4xNZROCoL lEmE2X2GdIwyBdTmgGdm4TF33OPi1NZU1bTuRkAvbI0A/10bC3kamTSAihYhYaxKNIeD MQHxN7Q1ENhZEX6+xQH7e0mXwNtvLLBv/mCQ6dn6/yKeHWuSXRu46MjJc7B7yeNyqQLZ UFPL6c4MAGIIGiO44i6IdCeEzhlHXzcZ0AdrKPdjvmB/46oees9L/L4rVtkhNbq3UbrN SGMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=wQthR0ZyWcyEAUlTzMNFc3z3zw4jUtMWz6880r91VxQ=; b=sI/BEdJoXT4rPFHp2tNLQMYTxp8sSFv0T1CYlUO5Ua1u6IYUHV8Vwd2WRWCOer52Zn wc5C/fo+jxPA0Qe+tMmvnGT5vTtfsgSUiLsEfknm/Cy2pGDi+yGyqRtVr74GRywV8fsX Vqhu2QYDut67plPkiafK8nrs7C/UZIt+3+EC9UqlQCHspMqBm7hc8ielWQr7UizKDtcP F4BDLNjXvJuicz4+v835CIYjRDJy5tlRwrrNfw0wnY8PsQ0Lb/QhqMQDOc35aM0ntzKl BN/75BIbTyNPdtXh2HB1ORboDJphSR62ZPfg1qrzYF7BYsI8uTip1dcLSoLm3RDilfLY vYFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DSPs+oT6; 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 bt2si7515190edb.89.2021.01.19.12.06.52; Tue, 19 Jan 2021 12:07:17 -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=@mg.codeaurora.org header.s=smtp header.b=DSPs+oT6; 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 S2390913AbhASUFN (ORCPT + 99 others); Tue, 19 Jan 2021 15:05:13 -0500 Received: from m42-8.mailgun.net ([69.72.42.8]:54213 "EHLO m42-8.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728987AbhASUDv (ORCPT ); Tue, 19 Jan 2021 15:03:51 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1611086608; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=wQthR0ZyWcyEAUlTzMNFc3z3zw4jUtMWz6880r91VxQ=; b=DSPs+oT69uQhqRbBJHQQXv9aXB2MJ/qkqdTerP87Hnf0OESXj3vFkA/+4mw+YwRBGYOhsrsV 1/3h+LTe2/Wcn/g8iUeBeI5LZoGAr3mhCluAEbAs4OGiLQS7nMLB5KCNF+/RvIzoGjq7nmDf jmxpofq4wuCiNjYuBSrFOfc/nLg= X-Mailgun-Sending-Ip: 69.72.42.8 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 60073af175e5c01cbae0059b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 19 Jan 2021 20:02:57 GMT Sender: mkalikot=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 382A4C43461; Tue, 19 Jan 2021 20:02:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mkalikot) by smtp.codeaurora.org (Postfix) with ESMTPSA id 36CCDC433ED; Tue, 19 Jan 2021 20:02:56 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 19 Jan 2021 12:02:56 -0800 From: mkalikot@codeaurora.org To: Masahiro Yamada Cc: Jeff Johnson , Linux Kbuild mailing list , Prasad Sodagudi , Elliot Berman , Nick Desaulniers , Michal Marek , Linux Kernel Mailing List Subject: Re: [PATCH v2 2/2] kbuild: handle excessively long argument lists In-Reply-To: References: <1610500731-30960-2-git-send-email-jjohnson@codeaurora.org> <1610660990-18812-1-git-send-email-jjohnson@codeaurora.org> <4c02050c4e95e4cb8cc04282695f8404@codeaurora.org> Message-ID: <8ddd0f29e30684ce9fcd2dd19a104bd2@codeaurora.org> X-Sender: mkalikot@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-15 13:53, Masahiro Yamada wrote: > On Sat, Jan 16, 2021 at 5:15 AM wrote: >> >> On 2021-01-14 17:12, Masahiro Yamada wrote: >> > On Fri, Jan 15, 2021 at 6:50 AM Jeff Johnson >> > wrote: >> >> >> >> From: Mahesh Kumar Kalikot Veetil >> >> >> >> Modules with a large number of compilation units may be >> >> exceeding AR and LD command argument list. Handle this gracefully by >> >> writing the long argument list in a file. The command line options >> >> read from file are inserted in place of the original @file option. >> >> >> >> The usage is well documented at >> >> https://www.gnu.org/software/make/manual/html_node/File-Function.html >> >> >> >> Signed-off-by: Mahesh Kumar Kalikot Veetil >> >> Signed-off-by: Jeff Johnson >> >> --- >> > >> > >> > >> > >> > First, is this a real problem? >> > If so, which module is exceeding the command line limit? >> >> On 2021-01-14 17:12, Masahiro Yamada wrote: >> > First, is this a real problem? >> > If so, which module is exceeding the command line limit? >> >> Mahesh & I appreciate all of the feedback. >> >> The issue is seen in an Android environment with an out-of-tree >> driver. The combination of long path names and a large number >> of source files is leading to the issue. >> >> Since Mahesh & I are not Kbuild gurus, is there an alternative >> solution to this issue? >> >> Jeff > > > I see. > > The support for out-of-tree modules > is not nice in this regard, but fixing it > would need many changes. > Agree with that. I checked the same after your first comment on this thread. It needs changes in multiple layers of makefiles. > > The long-term solution might be to upstream your driver, > but it might not be possible. > > > > > > > One cheesy workaround might be to point the module path > via a symbolic link. > > > Let's say your module is located in a very deep > directory, > /home/foo/long/long/.../path/to/your/module > > > make M=/home/foo/long/long/.../path/to/your/module modules > > would fail due to the too long command line. > > > > > First, create a symbolic link as follows: > > ln -s /home/foo/long/long/.../path/to/your/module mod_dir > > > Then, pass the symbolic link to M= option. > > make M=mod_dir modules Thanks for the suggestion. Earlier, we have used a similar workaround of using relative path instead of absolute to reduce the command line length. What's your input on the following approach where we link object files in different stages to reduce the command line length. ./Makefile # foo.c is combined and final module. obj-m = fooa.o foob.o fooc.o # link already combined object files fooc-y := fooa.o foob.o # combine into different groups fooa-y := foo1.o foo2.o foob-y := foo3.o foo4.o .... Note: We need to add MODULE_LICENSE in every group. make -C ../linux-kbuild M=/local/mnt2/workspace/dev/foo modules CC [M] /local/mnt2/workspace/dev/foo/foo1.o CC [M] /local/mnt2/workspace/dev/foo/foo2.o LD [M] /local/mnt2/workspace/dev/foo/fooa.o CC [M] /local/mnt2/workspace/dev/foo/foo3.o CC [M] /local/mnt2/workspace/dev/foo/foo4.o LD [M] /local/mnt2/workspace/dev/foo/foob.o LD [M] /local/mnt2/workspace/dev/foo/fooc.o MODPOST /local/mnt2/workspace/dev/foo/Module.symvers CC [M] /local/mnt2/workspace/dev/foo/fooa.mod.o LD [M] /local/mnt2/workspace/dev/foo/fooa.ko CC [M] /local/mnt2/workspace/dev/foo/foob.mod.o LD [M] /local/mnt2/workspace/dev/foo/foob.ko CC [M] /local/mnt2/workspace/dev/foo/fooc.mod.o LD [M] /local/mnt2/workspace/dev/foo/fooc.ko