From 09e967c2d732783b2579e4e120cd9b608404cb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 4 Jun 2003 18:31:57 +0000 Subject: Merge from R9_0-AMD64, most notably: - AMD64 support to insmod-busybox, minilibc, et al. - Sync with insmod-modutils 2.4.19 something but everyone should use dietlibc nowadays - Factor out compilation and prefix with $(DIET) for dietlibc builds - 64-bit & varargs fixes --- mdk-stage1/insmod-modutils/obj/obj_load.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'mdk-stage1/insmod-modutils/obj/obj_load.c') diff --git a/mdk-stage1/insmod-modutils/obj/obj_load.c b/mdk-stage1/insmod-modutils/obj/obj_load.c index 4db20a998..62977acb7 100644 --- a/mdk-stage1/insmod-modutils/obj/obj_load.c +++ b/mdk-stage1/insmod-modutils/obj/obj_load.c @@ -21,8 +21,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ident "$Id$" - #include #include #include @@ -52,7 +50,7 @@ obj_load (int fp, Elf32_Half e_type, const char *filename) gzf_lseek(fp, 0, SEEK_SET); if (gzf_read(fp, &f->header, sizeof(f->header)) != sizeof(f->header)) { - error("error reading ELF header %s: %m", filename); + error("cannot read ELF header from %s", filename); return NULL; } @@ -257,7 +255,7 @@ obj_load (int fp, Elf32_Half e_type, const char *filename) { case SHT_RELM: { - unsigned long nrel, j; + unsigned long nrel, j, nsyms; ElfW(RelM) *rel; struct obj_section *symtab; char *strtab; @@ -273,34 +271,25 @@ obj_load (int fp, Elf32_Half e_type, const char *filename) nrel = sec->header.sh_size / sizeof(ElfW(RelM)); rel = (ElfW(RelM) *) sec->contents; symtab = f->sections[sec->header.sh_link]; + nsyms = symtab->header.sh_size / symtab->header.sh_entsize; strtab = f->sections[symtab->header.sh_link]->contents; /* Save the relocate type in each symbol entry. */ for (j = 0; j < nrel; ++j, ++rel) { - ElfW(Sym) *extsym; struct obj_symbol *intsym; unsigned long symndx; symndx = ELFW(R_SYM)(rel->r_info); if (symndx) { - extsym = ((ElfW(Sym) *) symtab->contents) + symndx; - if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL) - { - /* Local symbols we look up in the local table to be sure - we get the one that is really intended. */ - intsym = f->local_symtab[symndx]; - } - else + if (symndx >= nsyms) { - /* Others we look up in the hash table. */ - const char *name; - if (extsym->st_name) - name = strtab + extsym->st_name; - else - name = f->sections[extsym->st_shndx]->name; - intsym = obj_find_symbol(f, name); + error("%s: Bad symbol index: %08lx >= %08lx", + filename, symndx, nsyms); + continue; } + + obj_find_relsym(intsym, f, f, rel, (ElfW(Sym) *)(symtab->contents), strtab); intsym->r_type = ELFW(R_TYPE)(rel->r_info); } } -- cgit v1.2.1