From: Mathieu Chouquet-Stringer <mchouque@online.fr>

This patch makes the following code work again:

#ifdef STT_REGISTER
                if (info->hdr->e_machine == EM_SPARC ||
                    info->hdr->e_machine == EM_SPARCV9) {
                        /* Ignore register directives. */
                        if (ELF_ST_TYPE(sym->st_info) == STT_REGISTER)
                                break;
                }
#endif

This portion of code is sparc specific and nothing else in modpost.c uses
e_machine meaning cross-compiling for sparc on i386 (or any little endian
machine) is the only way to experience the bug.

Without it, e_machine has the wrong value and modpost then generates a lot
of "*** Warning: \"symbol\" [filename.ko] undefined" messages.


---

 25-akpm/scripts/modpost.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN scripts/modpost.c~fix-endianess-in-modpost-when-cross-compiling-for-sparc-on-i386 scripts/modpost.c
--- 25/scripts/modpost.c~fix-endianess-in-modpost-when-cross-compiling-for-sparc-on-i386	2004-05-12 17:43:24.473981200 -0700
+++ 25-akpm/scripts/modpost.c	2004-05-12 17:43:24.477980592 -0700
@@ -267,6 +267,7 @@ parse_elf(struct elf_info *info, const c
 	hdr->e_shoff    = TO_NATIVE(hdr->e_shoff);
 	hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
 	hdr->e_shnum    = TO_NATIVE(hdr->e_shnum);
+	hdr->e_machine  = TO_NATIVE(hdr->e_machine);
 	sechdrs = (void *)hdr + hdr->e_shoff;
 	info->sechdrs = sechdrs;
 

_