Skip to contentSkip to conversation

net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware

PATCH In review Masahiro Yamada 5 participants 13 messages Mar 24, 2020 – Mar 26, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

[1] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/9.2.0/x86_64-gcc-9.2.0-nolibc-m68k-linux.tar.xz

---

 drivers/net/wan/Kconfig  | 2 +-
 drivers/net/wan/Makefile | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wan/Kconfig +1 -1
index 4530840e15ef..0f35ad097744 100644
@@ -200,7 +200,7 @@ config WANXL_BUILD_FIRMWARE
 	depends on WANXL && !PREVENT_FIRMWARE_BUILD
 	help
 	  Allows you to rebuild firmware run by the QUICC processor.
-	  It requires as68k, ld68k and hexdump programs.
+	  It requires cc68k, ld68k and hexdump programs.
 
 	  You should never need this option, say N.
 
drivers/net/wan/Makefile +3 -3
index 701f5d2fe3b6..d21a99711070 100644
@@ -40,16 +40,16 @@ $(obj)/wanxl.o:	$(obj)/wanxlfw.inc
 
 ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
 ifeq ($(ARCH),m68k)
-  AS68K = $(AS)
+  CC68K = $(CC)
   LD68K = $(LD)
 else
-  AS68K = as68k
+  CC68K = cc68k
   LD68K = ld68k
 endif
 
 quiet_cmd_build_wanxlfw = BLD FW  $@
       cmd_build_wanxlfw = \
-	$(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
+	$(CC68K) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \
 	$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
 	hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
 	rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 net: wan: wanxl: refactor the firmware rebuild rule

Split the big recipe into 3 stages: compile, link, and hexdump.

After this commit, the build log with CONFIG_WANXL_BUILD_FIRMWARE will look like this:

  AS68K   drivers/net/wan/wanxlfw.o
  LD68K   drivers/net/wan/wanxlfw.bin
  BLDFW   drivers/net/wan/wanxlfw.inc
  CC [M]  drivers/net/wan/wanxl.o

---

 drivers/net/wan/Makefile | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/wan/Makefile +19 -10
index d21a99711070..b667eae65066 100644
@@ -47,14 +47,23 @@ else
   LD68K = ld68k
 endif
 
-quiet_cmd_build_wanxlfw = BLD FW  $@
-      cmd_build_wanxlfw = \
-	$(CC68K) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \
-	$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
-	hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
-	rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
-
-$(obj)/wanxlfw.inc:	$(src)/wanxlfw.S
-	$(call if_changed_dep,build_wanxlfw)
-targets += wanxlfw.inc
+quiet_cmd_build_wanxlfw = BLDFW   $@
+      cmd_build_wanxlfw = hexdump -ve '"\n" 16/1 "0x%02X,"' $< | \
+	sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' > $@
+
+$(obj)/wanxlfw.inc: $(obj)/wanxlfw.bin FORCE
+	$(call if_changed,build_wanxlfw)
+
+quiet_cmd_m68kld_bin_o = LD68K   $@
+      cmd_m68kld_bin_o = $(LD68K) --oformat binary -Ttext 0x1000 $< -o $@
+
+$(obj)/wanxlfw.bin: $(obj)/wanxlfw.o FORCE
+	$(call if_changed,m68kld_bin_o)
+
+quiet_cmd_m68kas_o_S = AS68K   $@
+      cmd_m68kas_o_S = $(CC68K) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $@ $<
+
+$(obj)/wanxlfw.o: $(src)/wanxlfw.S FORCE
+	$(call if_changed_dep,m68kas_o_S)
 endif
+targets += wanxlfw.inc wanxlfw.bin wanxlfw.o
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/3 kbuild: remove AS variable

In reply to Masahiro Yamada

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.

---

 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Makefile +1 -2
index 16d8271192d1..339e8c51a10b 100644
@@ -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
Signature · 1 line
2.17.1
#8 lore raw
In reply to Masahiro Yamada

Hi Yamada-san,

Quoted 13 lines · Masahiro Yamada

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

Quoted 5 lines

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like provided by Debian/Ubuntu, too?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Reviewed-by Tested-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] kbuild: remove AS variable

In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

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.
Quoted 32 lines

You can still pass in AS=clang, which is just a switch to turn on the LLVM integrated assembler.

---

 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Makefile +1 -3
index 16d8271192d1..339e8c51a10b 100644
@@ -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
--
Signature · 2 lines
Thanks,
~Nick Desaulniers
Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] kbuild: remove AS variable

In reply to Masahiro Yamada
Quoted 10 lines · Masahiro Yamada

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.

#4 lore raw

Re: [PATCH 3/3] kbuild: remove AS variable

In reply to Nick Desaulniers
Quoted 1 line · Nick Desaulniers

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)

Signature · 2 lines
Thanks,
~Nick Desaulniers
#9 lore raw
In reply to Geert Uytterhoeven
Quoted 17 lines · Geert Uytterhoeven

Hi Yamada-san,

Quoted 13 lines · Masahiro Yamada

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

Quoted 9 lines
Quoted 5 lines

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like provided by Debian/Ubuntu, too?

Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu' It successfully compiled this firmware.

In my understanding, the difference is that the kernel.org ones lack libc,
so cannot link userspace programs.

They do not make much difference for this case.

Signature · 2 lines
Best Regards
Masahiro Yamada
#10 lore raw

Hi Yamada-san,

Quoted 21 lines · Masahiro Yamada
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Masahiro Yamada

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

Quoted 6 lines
Quoted 3 lines

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like provided by Debian/Ubuntu, too?

Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu' It successfully compiled this firmware.

Thanks for checking!

Quoted 5 lines

In my understanding, the difference is that the kernel.org ones lack libc,
so cannot link userspace programs.

They do not make much difference for this case.

Indeed.

So perhaps it makes sense to replace cc68k and ld68k in the Makefile by m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold of on a modern system?

What do you think?
Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#11 lore raw

Hi Geert,

Quoted 40 lines · Geert Uytterhoeven

Hi Yamada-san,

Quoted 21 lines · Masahiro Yamada
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Masahiro Yamada

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

Quoted 6 lines
Quoted 3 lines

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like provided by Debian/Ubuntu, too?

Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu' It successfully compiled this firmware.

Thanks for checking!

Quoted 5 lines

In my understanding, the difference is that the kernel.org ones lack libc,
so cannot link userspace programs.

They do not make much difference for this case.

Quoted 9 lines

Indeed.

So perhaps it makes sense to replace cc68k and ld68k in the Makefile by m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold of on a modern system?

What do you think?
Thanks!

If desired, I can do like this:

ifeq ($(ARCH),m68k)
CC_M68K = $(CC)
LD_M68K = $(LD)
else
CC_M68K = $(CROSS_COMPILE_M68K)gcc
LD_M68K = $(CROSS_COMPILE_M68K)ld
endif

Signature · 2 lines
Best Regards
Masahiro Yamada
#12 lore raw

Hi Yamada-san,

Quoted 46 lines · Masahiro Yamada
Quoted 35 lines · Geert Uytterhoeven
Quoted 21 lines · Masahiro Yamada
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Masahiro Yamada

As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on the QUICC, m68k-based Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(AS68K). This is not what we usually do for compiling *.S files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. Instead of combining $(CPP) and (AS) from different tool sets, using single $(CC68K) seems simpler, and saner.

After this commit, the firmware rebuild will require cc68k instead of as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using the kernel.org m68k toolchain. [1]

Quoted 6 lines
Quoted 3 lines

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like provided by Debian/Ubuntu, too?

Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu' It successfully compiled this firmware.

Thanks for checking!

Quoted 4 lines

In my understanding, the difference is that the kernel.org ones lack libc,
so cannot link userspace programs.

Quoted 7 lines
Quoted 1 line

They do not make much difference for this case.

Indeed.

So perhaps it makes sense to replace cc68k and ld68k in the Makefile by m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold of on a modern system?

If desired, I can do like this:

Quoted 7 lines

ifeq ($(ARCH),m68k)
CC_M68K = $(CC)
LD_M68K = $(LD)
else
CC_M68K = $(CROSS_COMPILE_M68K)gcc
LD_M68K = $(CROSS_COMPILE_M68K)ld
endif

Thanks, that looks good to me.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#7 lore raw

Re: [PATCH 3/3] kbuild: remove AS variable

In reply to Masahiro Yamada
I love your patch! Yet something to improve:

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

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(a)lists.01.org

#5 lore raw

Re: [PATCH 3/3] kbuild: remove AS variable

In reply to Nick Desaulniers

Hi Nick,

Quoted 8 lines · Nick Desaulniers
Quoted 1 line · Nick Desaulniers

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) .

Signature · 2 lines
Best Regards
Masahiro Yamada