Received: by 10.223.185.116 with SMTP id b49csp6143987wrg; Thu, 8 Mar 2018 02:32:00 -0800 (PST) X-Google-Smtp-Source: AG47ELuBeMB1uBNjQbbDTQ28NEwwF+Wi9czm1d6OQBubvqkKBITjfsZodkl7SF4eYH0eEIJVukw8 X-Received: by 10.98.13.211 with SMTP id 80mr26017456pfn.69.1520505120755; Thu, 08 Mar 2018 02:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520505120; cv=none; d=google.com; s=arc-20160816; b=QwtloI97X0Cnet+gTaDI5OtylLNjs8Zls1t+7O1tTkzklNsGkJAAjbH14PpS8ihYlW PKECkbTWRxFC9FAa/xzjNStiwotlMuIebozZtCyYMLcYdvfNbH+rB9Vfd8ZnCiu63pNG 7QTK2R3KWsjtUWNCr1HUzjQmqERCAfplHGd9vb9KCQOuspMq1lGkZslcRQIIUom0tDhb TkbRAunY8Ri9T5hdQfTCTYkpUO3Xg5niMdVpsHsGhlmAEXNlSXgXAg979/iDL4uPFrTT kQO0ydYq/BDA+ImXL4z7Lkj0Y27S7wBM+3/IN4z9IFsH6dEBIqqf8hGZbipLCsiy84A0 qDYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=8UK2neOZ1GCO54B4CrCle3GZ5HbNh30LyAUkpgoK05I=; b=O9k5muZKd4NolFOXf1G8Rlsi+IXTWiDoMBMmUK7RSv5zoR6EJUwJKio9KrqxMHoS9w RQUsCuk3ohDvzhejjCbEJkNHtM8W5J96COU9jvdEMo+xPhj8XmGviOymNhVR5lpfRnlT h9AbiZz0tSj754LgtBLeQmRh3g0Rikhn5O88bixZZt2Por5E8GgayCMcOmvVmwJ7cMjW Ael5SOwp5qNdJas0iEiE2mYNr+GVqL3ioYtc79TmVQu98RNVfuqvRzQDJG4d+BYDGWyA 1WyWKGKesdFToLJld9nfAHWMR5clubxUCXyMYxXfaYdCqsXWzrumhLYxALSH/D36ia/1 WQIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=BRsLL7Fz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si12685983pgo.278.2018.03.08.02.31.46; Thu, 08 Mar 2018 02:32:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=BRsLL7Fz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965528AbeCHKa2 (ORCPT + 99 others); Thu, 8 Mar 2018 05:30:28 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:43904 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935716AbeCHKa0 (ORCPT ); Thu, 8 Mar 2018 05:30:26 -0500 Received: from mail-ua0-f170.google.com (mail-ua0-f170.google.com [209.85.217.170]) (authenticated) by conssluserg-01.nifty.com with ESMTP id w28AUJSV020696; Thu, 8 Mar 2018 19:30:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com w28AUJSV020696 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520505020; bh=8UK2neOZ1GCO54B4CrCle3GZ5HbNh30LyAUkpgoK05I=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=BRsLL7FzwOG11heZTIIW+r5SyiGKkwnpleoGsCeJhdP7d1a3+PIADg1WqGGPAH/uv nDVCl4rUWWHewiGc3E6yQAfyfI53cBdL/o9LXua6hXygHtkHoJ6DvVo0pNEiv+SegC cdjxDe06UzOclhAQzyjgkvd4NkfwUwM+ujG7PVAC85Pkyh5BsjlhN1apHCeQDU+g/U wGI+p7MwU/lkbqIbsBchiMJYVe0r6DT8jpi8FRR6ktbeK/fI8X3bEDI7IYeI+aQ9VA oxLJk9MDdk61qOHYMa+YWUbSeI3lZUFJABbsxbfHruhMGXmK8XdEqxUkHp/RiT05zp AJb7lSCucVaFQ== X-Nifty-SrcIP: [209.85.217.170] Received: by mail-ua0-f170.google.com with SMTP id q12so3552163uae.4; Thu, 08 Mar 2018 02:30:19 -0800 (PST) X-Gm-Message-State: APf1xPDXFilOARayn+dTtFz40zC3Fo65MtjSDB+Sqci/tau9XOEcpGEd HF7ocLDO60XOx5fiG8Qu9Rcrsh54wwzpKCRHuvA= X-Received: by 10.176.20.112 with SMTP id c45mr18715983uae.82.1520505018502; Thu, 08 Mar 2018 02:30:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.32.138 with HTTP; Thu, 8 Mar 2018 02:29:38 -0800 (PST) In-Reply-To: <2bb55c11-bffb-4099-f1fc-d31fb058d422@cn.fujitsu.com> References: <1520471103-10089-1-git-send-email-yamada.masahiro@socionext.com> <1520471103-10089-3-git-send-email-yamada.masahiro@socionext.com> <4022257e-9ab0-b038-df0e-b15b98cb999f@cn.fujitsu.com> <2bb55c11-bffb-4099-f1fc-d31fb058d422@cn.fujitsu.com> From: Masahiro Yamada Date: Thu, 8 Mar 2018 19:29:38 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/5] kbuild: define KBUILD_MODNAME even if multiple modules share objects To: Cao jin Cc: Linux Kbuild mailing list , Sam Ravnborg , Michal Marek , Govind Singh , Kalle Valo , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-03-08 19:25 GMT+09:00 Cao jin : > Masahiro-san > > On 03/08/2018 06:21 PM, Masahiro Yamada wrote: >> 2018-03-08 19:11 GMT+09:00 Cao jin : >>> >>> >>> On 03/08/2018 09:05 AM, Masahiro Yamada wrote: >>>> Currently, KBUILD_MODNAME is defined only when $(modname) contains >>>> just one word. If an object is shared among multiple modules, >>>> undefined KBUILD_MODNAME could cause a build error. For example, >>>> if CONFIG_DYNAMIC_DEBUG is enabled, any call of printk() populates >>>> .modname, then fails to build due to undefined KBUILD_MODNAME. >>>> >>>> Take the following code as an example: >>>> >>>> obj-m += foo.o >>>> obj-m += bar.o >>>> foo-objs := foo-bar-common.o foo-main.o >>>> bar-objs := foo-bar-common.o bar-main.o >>>> >>>> In this case, there is room for argument what to define for >>>> KBUILD_MODNAME when foo-bar-common.o is being compiled. >>>> "foo", "bar", or what else? >>>> >>>> One idea is to define colon-separated modules that share the object, >>>> in this case, "bar:foo" (modules are sorted alphabetically by >>>> $(sort ...). >>>> >>>> Signed-off-by: Masahiro Yamada >>>> --- >>>> >>>> scripts/Makefile.lib | 9 +++++---- >>>> 1 file changed, 5 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib >>>> index a7e315f..a1fbd6a 100644 >>>> --- a/scripts/Makefile.lib >>>> +++ b/scripts/Makefile.lib >>>> @@ -92,8 +92,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) >>>> # differ in different configs. >>>> name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) >>>> basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) >>>> -modname_flags = $(if $(filter 1,$(words $(modname))),\ >>>> - -DKBUILD_MODNAME=$(call name-fix,$(modname))) >>>> +modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) >>>> >>> >>> I guess there is comment also need to be modified above this code hunk: >>> >>> Note: Files that end up in two or more modules are compiled without the >>> KBUILD_MODNAME definition. The reason is that any made-up name >>> would differ in different configs. >> >> >> Why do I have to add lying comments here? >> >> The commit subject/log claims KBUILD_MODNAME should be _always_ defined. >> > > I feel you misunderstand my intention, the comment I mentioned is > already there, so they should be modified according to your patch. > Ugh. Sorry I missed your intention. I will remove the comment. Thanks! -- Best Regards Masahiro Yamada