diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-12-23 18:26:15 -0800 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2015-02-10 17:54:39 +0900 |
commit | 9a3c78c065820fb2f52d73a125cb812cf593429f (patch) | |
tree | 00f667ece6e068218c70015341c488efcb24a2c1 | |
parent | cb7212a693caed5f22237a9c2d8b7a8bcf29052f (diff) | |
download | glibc-9a3c78c065820fb2f52d73a125cb812cf593429f.tar.gz glibc-9a3c78c065820fb2f52d73a125cb812cf593429f.tar.bz2 glibc-9a3c78c065820fb2f52d73a125cb812cf593429f.zip |
Fix LD_PROFILE
glibc bug#13818
-rw-r--r-- | elf/dl-reloc.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index 9c2705d539..427144e801 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -237,32 +237,9 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], /* String table object symbols. */ const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); - /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */ -#define RESOLVE_MAP(ref, version, r_type) \ - (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \ - ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \ - && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \ - ? (bump_num_cache_relocations (), \ - (*ref) = l->l_lookup_cache.ret, \ - l->l_lookup_cache.value) \ - : ({ lookup_t _lr; \ - int _tc = elf_machine_type_class (r_type); \ - l->l_lookup_cache.type_class = _tc; \ - l->l_lookup_cache.sym = (*ref); \ - const struct r_found_version *v = NULL; \ - if ((version) != NULL && (version)->hash != 0) \ - v = (version); \ - _lr = _dl_lookup_symbol_x (strtab + (*ref)->st_name, l, (ref), \ - scope, v, _tc, \ - DL_LOOKUP_ADD_DEPENDENCY, NULL); \ - l->l_lookup_cache.ret = (*ref); \ - l->l_lookup_cache.value = _lr; })) \ - : l) - -#include "dynamic-link.h" - - ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc); - + /* ELF_DYNAMIC_RELOCATE may need to examine l_reloc_result + when handling MACHINE_IRELATIVE relocs. So we must + allocate l_reloc_result prior to calling ELF_DYNAMIC_RELOCATE. */ #ifndef PROF if (__glibc_unlikely (consider_profiling)) { @@ -293,6 +270,32 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], } } #endif + + /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */ +#define RESOLVE_MAP(ref, version, r_type) \ + (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \ + ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \ + && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \ + ? (bump_num_cache_relocations (), \ + (*ref) = l->l_lookup_cache.ret, \ + l->l_lookup_cache.value) \ + : ({ lookup_t _lr; \ + int _tc = elf_machine_type_class (r_type); \ + l->l_lookup_cache.type_class = _tc; \ + l->l_lookup_cache.sym = (*ref); \ + const struct r_found_version *v = NULL; \ + if ((version) != NULL && (version)->hash != 0) \ + v = (version); \ + _lr = _dl_lookup_symbol_x (strtab + (*ref)->st_name, l, (ref), \ + scope, v, _tc, \ + DL_LOOKUP_ADD_DEPENDENCY, NULL); \ + l->l_lookup_cache.ret = (*ref); \ + l->l_lookup_cache.value = _lr; })) \ + : l) + +#include "dynamic-link.h" + + ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc); } /* Mark the object so we know this work has been done. */ |