[PATCH trusty] UBUNTU: Makefile.build: do not forget to run fixdep on .S files

Jason A. Donenfeld Jason at zx2c4.com
Tue May 5 06:35:13 UTC 2020

When Andy converted the .S rule from the basic if_changed_dep to
if_changed_rule, he forgot to add in the requisite call to fixdep inside
the rule. The consequence of this is that when modpost is called,
symbol extraction will cease following the first missing .o.cmd file,
the absence of which is caused by fixdep not running. When compiling
WireGuard, this manifests itself with this sort of WARNING message, and
under the hood the consequences are worse than a mere warning, since
processing of subsequent files stops:

  Building modules, stage 2.
  MODPOST 1 modules
WARNING: could not find /root/wireguard-linux-compat/src/crypto/zinc/chacha20/.chacha20-x86_64.o.cmd for /root/wireguard-linux-compat/src/crypto/zinc/chacha20/chacha20-x86_64.o

Further, as a consequence of there being no .o.cmd file, the build
system is unable to determine whether or not the files changed,
resulting in a rebuild of all .S->.o files on subsequent calls to make:

root at ubuntu:~/wireguard-linux-compat/src# make
  AS [M]  /root/wireguard-linux-compat/src/crypto/zinc/chacha20/chacha20-x86_64.o
  AS [M]  /root/wireguard-linux-compat/src/crypto/zinc/poly1305/poly1305-x86_64.o
  AS [M]  /root/wireguard-linux-compat/src/crypto/zinc/blake2s/blake2s-x86_64.o

The fix to this is simple: simply add in the call to fixdep in the
as_o_S rule definition.

Fixes: 057bd70e ("UBUNTU: [Packaging] retpoline -- add safe usage hint support")
Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
I've been spending some time making sure that WireGuard will be flawless
when it's added to 14.04 as a pre-built, and this is the only remaining
issue that cannot (easily) be fixed from the compat layer.

 scripts/Makefile.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 645677c3..bb272a14 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -312,7 +312,11 @@ endef
 define rule_as_o_S
 	$(call echo-cmd,as_o_S) $(cmd_as_o_S);				  \
-	$(call echo-cmd,ubuntu-retpoline) $(cmd_ubuntu_retpoline)
+	$(call echo-cmd,ubuntu-retpoline) $(cmd_ubuntu_retpoline)         \
+	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,as_o_S)' >    \
+	                                              $(dot-target).tmp;  \
+	rm -f $(depfile);						  \
+	mv -f $(dot-target).tmp $(dot-target).cmd
 # Built-in and composite module parts

More information about the kernel-team mailing list