[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unversioned symbols when building kernel package

On Wed, 2023-01-04 at 22:15 +0100, John Paul Adrian Glaubitz wrote:
> Hello!
> I just tried to build the Debian kernel package for alpha which fails with:
> debian/bin/buildcheck.py debian/build/build_alpha_none_alpha-generic alpha none alpha-generic
> ABI is not completely versioned!  Refusing to continue.
> Unversioned symbols:
> strcat                                           module: vmlinux, version: 0x00000000, export: EXPORT_SYMBOL
> strcpy                                           module: vmlinux, version: 0x00000000, export: EXPORT_SYMBOL
> strncat                                          module: vmlinux, version: 0x00000000, export: EXPORT_SYMBOL
> strncpy                                          module: vmlinux, version: 0x00000000, export: EXPORT_SYMBOL
> Can't read ABI reference.  ABI not checked!
> make[2]: *** [debian/rules.real:218: debian/stamps/build_alpha_none_alpha-generic] Error 1
> make[2]: Leaving directory '/<<PKGBUILDDIR>>'
> make[1]: *** [debian/rules.gen:426: build-arch_alpha_none_alpha-generic_real] Error 2
> make[1]: Leaving directory '/<<PKGBUILDDIR>>'
> make: *** [debian/rules:39: build-arch] Error 2
> dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
> According to this comment by Ben [1], this is an issue that is trivially fixed by adding the
> appropriate header to arch/$ARCH/include/asm-prototypes.h. However, looking at the header
> file, "#include <asm/string.h>" is already present so I'm not sure what else we're missing.

From the Debian build logs, this regressed between 5.18 and 5.19.  I
have bisected this to:

commit f292d875d0dc700b3af0bef04c5abc1dc7b3b62c
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Fri May 13 20:39:21 2022 +0900

    modpost: extract symbol versions from *.cmd files

Following this, although the 4 problem symbols have CRCs listed in
their respective cmd files (arch/alpha/.strcat.o.cmd etc.) those don't
end up in Modules.symvers.

I noticed that the object files for these 4 functions are handled
specially at the bottom of arch/alpha/lib/Makefile, and that interacts
badly with this change to modpost.  The attached patch fixes this for
me, but please test it to check that the output actually works.


Ben Hutchings
Never attribute to conspiracy what can adequately be explained
by stupidity.
From 3c2a26b321d5ba3053986a53940434014059aca7 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 5 Jan 2023 17:04:40 +0100
Subject: [PATCH] alpha: Fix missing symbol versions for str{,n}{cat,cpy}

Now that modpost extracts symbol versions from *.cmd files, it can't
find the versions for these 4 symbols.  This is due to the way we link
their objects together ahead of the full vmlinux link.  genksyms puts
their symbol CRCs in .str{,n}{cat,cpy}.o.cmd, but modpost only reads
the .sty{,n}cpy.o.cmd files.

Add assembly sources that bring the appropriate routines together with
include directives instead of using the linker for this.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Fixes: f292d875d0dc ("modpost: extract symbol versions from *.cmd files")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
 arch/alpha/lib/Makefile  | 14 --------------
 arch/alpha/lib/stycpy.S  |  8 ++++++++
 arch/alpha/lib/styncpy.S |  8 ++++++++
 3 files changed, 16 insertions(+), 14 deletions(-)
 create mode 100644 arch/alpha/lib/stycpy.S
 create mode 100644 arch/alpha/lib/styncpy.S

diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
index 1cc74f7b50ef..8f1c32a25a40 100644
--- a/arch/alpha/lib/Makefile
+++ b/arch/alpha/lib/Makefile
@@ -45,17 +45,3 @@ AFLAGS___remlu.o =       -DREM -DINTSIZE
 $(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
 						$(src)/$(ev6-y)divide.S FORCE
 	$(call if_changed_rule,as_o_S)
-# There are direct branches between {str*cpy,str*cat} and stx*cpy.
-# Ensure the branches are within range by merging these objects.
-LDFLAGS_stycpy.o := -r
-LDFLAGS_styncpy.o := -r
-$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
-		 $(obj)/$(ev6-y)stxcpy.o FORCE
-	$(call if_changed,ld)
-$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
-		 $(obj)/$(ev6-y)stxncpy.o FORCE
-	$(call if_changed,ld)
diff --git a/arch/alpha/lib/stycpy.S b/arch/alpha/lib/stycpy.S
new file mode 100644
index 000000000000..b4376834c91f
--- /dev/null
+++ b/arch/alpha/lib/stycpy.S
@@ -0,0 +1,8 @@
+#include "strcpy.S"
+#include "ev6-strcat.S"
+#include "ev6-stxcpy.S"
+#include "strcat.S"
+#include "stxcpy.S"
diff --git a/arch/alpha/lib/styncpy.S b/arch/alpha/lib/styncpy.S
new file mode 100644
index 000000000000..c393f816ff98
--- /dev/null
+++ b/arch/alpha/lib/styncpy.S
@@ -0,0 +1,8 @@
+#include "strncpy.S"
+#include "ev6-strncat.S"
+#include "ev6-stxncpy.S"
+#include "strncat.S"
+#include "stxncpy.S"

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: