[Ups-cvs] ups/ups ao_elflib.c,1.17,1.18 ao_elfpriv.h,1.4,1.5 ao_elfread.h,1.2,1.3 ao_elfreadbase.c,1
Brought to you by:
ianedwards
From: Tom H. <th...@us...> - 2005-02-21 17:02:05
|
Update of /cvsroot/ups/ups/ups In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31849 Modified Files: ao_elflib.c ao_elfpriv.h ao_elfread.h ao_elfreadbase.c Log Message: Fix PLT decoding for x86_64 systems - the value pushed on the stack is the index of the relocation rather than the offset as it is on 32 bit systems so we need to multiply it by the size of the relocation to get the real offset. Index: ao_elfreadbase.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_elfreadbase.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ao_elfreadbase.c 30 Nov 2004 09:08:37 -0000 1.2 --- ao_elfreadbase.c 21 Feb 2005 17:01:22 -0000 1.3 *************** *** 334,337 **** --- 334,348 ---- } + static size_t + ELF(relocation_size)(int rel_type) + { + if (rel_type == DT_REL) + return sizeof(Elf_Rel); + else if (rel_type == DT_RELA) + return sizeof(Elf_Rela); + else + return 0; + } + static bool ELF(resolve_relocation)(target_t *xp, taddr_t st_base_address, *************** *** 472,475 **** --- 483,487 ---- ELF(dynamic_ptr), ELF(dynamic_ptr_address), + ELF(relocation_size), ELF(resolve_relocation), ELF(read_r_debug), Index: ao_elfread.h =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_elfread.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ao_elfread.h 16 Feb 2004 13:02:00 -0000 1.2 --- ao_elfread.h 21 Feb 2005 17:01:22 -0000 1.3 *************** *** 132,135 **** --- 132,137 ---- (el)->ops->dynamic_ptr_address(dynsh, dyntab, dyn) + #define elf_relocation_size(elops, rel) \ + (elops)->relocation_size(rel) #define elf_resolve_relocation(elops, xp, ast, symtab, strtab, rel, off, name) \ (elops)->resolve_relocation(xp, ast, symtab, strtab, rel, off, name) Index: ao_elfpriv.h =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_elfpriv.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ao_elfpriv.h 30 Nov 2004 09:08:37 -0000 1.4 --- ao_elfpriv.h 21 Feb 2005 17:01:21 -0000 1.5 *************** *** 134,137 **** --- 134,138 ---- Elf_Dyn *dyn)); + size_t (*relocation_size)PROTO((int rel_type)); bool (*resolve_relocation)PROTO((target_t *xp, taddr_t st_base_address, taddr_t symtab_vaddr, Index: ao_elflib.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_elflib.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ao_elflib.c 21 Feb 2005 16:38:15 -0000 1.17 --- ao_elflib.c 21 Feb 2005 17:01:00 -0000 1.18 *************** *** 1821,1830 **** panic("Unexpected opcode in procedure linkage table"); ! off = *((int *)(push + 1)) + solib->plt_rel_vaddr; if (!elf_resolve_relocation(solib->elops, xp, ast->st_base_address, solib->dyn_symtab_vaddr, solib->dyn_strtab_vaddr, ! solib->plt_rel_type, off, func_name)) { panic("Unexpected relocation type in procedure linkage table"); } --- 1821,1834 ---- panic("Unexpected opcode in procedure linkage table"); ! off = *((int *)(push + 1)); ! ! if (xp_get_addrsize(xp) == 64) ! off = off * elf_relocation_size(solib->elops, solib->plt_rel_type); if (!elf_resolve_relocation(solib->elops, xp, ast->st_base_address, solib->dyn_symtab_vaddr, solib->dyn_strtab_vaddr, ! solib->plt_rel_type, ! solib->plt_rel_vaddr + off, func_name)) { panic("Unexpected relocation type in procedure linkage table"); } |