Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 114008 | Differences between
and this patch

Collapse All | Expand All

(-)glibc-2.3.6.orig/elf/dl-lookup.c (-1 / +29 lines)
Lines 206-215 Link Here
206
		     const struct r_found_version *version,
206
		     const struct r_found_version *version,
207
		     int type_class, int flags, struct link_map *skip_map)
207
		     int type_class, int flags, struct link_map *skip_map)
208
{
208
{
209
  const unsigned long int hash = _dl_elf_hash (undef_name);
209
  unsigned long int hash;
210
  struct sym_val current_value = { NULL, NULL };
210
  struct sym_val current_value = { NULL, NULL };
211
  struct r_scope_elem **scope = symbol_scope;
211
  struct r_scope_elem **scope = symbol_scope;
212
212
213
  /* This sucks mostly - but people sadly don't pass a symtab index, or hashvals ptr in */
214
  const Elf_Symndx *hashvals;
215
216
  if (__builtin_expect (undef_map != NULL, 1) &&
217
      __builtin_expect (undef_map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1) &&
218
      __builtin_expect ((hashvals = (const void *)D_PTR (undef_map, l_info[SUSEIDX(DT_SUSE_HASHVALS)])) != NULL, 1) &&
219
      __builtin_expect (*ref != NULL, 1))
220
    {
221
      const ElfW(Sym) *symtab = (const void *) D_PTR (undef_map, l_info[DT_SYMTAB]);
222
      hashvals += *ref - symtab;
223
224
      if (__builtin_expect ((ElfW(Addr))hashvals >= undef_map->l_map_end, 0) ||
225
	  __builtin_expect ((ElfW(Addr))hashvals <= undef_map->l_map_start, 0))
226
        _dl_debug_printf ("out of bounds madness ... 0x%x\n", (int) hashvals);
227
      else
228
      {
229
        hash = *hashvals;
230
#if 0
231
	if (hash != _dl_elf_hash (undef_name))
232
          _dl_debug_printf ("Hash difference ! 0x%x 0x%x [offset 0x%x]\n",
233
			    (int) _dl_elf_hash (undef_name),
234
			    (int) hash, (int) (*ref - symtab));
235
#endif
236
      }
237
    }
238
  else
239
    hash = _dl_elf_hash (undef_name); 
240
213
  bump_num_relocations ();
241
  bump_num_relocations ();
214
242
215
  /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
243
  /* 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
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18
   02111-1307 USA.  */
18
   02111-1307 USA.  */
19
19
20
# define SUSEIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
21
			 DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
22
20
/* Inner part of the lookup functions.  We return a value > 0 if we
23
/* Inner part of the lookup functions.  We return a value > 0 if we
21
   found the symbol, the value 0 if nothing is found and < 0 if
24
   found the symbol, the value 0 if nothing is found and < 0 if
22
   something bad happened.  */
25
   something bad happened.  */
Lines 35-40 Link Here
35
  do
38
  do
36
    {
39
    {
37
      const ElfW(Sym) *symtab;
40
      const ElfW(Sym) *symtab;
41
      const Elf_Symndx *hashvals;
38
      const char *strtab;
42
      const char *strtab;
39
      const ElfW(Half) *verstab;
43
      const ElfW(Half) *verstab;
40
      Elf_Symndx symidx;
44
      Elf_Symndx symidx;
Lines 62-70 Link Here
62
			  undef_name,
66
			  undef_name,
63
			  map->l_name[0] ? map->l_name : rtld_progname);
67
			  map->l_name[0] ? map->l_name : rtld_progname);
64
68
65
      symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
69
       if (__builtin_expect (map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1))
66
      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
70
         hashvals = (const void *) D_PTR (map, l_info[SUSEIDX(DT_SUSE_HASHVALS)]);
67
      verstab = map->l_versyms;
71
       else
72
       hashvals = NULL;
68
73
69
      /* Search the appropriate hash bucket in this object's symbol table
74
      /* Search the appropriate hash bucket in this object's symbol table
70
	 for a definition for the same symbol name.  */
75
	 for a definition for the same symbol name.  */
Lines 72-77 Link Here
72
	   symidx != STN_UNDEF;
77
	   symidx != STN_UNDEF;
73
	   symidx = map->l_chain[symidx])
78
	   symidx = map->l_chain[symidx])
74
	{
79
	{
80
	  if (__builtin_expect (hashvals != NULL, 1) &&
81
	      __builtin_expect ((ElfW(Addr))hashvals < map->l_map_end, 1) &&
82
	      __builtin_expect ((ElfW(Addr))hashvals > map->l_map_start, 1))
83
	    {
84
	      if (__builtin_expect (hashvals[symidx] != hash, 1))
85
	        continue;
86
	    }
87
	  /* If hashvals is present 99.9% of the loop is done: what follows
88
	     is the very un-common / direct-hit case */
89
90
	  symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
91
	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
92
	  verstab = map->l_versyms;
93
75
	  sym = &symtab[symidx];
94
	  sym = &symtab[symidx];
76
95
77
	  assert (ELF_RTYPE_CLASS_PLT == 1);
96
	  assert (ELF_RTYPE_CLASS_PLT == 1);
(-)glibc-2.3.6.orig/elf/dynamic-link.h (+9 lines)
Lines 65-70 Link Here
65
#ifndef VERSYMIDX
65
#ifndef VERSYMIDX
66
# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
66
# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
67
#endif
67
#endif
68
#ifndef SUSEIDX
69
# define SUSEIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
70
			 DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
71
#endif
68
72
69
73
70
/* Read the dynamic section at DYN and fill in INFO with indices DT_*.  */
74
/* Read the dynamic section at DYN and fill in INFO with indices DT_*.  */
Lines 93-98 Link Here
93
      else if (dyn->d_tag >= DT_LOPROC &&
97
      else if (dyn->d_tag >= DT_LOPROC &&
94
	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
98
	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
95
	info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
99
	info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
100
      else if (dyn->d_tag >= DT_SUSE_LO &&
101
	       dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
102
        info[SUSEIDX(dyn->d_tag)] = dyn;
96
      else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
103
      else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
97
	info[VERSYMIDX (dyn->d_tag)] = dyn;
104
	info[VERSYMIDX (dyn->d_tag)] = dyn;
98
      else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
105
      else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
Lines 143-148 Link Here
143
# endif
150
# endif
144
      ADJUST_DYN_INFO (DT_JMPREL);
151
      ADJUST_DYN_INFO (DT_JMPREL);
145
      ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
152
      ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
153
      ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_HASHVALS));
154
      ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_DIRECT));
146
# undef ADJUST_DYN_INFO
155
# undef ADJUST_DYN_INFO
147
      assert (cnt <= DL_RO_DYN_TEMP_CNT);
156
      assert (cnt <= DL_RO_DYN_TEMP_CNT);
148
    }
157
    }
(-)glibc-2.3.6.orig/elf/elf.h (+8 lines)
Lines 742-747 Link Here
742
#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
742
#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
743
#define DT_VERSIONTAGNUM 16
743
#define DT_VERSIONTAGNUM 16
744
744
745
/* SUSE specific pieces - at a random OS specific address ... */
746
#define DT_SUSE_LO 0x6cbdd030
747
#define DT_SUSE_HASHVALS DT_SUSE_LO
748
#define DT_SUSE_DIRECT   DT_SUSE_LO + 1
749
#define DT_SUSE_HI 0x6cbdd040
750
#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
751
#define DT_SUSENUM 2
752
745
/* Sun added these machine-independent extensions in the "processor-specific"
753
/* Sun added these machine-independent extensions in the "processor-specific"
746
   range.  Be compatible.  */
754
   range.  Be compatible.  */
747
#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
755
#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
154
       are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>.  */
154
       are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>.  */
155
155
156
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
156
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
157
		     + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
157
		     + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
158
    const ElfW(Phdr) *l_phdr;	/* Pointer to program header table in core.  */
158
    const ElfW(Phdr) *l_phdr;	/* Pointer to program header table in core.  */
159
    ElfW(Addr) l_entry;		/* Entry point location.  */
159
    ElfW(Addr) l_entry;		/* Entry point location.  */
160
    ElfW(Half) l_phnum;		/* Number of program header entries.  */
160
    ElfW(Half) l_phnum;		/* Number of program header entries.  */

Return to bug 114008