diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-02-14 11:30:39 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-02-14 11:30:39 +0000 |
commit | deec524084aa2faad66f7aae7e8b5ba1ab6789fd (patch) | |
tree | 8498414c429c57ce6b93a49c265aebcb8180c312 /ldso/ldso/powerpc | |
parent | 7bd4a2f4aaabca0e46015fe0216c086c7f61f1d4 (diff) |
Joakim Tjernlund writes:
Hi it is me again.
This is the latest ldso patch. the NEW weak symbol handling works now
with a little special handling in _dl_find_hash(). You get to chose
if you want the new or old handling :)
There was 2 missing _dl_check_if_named_library_is_loaded() calls in _dlopen().
I then disabled the _dl_check_if_named_library_is_loaded() in dl-elf.c since
it is rendundant.
Question, why does some _dl_linux_resolver(), like i386, have 2 calls
to _dl_find_hash()? I think that is wrong, isn't it?
I really hope you can check this out soon ...
Diffstat (limited to 'ldso/ldso/powerpc')
-rw-r--r-- | ldso/ldso/powerpc/dl-sysdep.h | 13 | ||||
-rw-r--r-- | ldso/ldso/powerpc/elfinterp.c | 32 |
2 files changed, 20 insertions, 25 deletions
diff --git a/ldso/ldso/powerpc/dl-sysdep.h b/ldso/ldso/powerpc/dl-sysdep.h index 8768c9ac4..1a78b1b8b 100644 --- a/ldso/ldso/powerpc/dl-sysdep.h +++ b/ldso/ldso/powerpc/dl-sysdep.h @@ -125,3 +125,16 @@ void _dl_init_got(unsigned long *lpnt,struct elf_resolve *tpnt); #define PAGE_ALIGN 0xfffff000 #define ADDR_ALIGN 0xfff #define OFFS_ALIGN 0x7ffff000 + +/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. + ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one + of the main executable's symbols, as for a COPY reloc. */ +/* We never want to use a PLT entry as the destination of a + reloc, when what is being relocated is a branch. This is + partly for efficiency, but mostly so we avoid loops. */ +#define elf_machine_type_class(type) \ + ((((type) == R_PPC_JMP_SLOT \ + || (type) == R_PPC_REL24 \ + || (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY)) diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c index eb2f986b8..fec92e6fc 100644 --- a/ldso/ldso/powerpc/elfinterp.c +++ b/ldso/ldso/powerpc/elfinterp.c @@ -209,8 +209,8 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) #endif /* Get the address of the GOT entry */ - finaladdr = (Elf32_Addr) _dl_find_hash(strtab + symtab[symtab_index].st_name, - tpnt->symbol_scope, tpnt, resolver); + finaladdr = (Elf32_Addr) _dl_find_hash(symname, + tpnt->symbol_scope, ELF_RTYPE_CLASS_PLT); if (!finaladdr) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); _dl_exit(1); @@ -223,11 +223,8 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) delta = finaladdr - (Elf32_Word)reloc_addr; if (delta<<6>>6 == delta) { *reloc_addr = OPCODE_B(delta); -#if 0 - /* this will almost never be true */ - } else if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000) { + } else if (finaladdr <= 0x01fffffc) { *reloc_addr = OPCODE_BA (finaladdr); -#endif } else { /* Warning: we don't handle double-sized PLT entries */ Elf32_Word *plt, *data_words, index, offset; @@ -261,7 +258,6 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, char *symname; Elf32_Addr *reloc_addr; Elf32_Addr finaladdr; - struct dyn_elf *sym_scope; unsigned long symbol_addr; #if defined (__SUPPORT_LD_DEBUG__) @@ -278,19 +274,8 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, symtab_index = ELF32_R_SYM(rpnt->r_info); symname = strtab + symtab[symtab_index].st_name; -#if 1 - sym_scope = scope->dyn->symbol_scope; -#else - /* Funny, this works too and appears to be much faster. */ - sym_scope = scope; -#endif - if (reloc_type == R_PPC_COPY) { - sym_scope = scope->next; - tpnt = NULL; /* To be or not to be ...*/ - } - symbol_addr = (unsigned long) _dl_find_hash(symname, sym_scope, - (reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), - (reloc_type == R_PPC_COPY ? copyrel : symbolrel)); + symbol_addr = (unsigned long) _dl_find_hash(symname, scope->dyn->symbol_scope, + elf_machine_type_class(reloc_type)); /* * We want to allow undefined references to weak symbols - this might * have been intentional. We should not be linking local symbols @@ -320,11 +305,8 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, if (delta<<6>>6 == delta) { *reloc_addr = OPCODE_B(delta); -#if 0 - /* this will almost never be true */ - } else if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000) { + } else if (finaladdr <= 0x01fffffc) { *reloc_addr = OPCODE_BA (finaladdr); -#endif } else { /* Warning: we don't handle double-sized PLT entries */ Elf32_Word *plt, *data_words, index, offset; @@ -384,7 +366,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, _dl_dprintf(2, "%s ", _dl_reltypes(reloc_type)); #endif if (symtab_index) - _dl_dprintf(2, "'%s'\n", strtab + symtab[symtab_index].st_name); + _dl_dprintf(2, "'%s'\n", symname); return -1; }; |