diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-08-02 16:57:42 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-08-02 16:57:42 +0000 |
commit | 5d550e87dde9b5a3321c98513099d7da601319ef (patch) | |
tree | 2533cbd8626062bb158d72ceda221d35c76605a1 /elf | |
parent | ebe3a574be44dc0d7724945e8cea53b92297593b (diff) | |
download | glibc-5d550e87dde9b5a3321c98513099d7da601319ef.tar glibc-5d550e87dde9b5a3321c98513099d7da601319ef.tar.gz glibc-5d550e87dde9b5a3321c98513099d7da601319ef.tar.bz2 glibc-5d550e87dde9b5a3321c98513099d7da601319ef.zip |
Updated to fedora-glibc-20060802T1650cvs/fedora-glibc-2_4_90-16
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-addr.c | 74 | ||||
-rw-r--r-- | elf/dl-open.c | 4 | ||||
-rw-r--r-- | elf/tst-auditmod1.c | 26 |
3 files changed, 57 insertions, 47 deletions
diff --git a/elf/dl-addr.c b/elf/dl-addr.c index ced8978eb3..535977ca5e 100644 --- a/elf/dl-addr.c +++ b/elf/dl-addr.c @@ -74,28 +74,62 @@ _dl_addr (const void *address, Dl_info *info, ElfW(Word) strtabsize = match->l_info[DT_STRSZ]->d_un.d_val; - const ElfW(Sym) *symtabend; - if (match->l_info[DT_HASH] != NULL) - symtabend = (symtab - + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]); + const ElfW(Sym) *matchsym = NULL; + if (match->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM + + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] != NULL) + { + /* We look at all symbol table entries referenced by the + hash table. */ + for (Elf_Symndx bucket = 0; bucket < match->l_nbuckets; ++bucket) + { + Elf32_Word symndx = match->l_gnu_buckets[bucket]; + if (bucket != 0) + { + const Elf32_Word *hasharr = &match->l_gnu_chain_zero[symndx]; + + do + { + /* The hash table never references local symbols + so we can omit that test here. */ + if (symtab[symndx].st_shndx != SHN_UNDEF +#ifdef USE_TLS + && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS +#endif + && DL_ADDR_SYM_MATCH (match, &symtab[symndx], + matchsym, addr) + && symtab[symndx].st_name < strtabsize) + matchsym = (ElfW(Sym) *) &symtab[symndx]; + + ++symndx; + } + while ((*hasharr++ & 1u) == 0); + } + } + } else - /* There is no direct way to determine the number of symbols in the - dynamic symbol table and no hash table is present. The ELF - binary is ill-formed but what shall we do? Use the beginning of - the string table which generally follows the symbol table. */ - symtabend = (const ElfW(Sym) *) strtab; - - const ElfW(Sym) *matchsym; - for (matchsym = NULL; (void *) symtab < (void *) symtabend; ++symtab) - if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL - || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK) -#if defined USE_TLS - && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS + { + const ElfW(Sym) *symtabend; + if (match->l_info[DT_HASH] != NULL) + symtabend = (symtab + + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]); + else + /* There is no direct way to determine the number of symbols in the + dynamic symbol table and no hash table is present. The ELF + binary is ill-formed but what shall we do? Use the beginning of + the string table which generally follows the symbol table. */ + symtabend = (const ElfW(Sym) *) strtab; + + for (; (void *) symtab < (void *) symtabend; ++symtab) + if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL + || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK) +#ifdef USE_TLS + && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS #endif - && symtab->st_shndx != SHN_UNDEF - && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr) - && symtab->st_name < strtabsize) - matchsym = (ElfW(Sym) *) symtab; + && symtab->st_shndx != SHN_UNDEF + && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr) + && symtab->st_name < strtabsize) + matchsym = (ElfW(Sym) *) symtab; + } if (mapp) *mapp = match; diff --git a/elf/dl-open.c b/elf/dl-open.c index 930400c420..cdbb6601d2 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -1,5 +1,5 @@ /* Load a shared object at runtime, relocate it, and run its initializer. - Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -341,7 +341,7 @@ dl_open_worker (void *a) if (! l->l_real->l_relocated) { #ifdef SHARED - if (GLRO(dl_profile) != NULL) + if (__builtin_expect (GLRO(dl_profile) != NULL, 0)) { /* If this here is the shared object which we want to profile make sure the profile is started. We can find out whether diff --git a/elf/tst-auditmod1.c b/elf/tst-auditmod1.c index e9f6fe9c4d..2d39df21e8 100644 --- a/elf/tst-auditmod1.c +++ b/elf/tst-auditmod1.c @@ -132,12 +132,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, # define La_regs La_sh_regs # define La_retval La_sh_retval # define int_retval lrv_r0 -#elif defined __mc68000__ -# define pltenter la_m68k_gnu_pltenter -# define pltexit la_m68k_gnu_pltexit -# define La_regs La_m68k_regs -# define La_retval La_m68k_retval -# define int_retval lrv_d0 #elif defined __alpha__ # define pltenter la_alpha_gnu_pltenter # define pltexit la_alpha_gnu_pltexit @@ -162,24 +156,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, # define La_regs La_ia64_regs # define La_retval La_ia64_retval # define int_retval lrv_r8 -#elif defined __mips__ && _MIPS_SIM == _ABIO32 -# define pltenter la_mips_o32_gnu_pltenter -# define pltexit la_mips_o32_gnu_pltexit -# define La_regs La_mips_32_regs -# define La_retval La_mips_32_retval -# define int_retval lrv_v0 -#elif defined __mips__ && _MIPS_SIM == _ABIN32 -# define pltenter la_mips_n32_gnu_pltenter -# define pltexit la_mips_n32_gnu_pltexit -# define La_regs La_mips_64_regs -# define La_retval La_mips_64_retval -# define int_retval lrv_v0 -#elif defined __mips__ && _MIPS_SIM == _ABI64 -# define pltenter la_mips_n64_gnu_pltenter -# define pltexit la_mips_n64_gnu_pltexit -# define La_regs La_mips_64_regs -# define La_retval La_mips_64_retval -# define int_retval lrv_v0 #elif defined __sparc__ && __WORDSIZE == 32 # define pltenter la_sparc32_gnu_pltenter # define pltexit la_sparc32_gnu_pltexit @@ -197,7 +173,7 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, #include <tst-audit.h> #if (!defined (pltenter) || !defined (pltexit) || !defined (La_regs) \ || !defined (La_retval) || !defined (int_retval)) -# error "architecture specific code needed in sysdeps/CPU/tls-audit.h or here" +# error "architecture specific code needed in sysdeps/CPU/tst-audit.h or here" #endif |