Received: by 10.223.185.116 with SMTP id b49csp6136784wrg; Thu, 8 Mar 2018 02:23:19 -0800 (PST) X-Google-Smtp-Source: AG47ELu5YeuEjvgA/E4VjXb8VNscz8wb+Zc50vCL9wx6YWHAZfLlSZrG18Uz7gOW79WMwvzGC//X X-Received: by 2002:a17:902:6a8c:: with SMTP id n12-v6mr19506677plk.230.1520504599622; Thu, 08 Mar 2018 02:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520504599; cv=none; d=google.com; s=arc-20160816; b=R6swFbtSVzYhTwrBSA7rXxhPlw9zow6kY7wMFDZ/Xu8mlaoDhf73f3yAasfq3ce679 OkFvQ7UR0dhRO3oXk6gG0PidMJQUyYjWqHutQh/M+ANXwXniM++D5tGSJi/p9IZ0eb8T Rj+OiyMF4sEZK49eh/knQZVsfeohRwyOVF5KqVZf2SB8tqCLn6VrTaxZIDhlHE/2y6YM ZvzF3VzMpb7u4K5VB4rTyvgvEimoS1eVEZ4n0+QexUiLArV8c0BYcHqWl0PFz7OhCH6F 6KM6pReR871m6N5A8uQxTFziSEZV1q4V97lm+h/DWG1nQC+PDjZB+SLgAaTRwIV0W4MK 1DlA== 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=R6t7U/9r+4Y2vQRBfNzTBWQyc8pAneyXGad+32VdY8k=; b=gE99kSdsk86mW3myQR3WWjlJ+7P+wrIpzo5YX11i5LIERDaGu6g6OnU3V6XJUnNZ9x LR7eUrYtwBVibTZVCk2WiZPXpwGKfwW8fTjMB3nCdSbt+EnxKjOfL3NvJfsOEq/aLguZ KLl8sxB5h/XQDHNJ4yOBubn4+mkidHd10NSGYxVZj/BnXOo0XvHoXfQf5MZPiztvnOAe b/ddr+pyDtgl+EAx5OQKENjnY0fgpGR1EuP3jt3CdRPoOqXb7sKq7VO9SYfbFdbvbRcd o6yKnctv1vRHNHoHErUhcuxLLHpPCSdrnHpJIYBYg2E8LjGa0MN4TiFd07owsvElORon QSiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dXSt8RVv; 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 e1si12576773pgq.413.2018.03.08.02.23.05; Thu, 08 Mar 2018 02:23:19 -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=dXSt8RVv; 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 S933598AbeCHKWJ (ORCPT + 99 others); Thu, 8 Mar 2018 05:22:09 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:62064 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751616AbeCHKWH (ORCPT ); Thu, 8 Mar 2018 05:22:07 -0500 Received: from mail-ua0-f171.google.com (mail-ua0-f171.google.com [209.85.217.171]) (authenticated) by conssluserg-04.nifty.com with ESMTP id w28ALtN8029611; Thu, 8 Mar 2018 19:21:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com w28ALtN8029611 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520504516; bh=R6t7U/9r+4Y2vQRBfNzTBWQyc8pAneyXGad+32VdY8k=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=dXSt8RVvU6qpnk/sc4mXxVu7LI9zPM7BwcuFD9hdXASrlNXXcksKXhBTLVsxNqmTW at7GpwVpDiCxCGXZu8jTgTeiDI0znW75lQGptAC6Rhkxgf0owIUGhIgYLce+ECvEm5 Q+BzblTbUJSVkmgwxEpFgQunEZC4eP17DCf7cys7m7R6Sc00ScODNBJtke5Ia6fXgI boX0d3HyuecuLwDFfNXmg2GO0SDK7BYsiWS96DX468Z3xRBCO91KzC93/QfGcL9IY5 p5lBUEYLhDXeLdxPoWQgzNEtsZ9ZDfuWvDhRgltkH5TnY0YnAkoO5zLSguUWpOeP78 /aN1DJMWNHNkw== X-Nifty-SrcIP: [209.85.217.171] Received: by mail-ua0-f171.google.com with SMTP id j15so598191uan.3; Thu, 08 Mar 2018 02:21:56 -0800 (PST) X-Gm-Message-State: APf1xPBnxgI+YXp+NG8tAkcXJRn0MsMC72asuhm0B/+beMm5Pa8pW+HZ RYzuPcNtsrCruldQnERnR7a+nU0ZFNnv2b25oHs= X-Received: by 10.176.18.70 with SMTP id s6mr17756475uac.144.1520504515300; Thu, 08 Mar 2018 02:21:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.32.138 with HTTP; Thu, 8 Mar 2018 02:21:14 -0800 (PST) In-Reply-To: <4022257e-9ab0-b038-df0e-b15b98cb999f@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> From: Masahiro Yamada Date: Thu, 8 Mar 2018 19:21:14 +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: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. -- Best Regards Masahiro Yamada