]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/x86_64/elfinterp.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / x86_64 / elfinterp.c
index 358beec661104903ec58c4304e7c80ae900e982d..664c9ee87d307200751a0fb3717fad5d8748c86b 100644 (file)
@@ -157,8 +157,8 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
        int reloc_type;
        int symtab_index;
        char *symname;
-       struct elf_resolve *tls_tpnt = 0;
-       ElfW(Sym) *sym;
+       struct elf_resolve *tls_tpnt = NULL;
+       struct symbol_ref sym_ref;
        ElfW(Addr) *reloc_addr;
        ElfW(Addr) symbol_addr;
 #if defined (__SUPPORT_LD_DEBUG__)
@@ -168,28 +168,30 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
        reloc_addr = (ElfW(Addr)*)(tpnt->loadaddr + (unsigned long)rpnt->r_offset);
        reloc_type = ELF_R_TYPE(rpnt->r_info);
        symtab_index = ELF_R_SYM(rpnt->r_info);
-       sym = &symtab[symtab_index];
+       sym_ref.sym = &symtab[symtab_index];
+       sym_ref.tpnt = NULL;
        symbol_addr = 0;
-       symname = strtab + sym->st_name;
+       symname = strtab + sym_ref.sym->st_name;
 
        if (symtab_index) {
                symbol_addr = (ElfW(Addr))_dl_find_hash(symname, scope, tpnt,
-                               elf_machine_type_class(reloc_type), &tls_tpnt);
+                               elf_machine_type_class(reloc_type), &sym_ref);
                /*
                 * We want to allow undefined references to weak symbols - this
                 * might have been intentional.  We should not be linking local
                 * symbols here, so all bases should be covered.
                 */
-               if (unlikely(!symbol_addr && (ELF_ST_TYPE(sym->st_info) != STT_TLS)
-                                       && (ELF_ST_BIND(sym->st_info) != STB_WEAK))) {
+               if (unlikely(!symbol_addr && (ELF_ST_TYPE(sym_ref.sym->st_info) != STT_TLS)
+                                       && (ELF_ST_BIND(sym_ref.sym->st_info) != STB_WEAK))) {
                        /* This may be non-fatal if called from dlopen. */
                        return 1;
                }
+               tls_tpnt = sym_ref.tpnt;
        } else {
                /* Relocs against STN_UNDEF are usually treated as using a
                 * symbol value of zero, and using the module containing the
                 * reloc itself. */
-               symbol_addr = sym->st_value;
+               symbol_addr = sym_ref.sym->st_value;
                tls_tpnt = tpnt;
        }
 
@@ -255,13 +257,13 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
                                if (_dl_debug_move)
                                        _dl_dprintf(_dl_debug_file,
                                                    "\t%s move %d bytes from %x to %x\n",
-                                                   symname, sym->st_size,
+                                                   symname, sym_ref.sym->st_size,
                                                    symbol_addr, reloc_addr);
 #endif
 
                                _dl_memcpy((char *)reloc_addr,
                                           (char *)symbol_addr,
-                                          sym->st_size);
+                                          sym_ref.sym->st_size);
                        } else
                                _dl_dprintf(_dl_debug_file, "no symbol_addr to copy !?\n");
                        break;