linux-mips
[Top] [All Lists]

[PATCH] fix modpost segfault for 64bit mipsel kernel

To: linux-mips@linux-mips.org
Subject: [PATCH] fix modpost segfault for 64bit mipsel kernel
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 17 Apr 2006 21:00:39 +0900 (JST)
Cc: ralf@linux-mips.org, sam@ravnborg.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
64bit mips has different r_info layout.  This patch fixes modpost
segfault for 64bit little endian mips kernel.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index cd00e9f..7846600 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -712,7 +712,13 @@ static void check_sec_ref(struct module 
                        r.r_offset = TO_NATIVE(rela->r_offset);
                        r.r_info   = TO_NATIVE(rela->r_info);
                        r.r_addend = TO_NATIVE(rela->r_addend);
+#if KERNEL_ELFCLASS == ELFCLASS64 && KERNEL_ELFDATA == ELFDATA2LSB
+                       sym = elf->symtab_start +
+                               (hdr->e_machine == EM_MIPS ?
+                                (Elf32_Word)r.r_info : ELF_R_SYM(r.r_info));
+#else
                        sym = elf->symtab_start + ELF_R_SYM(r.r_info);
+#endif
                        /* Skip special sections */
                        if (sym->st_shndx >= SHN_LORESERVE)
                                continue;

<Prev in Thread] Current Thread [Next in Thread>