diff options
author | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
commit | fa40f30b4253b1e05c46cc5e0c111176825b7623 (patch) | |
tree | 76cf2d26c0ce0ee7c6a2c1a1a2b65bc4d8e33029 /mdk-stage1/insmod-modutils/obj/obj_load.c | |
parent | 327bd24f8e4291bd1882de1990dd7339f781a9cb (diff) | |
download | drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.gz drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.bz2 drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.xz drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.zip |
This commit was manufactured by cvs2svn to create tag 'Corpo_2_1_1'.Corpo_2_1_1
Diffstat (limited to 'mdk-stage1/insmod-modutils/obj/obj_load.c')
-rw-r--r-- | mdk-stage1/insmod-modutils/obj/obj_load.c | 29 |
1 files changed, 9 insertions, 20 deletions
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 <alloca.h> #include <string.h> #include <stdlib.h> @@ -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); } } |