Message ID | 20200324161539.7538-3-masahiroy@kernel.org |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
Series | [1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware | expand |
On Tue, Mar 24, 2020 at 9:16 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > As commit 5ef872636ca7 ("kbuild: get rid of misleading $(AS) from > documents") noted, we rarely use $(AS) in the kernel build. > > Now that the only/last user of $(AS) in drivers/net/wan/Makefile was > converted to $(CC), $(AS) is no longer used in the build process. TIL that we don't actually invoke the assembler at all for out of line assembly files, but rather use the compiler as the "driver". scripts/Makefile.build: 329 quiet_cmd_as_o_S = AS $(quiet_modtag) $@ 330 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< Though I am personally conflicted, as commit 055efab3120b ("kbuild: drop support for cc-ldoption") since we do the opposite for the linker (we do not use the compiler as the driver for the linker using -Wl,-foo flags). I wish we were consistent in this regard (and not using the compiler as the driver), but that is a yak-shave+bikeshed (I typed out yakshed without thinking; maybe a new entry for Linux kernel urban dictionary or The Jargon File) for another day. $ grep -nR --include="Makefile" '(AS)' . Turned up only this change and the above referenced wan driver. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> > > You can still pass in AS=clang, which is just a switch to turn on > the LLVM integrated assembler. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > Makefile | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 16d8271192d1..339e8c51a10b 100644 > --- a/Makefile > +++ b/Makefile > @@ -405,7 +405,6 @@ KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) > KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) > > # Make variables (CC, etc...) > -AS = $(CROSS_COMPILE)as > LD = $(CROSS_COMPILE)ld > CC = $(CROSS_COMPILE)gcc > CPP = $(CC) -E > @@ -472,7 +471,7 @@ KBUILD_LDFLAGS := > GCC_PLUGINS_CFLAGS := > CLANG_FLAGS := > > -export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC > +export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC > export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL > export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX > export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE > --
On Wed, Mar 25, 2020 at 01:15:39AM +0900, Masahiro Yamada wrote: > As commit 5ef872636ca7 ("kbuild: get rid of misleading $(AS) from > documents") noted, we rarely use $(AS) in the kernel build. > > Now that the only/last user of $(AS) in drivers/net/wan/Makefile was > converted to $(CC), $(AS) is no longer used in the build process. > > You can still pass in AS=clang, which is just a switch to turn on > the LLVM integrated assembler. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
On Tue, Mar 24, 2020 at 12:38 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
> consistent in this regard (and not using the compiler as the driver),
Ah, the preprocessor; we need to preprocess the .S files, .s files are
fine (though we have .lds.S files that are not `-x
assembler-with-cpp`)
Hi Masahiro, I love your patch! Yet something to improve: [auto build test ERROR on kbuild/for-next] [also build test ERROR on net-next/master net/master linus/master v5.6-rc7 next-20200325] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Masahiro-Yamada/net-wan-wanxl-use-CC68K-instead-of-AS68K-for-rebuilding-firmware/20200326-034145 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next config: powerpc-defconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2093fdd429d52348e08969180ac6b1e705fc4ff6) reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER=clang make.cross ARCH=powerpc If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> /bin/sh: 0: Illegal option -- 6 real 3 user 2 sys 107.14% cpu make distclean -- >> /bin/sh: 0: Illegal option -- 4 real 4 user 1 sys 114.93% cpu make olddefconfig -- >> /bin/sh: 0: Illegal option -- /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x58): first defined here clang-11: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [scripts/Makefile.host:116: scripts/dtc/dtc] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [Makefile:1270: scripts_dtc] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:180: sub-make] Error 2 17 real 6 user 11 sys 102.46% cpu make prepare --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Nick, On Wed, Mar 25, 2020 at 4:59 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Tue, Mar 24, 2020 at 12:38 PM Nick Desaulniers > <ndesaulniers@google.com> wrote: > > consistent in this regard (and not using the compiler as the driver), > > Ah, the preprocessor; we need to preprocess the .S files, .s files are > fine (though we have .lds.S files that are not `-x > assembler-with-cpp`) Right, there is no '*.s' source file in the kernel tree. If we want to de-couple $(AS), we must the compilation before the assemble stage ( $(CC) -S ), but doing so does not buy us. So, $(CC) always works as the front-end for compiling both .c and .S files. You can see the internal database by 'make --print-data-base'. I see the following for *.S -> *.o rule. # default COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c So, using $(CC) is the right thing. Even if we keep AS, we cannot do like AS=llvm-as since llvm-as is a different kind of tool that processes LLVM assembly (.ll) .
diff --git a/Makefile b/Makefile index 16d8271192d1..339e8c51a10b 100644 --- a/Makefile +++ b/Makefile @@ -405,7 +405,6 @@ KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # Make variables (CC, etc...) -AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E @@ -472,7 +471,7 @@ KBUILD_LDFLAGS := GCC_PLUGINS_CFLAGS := CLANG_FLAGS := -export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC +export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
As commit 5ef872636ca7 ("kbuild: get rid of misleading $(AS) from documents") noted, we rarely use $(AS) in the kernel build. Now that the only/last user of $(AS) in drivers/net/wan/Makefile was converted to $(CC), $(AS) is no longer used in the build process. You can still pass in AS=clang, which is just a switch to turn on the LLVM integrated assembler. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)