
From: Rusty Russell <rusty@rustcorp.com.au>

PowerPC64 ABI has ".funcname" (the actual function) and "funcname" (the
function descriptor) and we strip off the dots in "dedotify" called from
module_frob_arch_sections().  We need to also de-dotify the corresponding
names in the __version section.

Actually has nothing to do with __down, it's just that we only print the
first symbol whose version is missing.


---

 25-akpm/arch/ppc64/kernel/module.c |   13 +++++++++++++
 1 files changed, 13 insertions(+)

diff -puN arch/ppc64/kernel/module.c~fix-__down-tainting-kernel-with-config_modversions=y arch/ppc64/kernel/module.c
--- 25/arch/ppc64/kernel/module.c~fix-__down-tainting-kernel-with-config_modversions=y	2004-05-10 01:09:50.614258384 -0700
+++ 25-akpm/arch/ppc64/kernel/module.c	2004-05-10 01:09:50.617257928 -0700
@@ -138,6 +138,16 @@ static unsigned long get_stubs_size(cons
 	return relocs * sizeof(struct ppc64_stub_entry);
 }
 
+static void dedotify_versions(struct modversion_info *vers,
+			      unsigned long size)
+{
+	struct modversion_info *end;
+
+	for (end = (void *)vers + size; vers < end; vers++)
+		if (vers->name[0] == '.')
+			memmove(vers->name, vers->name+1, strlen(vers->name));
+}
+
 /* Undefined symbols which refer to .funcname, hack to funcname */
 static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
 {
@@ -166,6 +176,9 @@ int module_frob_arch_sections(Elf64_Ehdr
 			me->arch.stubs_section = i;
 		else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0)
 			me->arch.toc_section = i;
+		else if (strcmp(secstrings+sechdrs[i].sh_name,"__versions")==0)
+			dedotify_versions((void *)hdr + sechdrs[i].sh_offset,
+					  sechdrs[i].sh_size);
 
 		/* We don't handle .init for the moment: rename to _init */
 		while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))

_
