Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2437204ybl; Sat, 1 Feb 2020 22:16:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyPKsKTWRI85+5n9stLHhbkdm+U4yk5jC0j0JKi+wu388q4F37JYULdS1Kqg+Fg6Q6cQsbS X-Received: by 2002:a9d:1c9c:: with SMTP id l28mr13138833ota.210.1580624161900; Sat, 01 Feb 2020 22:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580624161; cv=none; d=google.com; s=arc-20160816; b=wBWhH1IFS9jJW4yq68bQ/EvlsYKU0K55xM+6ktJdeXtF26+0YSU+lZiVPPXziuUo5D nQxYMtm+YIwlZ3Sa2CHQISBlH58Wu2ZdkWWz8PM+k1OXbYSdUq851my3XmTvwve8BlDy gx7pMijPAhs71KhG8gatdhmanmdRnjlJWdyvSQExNsk4Aiu7WJRHavaD7lcI6rQlOXSU 4jb3qcoNB+CuW8rcttOAuh5HmCWjiIfh1Jhps4pZ/4sfDncLuWLJPwMBKNv9BXOWstyY bQgZBcVYOWkNvbkAVMySjauW4//e/+BwpOdOuAXbgZpNPCrnTgCtR7b0KqiJZ06Ljd0u QQiw== 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 :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=J3WU4e+zn67eERAVkmqy0bxRWEiSF9lbC2mFseAfKrA=; b=CKZEj9F1RLFTE4PNFenJuLCPxo3KOKtgOmN+pff6comKMT62b08BxIs7Ql0Vni0xUu AXUSB0b5bESQz4WeNiAnU1FfuHH5BTg7GpQ5MKMwe6DHgPjKf4eZn+4SUve7Ikf9Lvx+ fYn+LpKNTaASYleMTKoysDbLVa/7ljzBZ1CUVprevGBjluD2Ndt5wEqob+abGzrmuS+D afZHgh45G6HaPY6TL9CQYrdOx7WNJUkUyXsVVGzwtliTBcH0wFlWIB2kZ2mo/UQVOOEe bIcVfVAXhJoZHxSQmd+gbrKmfweM8G0va7UdJx+JXEdaZcxX3JnolyPwHMbfu+L3Mk7z xudw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mcvQxZLS; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si2983482oie.95.2020.02.01.22.15.14; Sat, 01 Feb 2020 22:16:01 -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=mcvQxZLS; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbgBBGIC (ORCPT + 99 others); Sun, 2 Feb 2020 01:08:02 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:37824 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgBBGIC (ORCPT ); Sun, 2 Feb 2020 01:08:02 -0500 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 01267vSo020752 for ; Sun, 2 Feb 2020 15:07:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 01267vSo020752 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1580623678; bh=J3WU4e+zn67eERAVkmqy0bxRWEiSF9lbC2mFseAfKrA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mcvQxZLSO/2cVw1iKSo2MZ5t0bGBPAFSVrepEq+wRCtfs6O5UW9UuQAqochSaFInd JJpqFqlJj8dLOiAk8bPswF07sK/67M1fEsJlF3coaD6GqOcUXLCEK+xOqPnJvkXYSM jJhVXuLxeODOKBOWb+6/Tgnny8vBxyl7ogE2oA5ZylL5LhTwcdtBmNuUxga0QJLKma zA0419nYeX4PPI+mu7TBtS/Djx0wHc3XsxDqIrXsaIxZFVCD4DJYsXOWUJQUzYxDZ/ cmqXUAPOjdUknesn2SYryYHeXS7KsD4lFx2TIm1Y4kS+/aDxXD5Dis4XaUZ0XdNicH TPr1o7EyhfhIg== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id p6so6941578vsj.11 for ; Sat, 01 Feb 2020 22:07:58 -0800 (PST) X-Gm-Message-State: APjAAAVCZp2U0RA0JAUjIcOriLPEPOqLJpy/3P0MAxUzAqCjedZktZIR FAHQqjvh0weR8i1se2k+54MRC57694eb75Jnsag= X-Received: by 2002:a05:6102:1174:: with SMTP id k20mr8960579vsg.155.1580623676956; Sat, 01 Feb 2020 22:07:56 -0800 (PST) MIME-Version: 1.0 References: <1580161806-8037-1-git-send-email-gvrose8192@gmail.com> <677aff5a-a52e-08ae-f341-547af08f7566@gmail.com> In-Reply-To: <677aff5a-a52e-08ae-f341-547af08f7566@gmail.com> From: Masahiro Yamada Date: Sun, 2 Feb 2020 15:07:21 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: Include external modules compile flags To: Gregory Rose Cc: Linux Kernel Mailing List , dev@openvswitch.org, dsahern@gmail.com 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 On Thu, Jan 30, 2020 at 3:09 AM Gregory Rose wrote: > > > On 1/28/2020 7:37 AM, Gregory Rose wrote: > > On 1/27/2020 7:35 PM, Masahiro Yamada wrote: > >> On Tue, Jan 28, 2020 at 6:50 AM Greg Rose wrote: > >>> Since this commit: > >>> 'commit 9b9a3f20cbe0 ("kbuild: split final module linking out into > >>> Makefile.modfinal")' > >>> at least one out-of-tree external kernel module build fails > >>> during the modfinal make phase because Makefile.modfinal does > >>> not include the ccflags-y variable from the exernal module's Kbuild. > >> ccflags-y is passed only for compiling C files in that directory. > >> > >> It is not used for compiling *.mod.c > >> This is true for both in-kernel and external modules. > >> > >> So, ccflags-y is not a good choice > >> for passing such flags that should be globally effective. > >> > >> > >> Maybe, KCFLAGS should work. > >> > >> > >> module: > >> $(MAKE) KCFLAGS=... M=$(PWD) -C /lib/modules/$(uname > >> -r)/build modules > >> > > Hi Masahiro, > > I'm unable to get that to work. KCFLAGS does not seem to be used in > Makefile.modfinal. I quickly tested it, and confirmed KCFLAGS works for external modules, too. Makefile.modfinal includes scripts/Makefile.lib So, c_flags contains $(KCFLAGS) c_flags -> KBUILD_CFLAGS -> KCFLAGS > [snip] > >>> --- a/scripts/Makefile.modfinal > >>> +++ b/scripts/Makefile.modfinal > >>> @@ -21,6 +21,10 @@ __modfinal: $(modules) > >>> modname = $(notdir $(@:.mod.o=)) > >>> part-of-module = y > >>> > >>> +# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS > >>> +include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ > >>> + $(KBUILD_EXTMOD)/Kbuild) > >>> + > > I continue to wonder why this it is so bad to include the external > module's Kbuild. Because it is not correct behavior. > It used to be included in Makefile.modpost and did no harm, and in fact > was what > made our external build work at all in the past. Without the ability to > define our > local kernel module build environment during the modfinal make I see no > way forward. As I said, ccflags-y is not intended to be passed to *.mod.c Upstream modules never rely on it. External module should not rely on it either. > > That said, I'm no expert on the Linux kernel Makefile > interdependencies. If you > have some other idea we could try I'm game. -- Best Regards Masahiro Yamada