From 6315da883109d22dcabd3493d9cad38547d780db Mon Sep 17 00:00:00 2001 From: phcoder Date: Sat, 10 Oct 2009 14:54:18 +0200 Subject: [PATCH] fake __gnu_local_gp --- conf/mips.rmk | 2 +- genmoddep.awk | 2 +- kern/mips/dl.c | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/conf/mips.rmk b/conf/mips.rmk index b0a078197..77eaa06cf 100644 --- a/conf/mips.rmk +++ b/conf/mips.rmk @@ -17,7 +17,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \ env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \ symbol.h term.h time.h types.h loader.h partition.h \ msdos_partition.h machine/kernel.h handler.h list.h \ - command.h machine/memory.h cpu/libgcc.h cpu/cache.h + command.h machine/memory.h cpu/libgcc.h cpu/cache.h cpu/dl.h symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) diff --git a/genmoddep.awk b/genmoddep.awk index af967ec07..f7f085e99 100644 --- a/genmoddep.awk +++ b/genmoddep.awk @@ -29,7 +29,7 @@ FNR == 1 { if ($1 in symtab) { modtab[module] = modtab[module] " " symtab[$1]; } - else if ($1 != "__gnu_local_gp"){ + else { printf "%s in %s is not defined\n", $1, module >"/dev/stderr"; error++; exit; diff --git a/kern/mips/dl.c b/kern/mips/dl.c index 504bb2ef5..f8b11a3eb 100644 --- a/kern/mips/dl.c +++ b/kern/mips/dl.c @@ -21,6 +21,7 @@ #include #include #include +#include /* Check if EHDR is a valid ELF header. */ grub_err_t @@ -29,9 +30,15 @@ grub_arch_dl_check_header (void *ehdr) Elf_Ehdr *e = ehdr; /* Check the magic numbers. */ +#ifdef WORDS_BIGENDIAN + if (e->e_ident[EI_CLASS] != ELFCLASS32 + || e->e_ident[EI_DATA] != ELFDATA2MSB + || e->e_machine != EM_MIPS) +#else if (e->e_ident[EI_CLASS] != ELFCLASS32 || e->e_ident[EI_DATA] != ELFDATA2LSB - || e->e_machine != EM_386) + || e->e_machine != EM_MIPS) +#endif return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic"); return GRUB_ERR_NONE; -- 2.39.5