Skip to contentSkip to conversation

kbuild: modpost: Explicitly warn about unprototyped symbols

PATCH Superseded Mark Brown 2 participants 2 messages Jun 4, 2021 – Jun 5, 2021 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 kbuild: modpost: Explicitly warn about unprototyped symbols

One common cause of modpost version generation failures is is a failure to prototype exported assembly functions - the tooling requires this for exported functions even if they are not and should not be called from C code in order to do the version mangling for symbols. Unfortunately the error message is currently rather abstruse, simply saying that "version generation failed" and even diving into the code doesn't directly show what's going on since there's several steps between the problem and it being observed.

Provide an explicit hint as to the likely cause of a version generation failure to help anyone who runs into this in future more readily diagnose and fix the problem.

---
 scripts/mod/modpost.c | 2 ++
 1 file changed, 2 insertions(+)
scripts/mod/modpost.c +2 -0
index 3e623ccc020b..78553f95c250 100644
@@ -662,6 +662,8 @@ static void handle_modversion(const struct module *mod,
 	if (sym->st_shndx == SHN_UNDEF) {
 		warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",
 		     symname, mod->name, mod->is_vmlinux ? "" : ".ko");
+		warn("Is \"%s\" prototyped in asm/asm-prototypes.h?\n",
+		     symname);
 		return;
 	}
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Mark Brown

One common cause of modpost version generation failures is is a failure to

double "is"

Quoted 22 lines

prototype exported assembly functions - the tooling requires this for exported functions even if they are not and should not be called from C code in order to do the version mangling for symbols. Unfortunately the error message is currently rather abstruse, simply saying that "version generation failed" and even diving into the code doesn't directly show what's going on since there's several steps between the problem and it being observed.

Provide an explicit hint as to the likely cause of a version generation failure to help anyone who runs into this in future more readily diagnose and fix the problem.

---
 scripts/mod/modpost.c | 2 ++
 1 file changed, 2 insertions(+)
scripts/mod/modpost.c +0 -0
index 3e623ccc020b..78553f95c250 100644

scripts/mod/modpost.c static void handle_modversion(const struct module *mod, · line 666

Quoted 5 lines
scripts/mod/modpost.c +2 -0
@@ -662,6 +662,8 @@ static void handle_modversion(const struct module *mod,
        if (sym->st_shndx == SHN_UNDEF) {
                warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",
                     symname, mod->name, mod->is_vmlinux ? "" : ".ko");
+               warn("Is \"%s\" prototyped in asm/asm-prototypes.h?\n",
+                    symname);

May I ask for small changes?

Could you enclose the header with angle bralets, like this <asm/asm-protytypes.h> ?

These two sentences are related, so could you merge them into a single warn() call, like this ?

warn("EXPORT symbol \"%s\" [%s%s] version ...\n",

         "Is \"%s\" prototyped in <asm/asm-prototypes.h>?\n",
          symname, mod->name, mod->is_vmlinux ? "" : ".ko", modname);
Quoted 7 lines
scripts/mod/modpost.c +0 -1
                return;
        }
 
 
--

2.20.1

--
Best Regards
Masahiro Yamada