Skip to contentSkip to conversation

ARM: decompressor: do not copy source files while building

PATCH In review Masahiro Yamada 2 participants 6 messages Oct 30, 2021 – Mar 31, 2022 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: decompressor: do not copy source files while building

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

---

KernelVersion: v5.15-rc1

 arch/arm/boot/compressed/.gitignore  |  5 -----
 arch/arm/boot/compressed/Makefile    | 33 +++-------------------------
 arch/arm/boot/compressed/ashldi3.S   |  3 +++
 arch/arm/boot/compressed/bswapsdi2.S |  3 +++
 arch/arm/boot/compressed/font.c      |  2 ++
 arch/arm/boot/compressed/hyp-stub.S  |  2 ++
 arch/arm/boot/compressed/lib1funcs.S |  3 +++
 scripts/remove-stale-files           |  2 +-
 8 files changed, 17 insertions(+), 36 deletions(-)
 create mode 100644 arch/arm/boot/compressed/ashldi3.S
 create mode 100644 arch/arm/boot/compressed/bswapsdi2.S
 create mode 100644 arch/arm/boot/compressed/font.c
 create mode 100644 arch/arm/boot/compressed/hyp-stub.S
 create mode 100644 arch/arm/boot/compressed/lib1funcs.S
arch/arm/boot/compressed/.gitignore +0 -5
index 60606b0f378d..d32f41778437 100644
@@ -1,9 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
-ashldi3.S
-bswapsdi2.S
-font.c
-lib1funcs.S
-hyp-stub.S
 piggy_data
 vmlinux
 vmlinux.lds
arch/arm/boot/compressed/Makefile +3 -30
index 91265e7ff672..74d2f1401acb 100644
@@ -13,7 +13,6 @@ ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
 OBJS	+= debug.o
 AFLAGS_head.o += -DDEBUG
 endif
-FONTC	= $(srctree)/lib/fonts/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)
 OBJS		+= string.o
@@ -99,11 +98,8 @@ $(foreach o, $(libfdt_objs) atags_to_fdt.o fdt_check_mem_start.o, \
 	$(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt -fno-stack-protector))
 
 targets       := vmlinux vmlinux.lds piggy_data piggy.o \
-		 lib1funcs.o ashldi3.o bswapsdi2.o \
 		 head.o $(OBJS)
 
-clean-files += lib1funcs.S ashldi3.S bswapsdi2.S hyp-stub.S
-
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 
 ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
@@ -134,23 +130,7 @@ endif
 # Next argument is a linker script
 LDFLAGS_vmlinux += -T
 
-# For __aeabi_uidivmod
-lib1funcs = $(obj)/lib1funcs.o
-
-$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
-	$(call cmd,shipped)
-
-# For __aeabi_llsl
-ashldi3 = $(obj)/ashldi3.o
-
-$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
-	$(call cmd,shipped)
-
-# For __bswapsi2, __bswapdi2
-bswapsdi2 = $(obj)/bswapsdi2.o
-
-$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
-	$(call cmd,shipped)
+OBJS	+= lib1funcs.o ashldi3.o bswapsdi2.o
 
 # We need to prevent any GOTOFF relocs being used with references
 # to symbols in the .bss section since we cannot relocate them
@@ -175,8 +155,8 @@ fi
 efi-obj-$(CONFIG_EFI_STUB) := $(objtree)/drivers/firmware/efi/libstub/lib.a
 
 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
-		$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
-		$(bswapsdi2) $(efi-obj-y) FORCE
+		$(addprefix $(obj)/, $(OBJS)) \
+		$(efi-obj-y) FORCE
 	@$(check_for_multiple_zreladdr)
 	$(call if_changed,ld)
 	@$(check_for_bad_syms)
@@ -187,11 +167,4 @@ $(obj)/piggy_data: $(obj)/../Image FORCE
 $(obj)/piggy.o: $(obj)/piggy_data
 
 CFLAGS_font.o := -Dstatic=
-
-$(obj)/font.c: $(FONTC)
-	$(call cmd,shipped)
-
 AFLAGS_hyp-stub.o := -Wa,-march=armv7-a
-
-$(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S
-	$(call cmd,shipped)
arch/arm/boot/compressed/ashldi3.S new file +3 -0
new file mode 100644
index 000000000000..216f82eda609
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* For __aeabi_llsl */
+#include "../../lib/ashldi3.S"
arch/arm/boot/compressed/bswapsdi2.S new file +3 -0
new file mode 100644
index 000000000000..b2156b378c7b
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* For __bswapsi2, __bswapdi2 */
+#include "../../lib/bswapsdi2.S"
arch/arm/boot/compressed/font.c new file +2 -0
new file mode 100644
index 000000000000..46a677649db4
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/fonts/font_acorn_8x8.c"
arch/arm/boot/compressed/hyp-stub.S new file +2 -0
new file mode 100644
index 000000000000..a703eaa86f10
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include "../../kernel/hyp-stub.S"
arch/arm/boot/compressed/lib1funcs.S new file +3 -0
new file mode 100644
index 000000000000..815dec73ba4d
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* For __aeabi_uidivmod */
+#include "../../lib/lib1funcs.S"
scripts/remove-stale-files +1 -1
index c3eb81c3f7de..eb630ee287c3 100755
@@ -24,7 +24,7 @@ set -e
 # with O=, make sure to remove the stale files in the output tree. Otherwise,
 # the build system wrongly compiles the stale ones.
 if [ -n "${building_out_of_srctree}" ]; then
-	for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
+	for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c ashldi3.S bswapsdi2.S font.c lib1funcs.S hyp-stub.S
 	do
 		rm -f arch/arm/boot/compressed/${f}
 	done
Signature · 1 line
2.30.2
#1 lore raw
Quoted 8 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

Hi,

I am now seeing the following every time I run a build:

  GEN     Makefile
  CALL    .../linux-rmk/scripts/atomic/check-atomics.sh
  CALL    .../linux-rmk/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  LD      arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

In other words, those three objects are always rebuilt even though they haven't changed.

I've tried removing the arch/arm/boot/compressed directory in the build tree, but that doesn't make any difference.

Running with V=2 shows:

AS arch/arm/boot/compressed/lib1funcs.o - due to lib1funcs.o not in $(tar
gets)
AS arch/arm/boot/compressed/ashldi3.o - due to ashldi3.o not in $(targets)
AS arch/arm/boot/compressed/bswapsdi2.o - due to bswapsdi2.o not in $(targets)

It looks to me like:
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

in your patch should have been added before:

targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)

Please confirm.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#2 lore raw
Quoted 43 lines · Russell King (Oracle)
Quoted 8 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

Hi,

I am now seeing the following every time I run a build:

  GEN     Makefile
  CALL    .../linux-rmk/scripts/atomic/check-atomics.sh
  CALL    .../linux-rmk/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  LD      arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

In other words, those three objects are always rebuilt even though they haven't changed.

I've tried removing the arch/arm/boot/compressed directory in the build tree, but that doesn't make any difference.

Running with V=2 shows:

AS arch/arm/boot/compressed/lib1funcs.o - due to lib1funcs.o not in $(tar
gets)
AS arch/arm/boot/compressed/ashldi3.o - due to ashldi3.o not in $(targets)
AS arch/arm/boot/compressed/bswapsdi2.o - due to bswapsdi2.o not in $(targets)

It looks to me like:
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

Quoted 6 lines

in your patch should have been added before:

targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)

Please confirm.

Sorry for my late reply.

Yes, you are right.

OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

should come before the 'targets' assignment.

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

Hi Russell,

Was this issue fixed?
(I see nothing happened in linux-next yet)

I will not send a patch because I assume you will fix this by yourself. If there is something you want me, please let me know.

Thanks.
Masahiro Yamada

Quoted 69 lines · Masahiro Yamada
Quoted 43 lines · Russell King (Oracle)
Quoted 8 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

Hi,

I am now seeing the following every time I run a build:

  GEN     Makefile
  CALL    .../linux-rmk/scripts/atomic/check-atomics.sh
  CALL    .../linux-rmk/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  LD      arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

In other words, those three objects are always rebuilt even though they haven't changed.

I've tried removing the arch/arm/boot/compressed directory in the build tree, but that doesn't make any difference.

Running with V=2 shows:

AS arch/arm/boot/compressed/lib1funcs.o - due to lib1funcs.o not in $(tar
gets)
AS arch/arm/boot/compressed/ashldi3.o - due to ashldi3.o not in $(targets)
AS arch/arm/boot/compressed/bswapsdi2.o - due to bswapsdi2.o not in $(targets)

It looks to me like:
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

Quoted 6 lines

in your patch should have been added before:

targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)

Please confirm.

Sorry for my late reply.

Yes, you are right.

OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

should come before the 'targets' assignment.

--
Best Regards
Masahiro Yamada

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

Hi,

Your reply was too late for me, I've been away on vacation from 14th March until now... and now I've got a whole truck-load of catch-up, so it's likely I'll forget to sort this. Please send a patch to fix it, thanks.

Quoted 95 lines · Masahiro Yamada

Hi Russell,

Was this issue fixed?
(I see nothing happened in linux-next yet)

I will not send a patch because I assume you will fix this by yourself. If there is something you want me, please let me know.

Thanks.
Masahiro Yamada

Quoted 69 lines · Masahiro Yamada
Quoted 43 lines · Russell King (Oracle)
Quoted 8 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

Hi,

I am now seeing the following every time I run a build:

  GEN     Makefile
  CALL    .../linux-rmk/scripts/atomic/check-atomics.sh
  CALL    .../linux-rmk/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  LD      arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

In other words, those three objects are always rebuilt even though they haven't changed.

I've tried removing the arch/arm/boot/compressed directory in the build tree, but that doesn't make any difference.

Running with V=2 shows:

AS arch/arm/boot/compressed/lib1funcs.o - due to lib1funcs.o not in $(tar
gets)
AS arch/arm/boot/compressed/ashldi3.o - due to ashldi3.o not in $(targets)
AS arch/arm/boot/compressed/bswapsdi2.o - due to bswapsdi2.o not in $(targets)

It looks to me like:
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

Quoted 6 lines

in your patch should have been added before:

targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)

Please confirm.

Sorry for my late reply.

Yes, you are right.

OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

should come before the 'targets' assignment.

--
Best Regards
Masahiro Yamada

Signature · 2 lines
Best Regards
Masahiro Yamada
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#5 lore raw
Quoted 7 lines · Russell King (Oracle)

Hi,

Your reply was too late for me, I've been away on vacation from 14th March until now... and now I've got a whole truck-load of catch-up, so it's likely I'll forget to sort this. Please send a patch to fix it, thanks.

Done.

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9189/1

Thanks.

Quoted 101 lines · Masahiro Yamada
Quoted 91 lines

Hi Russell,

Was this issue fixed?
(I see nothing happened in linux-next yet)

I will not send a patch because I assume you will fix this by yourself. If there is something you want me, please let me know.

Thanks.
Masahiro Yamada

Quoted 66 lines · Masahiro Yamada
Quoted 43 lines · Russell King (Oracle)
Quoted 8 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for the other library files for further cleanups of the Makefile and .gitignore.

Hi,

I am now seeing the following every time I run a build:

  GEN     Makefile
  CALL    .../linux-rmk/scripts/atomic/check-atomics.sh
  CALL    .../linux-rmk/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  LD      arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

In other words, those three objects are always rebuilt even though they haven't changed.

I've tried removing the arch/arm/boot/compressed directory in the build tree, but that doesn't make any difference.

Running with V=2 shows:

AS arch/arm/boot/compressed/lib1funcs.o - due to lib1funcs.o not in $(tar
gets)
AS arch/arm/boot/compressed/ashldi3.o - due to ashldi3.o not in $(targets)
AS arch/arm/boot/compressed/bswapsdi2.o - due to bswapsdi2.o not in $(targets)

It looks to me like:
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

Quoted 6 lines

in your patch should have been added before:

targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)

Please confirm.

Sorry for my late reply.

Yes, you are right.

OBJS += lib1funcs.o ashldi3.o bswapsdi2.o

should come before the 'targets' assignment.

Quoted 3 lines

--
Best Regards
Masahiro Yamada

Quoted 4 lines

--
Best Regards
Masahiro Yamada

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Signature · 2 lines
Best Regards
Masahiro Yamada