summaryrefslogtreecommitdiff
path: root/ldso/ldso/mips
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2011-01-21 15:04:47 +0100
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-01-21 15:04:47 +0100
commit2aee0efdec50321ffbe6891c593611461cc7b16e (patch)
treef6b3c17d1e3fddf14360317f4f18b86b0c83c045 /ldso/ldso/mips
parent8100a075b7dd7471562decb1860571a335d68b0d (diff)
parentb5dd2e706c1a098b2e8cd8df10500a3dde350efc (diff)
Merge remote branch 'origin/master' into prelink
* origin/master: bump version to 0.9.32-rc2-git release 0.9.32-rc2 nptl: Fix __USER_LABEL_PREFIX__ concatenatio nptl: fix start_thread() for _STACK_GROWS_UP ldso: get rid of _dl_lookup_hash Add protected symbols support for all architectures Revert "ldso/arm: Correct protected symbol resolution" Revert "ldso_sh: add support for protected symbols to SH" Revert "ldso/i386: support protected symbols" cris: Fix build issues syslog: fix 'everyone logs with user facility' __psfs_parse_spec: always use long int for %p buildsys: headers target should not depend on sysnum.h buildsys: fix make release target nptl: get rid of the last preprocessor warning when __ASSUME_TGKILL is not defined remove uClibc_ctype.h if !LOCALE Revert "Makefile.in: Add header to 'all' target" nptl: get rid of preprocessor warning when __ASSUME_TGKILL is not defined Conflicts: ldso/include/dl-hash.h ldso/ldso/arm/elfinterp.c ldso/ldso/avr32/elfinterp.c ldso/ldso/bfin/elfinterp.c ldso/ldso/cris/elfinterp.c ldso/ldso/dl-hash.c ldso/ldso/i386/elfinterp.c ldso/ldso/m68k/elfinterp.c ldso/ldso/mips/elfinterp.c ldso/ldso/powerpc/elfinterp.c ldso/ldso/sh/elfinterp.c ldso/ldso/sh64/elfinterp.c ldso/ldso/sparc/elfinterp.c ldso/ldso/x86_64/elfinterp.c ldso/ldso/xtensa/elfinterp.c ldso/libdl/libdl.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'ldso/ldso/mips')
-rw-r--r--ldso/ldso/mips/elfinterp.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index 2a433e282..3ca403609 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -56,7 +56,7 @@ unsigned long __dl_runtime_resolve(unsigned long sym_index,
symname = strtab + sym->st_name;
new_addr = (unsigned long) _dl_find_hash(symname,
- &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL);
+ &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
if (unlikely(!new_addr)) {
_dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
_dl_progname, symname);
@@ -111,7 +111,7 @@ __dl_runtime_pltresolve(struct elf_resolve *tpnt, int reloc_entry)
got_addr = (char **)instr_addr;
/* Get the address of the GOT entry. */
- new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL);
+ new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
if (unlikely(!new_addr)) {
_dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname);
_dl_exit(1);
@@ -161,8 +161,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
unsigned long old_val=0;
#endif
- struct sym_val current_value = { NULL, NULL };
-
+ struct symbol_ref sym_ref = { NULL, NULL };
/* Now parse the relocation information */
rel_size = rel_size / sizeof(ElfW(Rel));
rpnt = (ELF_RELOC *) rel_addr;
@@ -171,6 +170,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
got = (unsigned long *) tpnt->dynamic_info[DT_PLTGOT];
+
for (i = 0; i < rel_size; i++, rpnt++) {
reloc_addr = (unsigned long *) (tpnt->loadaddr +
(unsigned long) rpnt->r_offset);
@@ -189,13 +189,13 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
if (reloc_type == R_MIPS_JUMP_SLOT || reloc_type == R_MIPS_COPY) {
symbol_addr = (unsigned long)_dl_find_hash(symname,
scope,
- tpnt, &current_value,
- elf_machine_type_class(reloc_type), NULL);
+ tpnt,
+ elf_machine_type_class(reloc_type), &sym_ref);
if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
return 1;
if (_dl_trace_prelink)
_dl_debug_lookup (symname, tpnt, &symtab[symtab_index],
- &current_value, elf_machine_type_class(reloc_type));
+ &sym_ref, elf_machine_type_class(reloc_type));
}
if (!symtab_index) {
/* Relocs against STN_UNDEF are usually treated as using a
@@ -217,23 +217,26 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
case R_MIPS_TLS_TPREL32:
# endif
{
- struct elf_resolve *tpnt_tls = NULL;
+ struct elf_resolve *tls_tpnt = NULL;
+ sym_ref.sym = &symtab[symtab_index];
+ sym_ref.tpnt = NULL;
if (ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_LOCAL) {
symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
- tpnt, &current_value, elf_machine_type_class(reloc_type), &tpnt_tls);
+ tpnt, elf_machine_type_class(reloc_type), &sym_ref);
+ tls_tpnt = sym_ref.tpnt;
}
- /* In case of a TLS reloc, tpnt_tls NULL means we have an 'anonymous'
+ /* In case of a TLS reloc, tls_tpnt NULL means we have an 'anonymous'
symbol. This is the case for a static tls variable, so the lookup
module is just that one is referencing the tls variable. */
- if (!tpnt_tls)
- tpnt_tls = tpnt;
+ if (!tls_tpnt)
+ tls_tpnt = tpnt;
switch (reloc_type) {
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPMOD32:
- if (tpnt_tls)
- *(ElfW(Word) *)reloc_addr = tpnt_tls->l_tls_modid;
+ if (tls_tpnt)
+ *(ElfW(Word) *)reloc_addr = tls_tpnt->l_tls_modid;
#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(2, "TLS_DTPMOD : %s, %d, %d\n",
symname, old_val, *((unsigned int *)reloc_addr));
@@ -252,9 +255,9 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
case R_MIPS_TLS_TPREL32:
case R_MIPS_TLS_TPREL64:
- CHECK_STATIC_TLS((struct link_map *)tpnt_tls);
+ CHECK_STATIC_TLS((struct link_map *)tls_tpnt);
*(ElfW(Word) *)reloc_addr +=
- TLS_TPREL_VALUE (tpnt_tls, symbol_addr);
+ TLS_TPREL_VALUE (tls_tpnt, symbol_addr);
#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(2, "TLS_TPREL : %s, %x, %x\n",
symname, old_val, *((unsigned int *)reloc_addr));
@@ -362,12 +365,12 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy)
}
else {
*got_entry = (unsigned long) _dl_find_hash(strtab +
- sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL);
+ sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
}
}
else if (sym->st_shndx == SHN_COMMON) {
*got_entry = (unsigned long) _dl_find_hash(strtab +
- sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL);
+ sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
}
else if (ELF_ST_TYPE(sym->st_info) == STT_FUNC &&
*got_entry != sym->st_value && tmp_lazy) {
@@ -379,7 +382,7 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy)
}
else {
*got_entry = (unsigned long) _dl_find_hash(strtab +
- sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL);
+ sym->st_name, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
}
got_entry++;