View | Details | Raw Unified
Collapse All | Expand All

(-) glibc-2.3.6.orig/elf/dl-lookup.c (-1 / +29 lines)
 Lines 206-215    Link Here 
		     const struct r_found_version *version,
		     const struct r_found_version *version,
		     int type_class, int flags, struct link_map *skip_map)
		     int type_class, int flags, struct link_map *skip_map)
{
{
  const unsigned long int hash = _dl_elf_hash (undef_name);
  unsigned long int hash;
  struct sym_val current_value = { NULL, NULL };
  struct sym_val current_value = { NULL, NULL };
  struct r_scope_elem **scope = symbol_scope;
  struct r_scope_elem **scope = symbol_scope;
  /* This sucks mostly - but people sadly don't pass a symtab index, or hashvals ptr in */
  const Elf_Symndx *hashvals;
  if (__builtin_expect (undef_map != NULL, 1) &&
      __builtin_expect (undef_map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1) &&
      __builtin_expect ((hashvals = (const void *)D_PTR (undef_map, l_info[SUSEIDX(DT_SUSE_HASHVALS)])) != NULL, 1) &&
      __builtin_expect (*ref != NULL, 1))
    {
      const ElfW(Sym) *symtab = (const void *) D_PTR (undef_map, l_info[DT_SYMTAB]);
      hashvals += *ref - symtab;
      if (__builtin_expect ((ElfW(Addr))hashvals >= undef_map->l_map_end, 0) ||
	  __builtin_expect ((ElfW(Addr))hashvals <= undef_map->l_map_start, 0))
        _dl_debug_printf ("out of bounds madness ... 0x%x\n", (int) hashvals);
      else
      {
        hash = *hashvals;
#if 0
	if (hash != _dl_elf_hash (undef_name))
          _dl_debug_printf ("Hash difference ! 0x%x 0x%x [offset 0x%x]\n",
			    (int) _dl_elf_hash (undef_name),
			    (int) hash, (int) (*ref - symtab));
#endif
      }
    }
  else
    hash = _dl_elf_hash (undef_name); 
  bump_num_relocations ();
  bump_num_relocations ();
  /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
  /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
(-) glibc-2.3.6.orig/elf/do-lookup.h (-3 / +22 lines)
 Lines 17-22    Link Here 
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */
   02111-1307 USA.  */
# define SUSEIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
			 DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
/* Inner part of the lookup functions.  We return a value > 0 if we
/* Inner part of the lookup functions.  We return a value > 0 if we
   found the symbol, the value 0 if nothing is found and < 0 if
   found the symbol, the value 0 if nothing is found and < 0 if
   something bad happened.  */
   something bad happened.  */
 Lines 35-40    Link Here 
  do
  do
    {
    {
      const ElfW(Sym) *symtab;
      const ElfW(Sym) *symtab;
      const Elf_Symndx *hashvals;
      const char *strtab;
      const char *strtab;
      const ElfW(Half) *verstab;
      const ElfW(Half) *verstab;
      Elf_Symndx symidx;
      Elf_Symndx symidx;
 Lines 62-70    Link Here 
			  undef_name,
			  undef_name,
			  map->l_name[0] ? map->l_name : rtld_progname);
			  map->l_name[0] ? map->l_name : rtld_progname);
      symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
       if (__builtin_expect (map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1))
      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
         hashvals = (const void *) D_PTR (map, l_info[SUSEIDX(DT_SUSE_HASHVALS)]);
      verstab = map->l_versyms;
       else
       hashvals = NULL;
      /* Search the appropriate hash bucket in this object's symbol table
      /* Search the appropriate hash bucket in this object's symbol table
	 for a definition for the same symbol name.  */
	 for a definition for the same symbol name.  */
 Lines 72-77    Link Here 
	   symidx != STN_UNDEF;
	   symidx != STN_UNDEF;
	   symidx = map->l_chain[symidx])
	   symidx = map->l_chain[symidx])
	{
	{
	  if (__builtin_expect (hashvals != NULL, 1) &&
	      __builtin_expect ((ElfW(Addr))hashvals < map->l_map_end, 1) &&
	      __builtin_expect ((ElfW(Addr))hashvals > map->l_map_start, 1))
	    {
	      if (__builtin_expect (hashvals[symidx] != hash, 1))
	        continue;
	    }
	  /* If hashvals is present 99.9% of the loop is done: what follows
	     is the very un-common / direct-hit case */
	  symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
	  verstab = map->l_versyms;
	  sym = &symtab[symidx];
	  sym = &symtab[symidx];
	  assert (ELF_RTYPE_CLASS_PLT == 1);
	  assert (ELF_RTYPE_CLASS_PLT == 1);
(-) glibc-2.3.6.orig/elf/dynamic-link.h (+9 lines)
 Lines 65-70    Link Here 
#ifndef VERSYMIDX
#ifndef VERSYMIDX
# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
#endif
#endif
#ifndef SUSEIDX
# define SUSEIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
			 DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
#endif
/* Read the dynamic section at DYN and fill in INFO with indices DT_*.  */
/* Read the dynamic section at DYN and fill in INFO with indices DT_*.  */
 Lines 93-98    Link Here 
      else if (dyn->d_tag >= DT_LOPROC &&
      else if (dyn->d_tag >= DT_LOPROC &&
	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
	info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
	info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
      else if (dyn->d_tag >= DT_SUSE_LO &&
	       dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
        info[SUSEIDX(dyn->d_tag)] = dyn;
      else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
      else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
	info[VERSYMIDX (dyn->d_tag)] = dyn;
	info[VERSYMIDX (dyn->d_tag)] = dyn;
      else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
      else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
 Lines 143-148    Link Here 
# endif
# endif
      ADJUST_DYN_INFO (DT_JMPREL);
      ADJUST_DYN_INFO (DT_JMPREL);
      ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
      ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
      ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_HASHVALS));
      ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_DIRECT));
# undef ADJUST_DYN_INFO
# undef ADJUST_DYN_INFO
      assert (cnt <= DL_RO_DYN_TEMP_CNT);
      assert (cnt <= DL_RO_DYN_TEMP_CNT);
    }
    }
(-) glibc-2.3.6.orig/elf/elf.h (+8 lines)
 Lines 742-747    Link Here 
#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
#define DT_VERSIONTAGNUM 16
#define DT_VERSIONTAGNUM 16
/* SUSE specific pieces - at a random OS specific address ... */
#define DT_SUSE_LO 0x6cbdd030
#define DT_SUSE_HASHVALS DT_SUSE_LO
#define DT_SUSE_DIRECT   DT_SUSE_LO + 1
#define DT_SUSE_HI 0x6cbdd040
#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
#define DT_SUSENUM 2
/* Sun added these machine-independent extensions in the "processor-specific"
/* Sun added these machine-independent extensions in the "processor-specific"
   range.  Be compatible.  */
   range.  Be compatible.  */
#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
(-) glibc-2.3.6.orig/include/link.h (-1 / +1 lines)
 Lines 154-160    Link Here 
       are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>.  */
       are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>.  */
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
		     + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
		     + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
    const ElfW(Phdr) *l_phdr;	/* Pointer to program header table in core.  */
    const ElfW(Phdr) *l_phdr;	/* Pointer to program header table in core.  */
    ElfW(Addr) l_entry;		/* Entry point location.  */
    ElfW(Addr) l_entry;		/* Entry point location.  */
    ElfW(Half) l_phnum;		/* Number of program header entries.  */
    ElfW(Half) l_phnum;		/* Number of program header entries.  */