Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp854874ybl; Wed, 29 Jan 2020 10:48:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxc63VBzsWzlE8+z7EXtt/652/qq7JnLXDqry+t9L3F1VJd3RT6T3bI9GEf/SRbtPdxcNlJ X-Received: by 2002:aca:de43:: with SMTP id v64mr227256oig.164.1580323730468; Wed, 29 Jan 2020 10:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580323730; cv=none; d=google.com; s=arc-20160816; b=VnoQoerp7F48a59C0Rt11o09rdqJ3EP0MAUlwIe3PA0eG+6xnsPUMlagit+iZqkUzC YzBL1S3swiSsUF7/e9uoyub/0RuxHH5Pr/aPrj06/m/wt9ZbedVzg7jLxUSF2pnDHtig 2lB0PGLlG5IkRqe9Vf7TKNeX6Us5CaMJ+0fUHM5NeR6zx2ZPHQYd5/Jl6hD8Oe1ISo2W 6SvoUQIv2bKkKYsQw4MoG/51uo8VVOL9P8do7usgszql2MWLX+IKbMrx3SeDmeQL2jj3 COqgJ4DGeoOR+n/0NUv/XU55AdhsZ/Z4vAAUbwZ8TmIlhM2rOxyaf5krmEDHJtMeulY/ 9BYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=Qfgy4sCCCO9qTQgchyD2bDgwppQqFA1HOWEoZpdCsZk=; b=b0F7Nvy2NesIyiEGoDZDSQxF5mImUYGeWJBeYQVRZS6ZgZbjEiN1RkHvreQ8od8d7k zt0y/1KwVkPKS4YNVXNUIxpZ3dih+ewrP0CRcE9V1tp2aJFnM6VpDKxJFRsLAKefw6f3 67ooZbsNM2XdvLOqkKL5awf13/+Ru9jZyjM/2/1GI5u1USIsHZhC2vp+TWV2xOW0Loub /9dxsKTSN98kPWyQ/tnODwEC/4XmERqByarZO0d0nMLGx2L0Z19fvTOJhcYSmekTYIr0 r04j73VwRyBm4fvBI0peMQOECtqnZTDrXwXaoxKN/GGHxkRiYvdVBRMM9fC6ibvp9lzy 1A2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oIY+T7f1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20si1680560otq.157.2020.01.29.10.48.38; Wed, 29 Jan 2020 10:48:50 -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=@gmail.com header.s=20161025 header.b=oIY+T7f1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbgA2SJI (ORCPT + 99 others); Wed, 29 Jan 2020 13:09:08 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35337 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbgA2SJI (ORCPT ); Wed, 29 Jan 2020 13:09:08 -0500 Received: by mail-pg1-f195.google.com with SMTP id l24so195226pgk.2 for ; Wed, 29 Jan 2020 10:09:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Qfgy4sCCCO9qTQgchyD2bDgwppQqFA1HOWEoZpdCsZk=; b=oIY+T7f1/3KDhWmi+9XoCo3BKr+sq4W/mKeDPKem3BbD+RYGZFt1E4Jp4cyhzNTMxX Vl4hyPH9kJOowMKuBPT14LZs8R7i6iRzAvLg4vy1iaGYIi3E5lYXku6DVG8xl258MhEl E11Q+enPS9OJ02bTdGX9v8A4hEx02Brb38Kxi3nQOfl6km6CZ0My6MEozc6OUudKSHD2 kWixGUmfrVcQczIGzuiq4qKlMsZoHHEDPx8WHoXnoe6jMj96x4/AAWrNkteBp0x15qMV yQPmd/JcBLUbLvLO4WCP/uNjORquLpGHF8O1GKCVNz0drUGPUSfR27pKbWBGJVtNZL31 wh4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Qfgy4sCCCO9qTQgchyD2bDgwppQqFA1HOWEoZpdCsZk=; b=OMabP//BMbH5xk5rQ1/muWsw3pePJkJfAxEGBb2NiEa2AaNW3AjXb9trmRAg1rRdiO EefnqexA/OUC0rc+hyElTwZJs4xB6hcnyxBXuRNqibtaN/m3atn0tsuNnPcVNCVljYQY BF4d+4jD2pmZ4/x+JdrNOAWX3VvqCs+np+b7a3oc8TWr97siPj5ljBR/OR+zEazmHq63 5mYYZ5bWdkEfUSIAdH15svAEbm2IjpgLfxqcRBYW/jVIdAzc/i6ZuKpUha306BLa/TgO q6wukgmhDHABxLi9kjNlExQ6QBkBvEwNnpIsX6xORlZSOWc+0J7MFzy3Zz8V3U5nbnPf X8Rw== X-Gm-Message-State: APjAAAXzSiJBQoxEzsyd/hc8jYZptMjWRveW2Pu+UE/9D4s9satXaIB2 sZSKzc9QEsFNro9+MXIxKHI= X-Received: by 2002:a63:1106:: with SMTP id g6mr282135pgl.13.1580321347528; Wed, 29 Jan 2020 10:09:07 -0800 (PST) Received: from [192.168.0.16] (97-115-104-237.ptld.qwest.net. [97.115.104.237]) by smtp.gmail.com with ESMTPSA id n15sm204952pfq.168.2020.01.29.10.09.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jan 2020 10:09:06 -0800 (PST) Subject: Re: [PATCH] kbuild: Include external modules compile flags From: Gregory Rose To: Masahiro Yamada Cc: Linux Kernel Mailing List , dev@openvswitch.org, dsahern@gmail.com References: <1580161806-8037-1-git-send-email-gvrose8192@gmail.com> Message-ID: <677aff5a-a52e-08ae-f341-547af08f7566@gmail.com> Date: Wed, 29 Jan 2020 10:09:05 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. [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. 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. That said, I'm no expert on the Linux kernel Makefile interdependencies.  If you have some other idea we could try I'm game. Thanks, - Greg