Date: Fri, 26 Apr 2002 02:00:56 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: arch@FreeBSD.org Subject: RTLD fix: part 2: ld-elf.so Message-ID: <20020426090056.GA43410@athlon.pn.xcllnt.net>
next in thread | raw e-mail | index | archive | help
--qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Gang, Part 2 of the RTLD fix. Tested on: alpha, ia64 Compiles on: i386 Please review, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rtld.diff" Index: rtld.c =================================================================== RCS file: /home/ncvs/src/libexec/rtld-elf/rtld.c,v retrieving revision 1.63 diff -u -r1.63 rtld.c --- rtld.c 2 Apr 2002 02:19:02 -0000 1.63 +++ rtld.c 26 Apr 2002 08:52:02 -0000 @@ -854,20 +854,27 @@ ref = refobj->symtab + symnum; name = refobj->strtab + ref->st_name; - hash = elf_hash(name); defobj = NULL; - /* Handle STT_SECTION specially. */ - if (ELF_ST_TYPE(ref->st_info) == STT_SECTION) { - if (ELF_ST_BIND(ref->st_info) != STB_LOCAL || - ref->st_shndx != symnum) { + /* + * We don't have to do a full scale lookup if the symbol is local. + * We know it will bind to the instance in this load module; to + * which we already have a pointer (ie ref). By not doing a lookup, + * we not only improve performance, but it also avoids unresolvable + * symbols when local symbols are not in the hash table. This has + * been seen with the ia64 toolchain. + */ + if (ELF_ST_BIND(ref->st_info) != STB_LOCAL) { + if (ELF_ST_TYPE(ref->st_info) == STT_SECTION) { _rtld_error("%s: Bogus symbol table entry %lu", refobj->path, symnum); } + hash = elf_hash(name); + def = symlook_default(name, hash, refobj, &defobj, in_plt); + } else { def = ref; defobj = refobj; - } else - def = symlook_default(name, hash, refobj, &defobj, in_plt); + } /* * If we found no definition and the reference is weak, treat the --qDbXVdCdHGoSgWSk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020426090056.GA43410>