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

The module code applies every relocation section given.  Obviously, if the
section has not been copied into the module, there's no point.  In
particular, Alpha has relocs which are only used on debug sections, so they
don't load with CONFIG_DEBUG_INFO enabled.



 kernel/module.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff -puN kernel/module.c~alpha-relocation-fix kernel/module.c
--- 25/kernel/module.c~alpha-relocation-fix	2004-01-04 22:21:45.000000000 -0800
+++ 25-akpm/kernel/module.c	2004-01-04 22:21:45.000000000 -0800
@@ -1618,9 +1618,13 @@ static struct module *load_module(void _
 	/* Now do relocations. */
 	for (i = 1; i < hdr->e_shnum; i++) {
 		const char *strtab = (char *)sechdrs[strindex].sh_addr;
-		if (sechdrs[i].sh_type == SHT_REL)
-			err = apply_relocate(sechdrs, strtab, symindex, i,mod);
-		else if (sechdrs[i].sh_type == SHT_RELA)
+
+		/* Skip relocations on non-allocated (ie. debug) sections */
+		if (sechdrs[i].sh_type == SHT_REL
+		    && (sechdrs[sechdrs[i].sh_info].sh_flags & SHF_ALLOC))
+			err = apply_relocate(sechdrs, strtab, symindex,i, mod);
+		else if (sechdrs[i].sh_type == SHT_RELA
+			 && (sechdrs[sechdrs[i].sh_info].sh_flags & SHF_ALLOC))
 			err = apply_relocate_add(sechdrs, strtab, symindex, i,
 						 mod);
 		if (err < 0)

_
