[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 7 Jul 2020 12:58:01 -0700
From: Brendan Higgins <brendanhiggins@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild <linux-kbuild@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Anders Roxell <anders.roxell@...aro.org>,
Sami Tolvanen <samitolvanen@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
"David S. Miller" <davem@...emloft.net>,
Haren Myneni <haren@...ibm.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Ingo Molnar <mingo@...hat.com>, Jiri Kosina <jikos@...nel.org>,
Joe Lawrence <joe.lawrence@...hat.com>,
Jonathan Corbet <corbet@....net>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Michal Marek <michal.lkml@...kovi.net>,
Miroslav Benes <mbenes@...e.cz>,
Paul Mackerras <paulus@...ba.org>,
Petr Mladek <pmladek@...e.com>, Rich Felker <dalias@...c.org>,
Russell King <linux@...linux.org.uk>,
Tal Gilboa <talgi@...lanox.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
KUnit Development <kunit-dev@...glegroups.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-crypto@...r.kernel.org,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, linux-sh@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, live-patching@...r.kernel.org
Subject: Re: [PATCH v2 1/2] kbuild: introduce ccflags-remove-y and asflags-remove-y
On Tue, Jul 7, 2020 at 2:22 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> CFLAGS_REMOVE_<file>.o filters out flags when compiling a particular
> object, but there is no convenient way to do that for every object in
> a directory.
>
> Add ccflags-remove-y and asflags-remove-y to make it easily.
>
> Use ccflags-remove-y to clean up some Makefiles.
>
> The add/remove order works as follows:
>
> [1] KBUILD_CFLAGS specifies compiler flags used globally
>
> [2] ccflags-y adds compiler flags for all objects in the
> current Makefile
>
> [3] ccflags-remove-y removes compiler flags for all objects in the
> current Makefile (New feature)
>
> [4] CFLAGS_<file> adds compiler flags per file.
>
> [5] CFLAGS_REMOVE_<file> removes compiler flags per file.
>
> Having [3] before [4] allows us to remove flags from most (but not all)
> objects in the current Makefile.
>
> For example, kernel/trace/Makefile removes $(CC_FLAGS_FTRACE)
> from all objects in the directory, then adds it back to
> trace_selftest_dynamic.o and CFLAGS_trace_kprobe_selftest.o
>
> Please note ccflags-remove-y has no effect to the sub-directories.
> In contrast, the previous notation got rid of compiler flags also from
> all the sub-directories.
>
> arch/arm/boot/compressed/
> arch/powerpc/xmon/
> arch/sh/
> kernel/trace/
>
> ... have no sub-directories.
>
> lib/
>
> ... has several sub-directories.
>
> To keep the behavior, I added ccflags-remove-y to all Makefiles
> in subdirectories of lib/, except:
>
> lib/vdso/Makefile - Kbuild does not descend into this Makefile
> lib/raid/test/Makefile - This is not used for the kernel build
>
> I think commit 2464a609ded0 ("ftrace: do not trace library functions")
> excluded too much. In later commit, I will try to remove ccflags-remove-y
> from sub-directory Makefiles.
>
> Suggested-by: Sami Tolvanen <samitolvanen@...gle.com>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> Acked-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
> Acked-by: Michael Ellerman <mpe@...erman.id.au> (powerpc)
Acked-by: Brendan Higgins <brendanhiggins@...gle.com> (KUnit)
Powered by blists - more mailing lists