Commit 42f0e8f2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix endianess in modpost when cross-compiling for sparc on i386

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.
parent 7d0c5f9a
......@@ -267,6 +267,7 @@ parse_elf(struct elf_info *info, const char *filename)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment