Re: [PATCH v5 3/3] Documentation/llvm: update CROSS_COMPILE inferencing
From: Nick Desaulniers
Date: Mon Aug 02 2021 - 14:30:36 EST
On Fri, Jul 30, 2021 at 5:05 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Sat, Jul 31, 2021 at 8:12 AM Fangrui Song <maskray@xxxxxxxxxx> wrote:
> >
> > On 2021-07-30, Nick Desaulniers wrote:
> > >+For example, to cross-compile the arm64 kernel::
> > >+
> > >+ ARCH=arm64 make LLVM=1 LLVM_IAS=1
> >
> > Is ARCH=arm64 make LLVM=1 LLVM_IAS=1
> >
> > preferred over
> >
> > make ARCH=arm64 LLVM=1 LLVM_IAS=1
> >
> > ?
>
>
> I do not think so.
>
> For consistency,
>
> make ARCH=arm64 LLVM=1 LLVM_IAS=1
>
> or
>
> ARCH=arm64 LLVM=1 LLVM_IAS=1 make
>
> might be preferred.
>
>
>
> But, in the same doc, I see an example, which
> mixes up the env variables and a make variable.
>
> ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
Perhaps it's just muscle memory from when I started working on Nexus
phone kernels ~5 years ago; that's how our build scripts invoked make
(with ARCH and CROSS_COMPILE as env vars).
IIRC, GNU make has the notion of `origin` for variables.
https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
So "before `make`" would be "environment" and "after `make`" would be
"command line."
I'm rereading the section on assignment to see if one of the
assignment operators was affected by origin.
https://www.gnu.org/software/make/manual/html_node/Setting.html
https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors
I could have sworn that due to one of the assignment operators
(perhaps `?=`) that the orderings weren't commutative.
$ make ARCH=arm64 LLVM=1 LLVM_IAS=1 -j72
works
$ ARCH=arm64 LLVM=1 LLVM_IAS=1 make -j72
also works. Hmm...maybe I misremembered the issue then.
Ok, I will reorder all instances to use the command line rather than
env vars in v6.
--
Thanks,
~Nick Desaulniers