Skip to contentSkip to conversation

x86/boot: Fix if_changed build flip/flop

PATCH Superseded Kees Cook 3 participants 3 messages Jul 15, 2018 – Jul 18, 2018 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 x86/boot: Fix if_changed build flip/flop

The if_changed kbuild function can only be used once per target. If not it will effectively always trigger, flipping back and forth between the two commands getting recorded. Instead, merge the two commands into a single function to get stable build artifacts (i.e. .vmlinux.cmd).

Fixes 98f78525371b ("x86/boot: Refuse to build with data relocations")
---
 arch/x86/boot/compressed/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/Makefile +6 -2
index fa42f895fdde..169c2feda14a 100644
@@ -106,9 +106,13 @@ define cmd_check_data_rel
 	done
 endef
 
+# We need to run two commands under "if_changed", so merge them into a
+# single invocation.
+quiet_cmd_check-and-link-vmlinux = LD      $@
+      cmd_check-and-link-vmlinux = $(cmd_check_data_rel); $(cmd_ld)
+
 $(obj)/vmlinux: $(vmlinux-objs-y) FORCE
-	$(call if_changed,check_data_rel)
-	$(call if_changed,ld)
+	$(call if_changed,check-and-link-vmlinux)
 
 OBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
 $(obj)/vmlinux.bin: vmlinux FORCE
Signature · 6 lines
2.17.1


-- 
Kees Cook
Pixel Security
#1 lore raw
Quoted 6 lines · Kees Cook

The if_changed kbuild function can only be used once per target. If not it will effectively always trigger, flipping back and forth between the two commands getting recorded. Instead, merge the two commands into a single function to get stable build artifacts (i.e. .vmlinux.cmd).

What actual symptoms does this bug have?

I.e. it would be nice if the changelog started with such an explanation:

Dirk Gouders reported that .... <bad stuff happens during kernel build> ... and bisected it back to:

    98f78525371b ("x86/boot: Refuse to build with data relocations")

The root cause of the bug is that the if_changed kbuild function ...

Or something like that.

Thanks,

Ingo

Reviewed-by
#2 lore raw

2018-07-16 7:58 GMT+09:00 Ingo Molnar <[email protected]>:

Quoted 19 lines · Kees Cook
Quoted 7 lines

The if_changed kbuild function can only be used once per target. If not it will effectively always trigger, flipping back and forth between the two commands getting recorded. Instead, merge the two commands into a single function to get stable build artifacts (i.e. .vmlinux.cmd).

What actual symptoms does this bug have?

I.e. it would be nice if the changelog started with such an explanation:

Dirk Gouders reported that .... <bad stuff happens during kernel build> ... and bisected it back to:

    98f78525371b ("x86/boot: Refuse to build with data relocations")
Quoted 7 lines

The root cause of the bug is that the if_changed kbuild function ...

Or something like that.

Thanks,

Ingo

Anyway, the code diff looks good to me.

Signature · 2 lines
Best Regards
Masahiro Yamada