linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
@ 2020-03-24 16:15 Masahiro Yamada
  2020-03-24 16:15 ` [PATCH 2/3] net: wan: wanxl: refactor the firmware rebuild rule Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-24 16:15 UTC (permalink / raw)
  To: linux-kbuild; +Cc: David S . Miller, netdev, linux-kernel, 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]

[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

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/net/wan/Kconfig  | 2 +-
 drivers/net/wan/Makefile | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 4530840e15ef..0f35ad097744 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -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.
 
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index 701f5d2fe3b6..d21a99711070 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] net: wan: wanxl: refactor the firmware rebuild rule
  2020-03-24 16:15 [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Masahiro Yamada
@ 2020-03-24 16:15 ` Masahiro Yamada
  2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
  2020-03-24 17:46 ` [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Geert Uytterhoeven
  2 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-24 16:15 UTC (permalink / raw)
  To: linux-kbuild; +Cc: David S . Miller, netdev, linux-kernel, Masahiro Yamada

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

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/net/wan/Makefile | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index d21a99711070..b667eae65066 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 16:15 [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Masahiro Yamada
  2020-03-24 16:15 ` [PATCH 2/3] net: wan: wanxl: refactor the firmware rebuild rule Masahiro Yamada
@ 2020-03-24 16:15 ` Masahiro Yamada
  2020-03-24 19:38   ` Nick Desaulniers
                     ` (2 more replies)
  2020-03-24 17:46 ` [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Geert Uytterhoeven
  2 siblings, 3 replies; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-24 16:15 UTC (permalink / raw)
  To: linux-kbuild
  Cc: David S . Miller, netdev, linux-kernel, Masahiro Yamada,
	Michal Marek, clang-built-linux

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

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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
  2020-03-24 16:15 [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Masahiro Yamada
  2020-03-24 16:15 ` [PATCH 2/3] net: wan: wanxl: refactor the firmware rebuild rule Masahiro Yamada
  2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
@ 2020-03-24 17:46 ` Geert Uytterhoeven
  2020-03-25  3:49   ` Masahiro Yamada
  2 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2020-03-24 17:46 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, David S . Miller, netdev, Linux Kernel Mailing List

Hi Yamada-san,

On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> 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]

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

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
@ 2020-03-24 19:38   ` Nick Desaulniers
  2020-03-24 19:58     ` Nick Desaulniers
  2020-03-24 19:43   ` Nathan Chancellor
  2020-03-25 21:59   ` kbuild test robot
  2 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2020-03-24 19:38 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kbuild mailing list, David S . Miller, Network Development,
	LKML, Michal Marek, clang-built-linux

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

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
  2020-03-24 19:38   ` Nick Desaulniers
@ 2020-03-24 19:43   ` Nathan Chancellor
  2020-03-25 21:59   ` kbuild test robot
  2 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2020-03-24 19:43 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, David S . Miller, netdev, linux-kernel,
	Michal Marek, clang-built-linux

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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 19:38   ` Nick Desaulniers
@ 2020-03-24 19:58     ` Nick Desaulniers
  2020-03-26  6:13       ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2020-03-24 19:58 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kbuild mailing list, David S . Miller, Network Development,
	LKML, Michal Marek, clang-built-linux

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

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
  2020-03-24 17:46 ` [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Geert Uytterhoeven
@ 2020-03-25  3:49   ` Masahiro Yamada
  2020-03-25  7:52     ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-25  3:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kbuild, David S . Miller, netdev, Linux Kernel Mailing List

On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Yamada-san,
>
> On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > 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]
>
> 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.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
  2020-03-25  3:49   ` Masahiro Yamada
@ 2020-03-25  7:52     ` Geert Uytterhoeven
  2020-03-25  9:05       ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2020-03-25  7:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, David S . Miller, netdev, Linux Kernel Mailing List

Hi Yamada-san,

On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > 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]
> >
> > 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!

> 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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
  2020-03-25  7:52     ` Geert Uytterhoeven
@ 2020-03-25  9:05       ` Masahiro Yamada
  2020-03-25  9:12         ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-25  9:05 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kbuild, David S . Miller, netdev, Linux Kernel Mailing List

Hi Geert,

On Wed, Mar 25, 2020 at 4:53 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Yamada-san,
>
> On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > 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]
> > >
> > > 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!
>
> > 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!
>


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



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware
  2020-03-25  9:05       ` Masahiro Yamada
@ 2020-03-25  9:12         ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2020-03-25  9:12 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, David S . Miller, netdev, Linux Kernel Mailing List

Hi Yamada-san,

On Wed, Mar 25, 2020 at 10:06 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> On Wed, Mar 25, 2020 at 4:53 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > > 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]
> > > >
> > > > 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!
> >
> > > 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?
>
> 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

Thanks, that looks good to me.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
  2020-03-24 19:38   ` Nick Desaulniers
  2020-03-24 19:43   ` Nathan Chancellor
@ 2020-03-25 21:59   ` kbuild test robot
  2 siblings, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2020-03-25 21:59 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: kbuild-all, clang-built-linux, linux-kbuild, David S . Miller,
	netdev, linux-kernel, Masahiro Yamada, Michal Marek

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25739 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] kbuild: remove AS variable
  2020-03-24 19:58     ` Nick Desaulniers
@ 2020-03-26  6:13       ` Masahiro Yamada
  0 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2020-03-26  6:13 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux Kbuild mailing list, David S . Miller, Network Development,
	LKML, Michal Marek, clang-built-linux

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


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-03-26  6:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 16:15 [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Masahiro Yamada
2020-03-24 16:15 ` [PATCH 2/3] net: wan: wanxl: refactor the firmware rebuild rule Masahiro Yamada
2020-03-24 16:15 ` [PATCH 3/3] kbuild: remove AS variable Masahiro Yamada
2020-03-24 19:38   ` Nick Desaulniers
2020-03-24 19:58     ` Nick Desaulniers
2020-03-26  6:13       ` Masahiro Yamada
2020-03-24 19:43   ` Nathan Chancellor
2020-03-25 21:59   ` kbuild test robot
2020-03-24 17:46 ` [PATCH 1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware Geert Uytterhoeven
2020-03-25  3:49   ` Masahiro Yamada
2020-03-25  7:52     ` Geert Uytterhoeven
2020-03-25  9:05       ` Masahiro Yamada
2020-03-25  9:12         ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).