reloc.c (102249) | reloc.c (107071) |
---|---|
1/*- 2 * Copyright 1996, 1997, 1998, 1999 John D. Polstra. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * | 1/*- 2 * Copyright 1996, 1997, 1998, 1999 John D. Polstra. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/libexec/rtld-elf/ia64/reloc.c 102249 2002-08-22 03:56:57Z marcel $ | 25 * $FreeBSD: head/libexec/rtld-elf/ia64/reloc.c 107071 2002-11-18 22:08:50Z tmm $ |
26 */ 27 28/* 29 * Dynamic linker for ELF. 30 * 31 * John Polstra <jdp@polstra.com>. 32 */ 33 --- 325 unchanged lines hidden (view full) --- 359 where = (Elf_Addr *)(obj->relocbase + rel->r_offset); 360 def = find_symdef(ELF_R_SYM(rel->r_info), obj, 361 &defobj, true, NULL); 362 if (def == NULL) 363 return -1; 364 reloc_jmpslot(where, 365 (Elf_Addr)(defobj->relocbase 366 + def->st_value), | 26 */ 27 28/* 29 * Dynamic linker for ELF. 30 * 31 * John Polstra <jdp@polstra.com>. 32 */ 33 --- 325 unchanged lines hidden (view full) --- 359 where = (Elf_Addr *)(obj->relocbase + rel->r_offset); 360 def = find_symdef(ELF_R_SYM(rel->r_info), obj, 361 &defobj, true, NULL); 362 if (def == NULL) 363 return -1; 364 reloc_jmpslot(where, 365 (Elf_Addr)(defobj->relocbase 366 + def->st_value), |
367 defobj); | 367 defobj, obj, rel); |
368 } 369 } else { 370 const Elf_Rela *relalim; 371 const Elf_Rela *rela; 372 373 relalim = (const Elf_Rela *) 374 ((char *)obj->pltrela + obj->pltrelasize); 375 for (rela = obj->pltrela; rela < relalim; rela++) { --- 4 unchanged lines hidden (view full) --- 380 where = (Elf_Addr *)(obj->relocbase + rela->r_offset); 381 def = find_symdef(ELF_R_SYM(rela->r_info), obj, 382 &defobj, true, NULL); 383 if (def == NULL) 384 return -1; 385 reloc_jmpslot(where, 386 (Elf_Addr)(defobj->relocbase 387 + def->st_value), | 368 } 369 } else { 370 const Elf_Rela *relalim; 371 const Elf_Rela *rela; 372 373 relalim = (const Elf_Rela *) 374 ((char *)obj->pltrela + obj->pltrelasize); 375 for (rela = obj->pltrela; rela < relalim; rela++) { --- 4 unchanged lines hidden (view full) --- 380 where = (Elf_Addr *)(obj->relocbase + rela->r_offset); 381 def = find_symdef(ELF_R_SYM(rela->r_info), obj, 382 &defobj, true, NULL); 383 if (def == NULL) 384 return -1; 385 reloc_jmpslot(where, 386 (Elf_Addr)(defobj->relocbase 387 + def->st_value), |
388 defobj); | 388 defobj, obj, (Elf_Rel *)rela); |
389 } 390 } 391 obj->jmpslots_done = true; 392 return 0; 393} 394 395/* Fixup the jump slot at "where" to transfer control to "target". */ 396Elf_Addr | 389 } 390 } 391 obj->jmpslots_done = true; 392 return 0; 393} 394 395/* Fixup the jump slot at "where" to transfer control to "target". */ 396Elf_Addr |
397reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj) | 397reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj, 398 const Obj_Entry *refobj, const Elf_Rel *rel) |
398{ 399 Elf_Addr stubaddr; 400 401 dbg(" reloc_jmpslot: where=%p, target=%p, gp=%p", 402 (void *)where, (void *)target, (void *)obj->pltgot); 403 stubaddr = *where; 404 if (stubaddr != target) { 405 --- 105 unchanged lines hidden --- | 399{ 400 Elf_Addr stubaddr; 401 402 dbg(" reloc_jmpslot: where=%p, target=%p, gp=%p", 403 (void *)where, (void *)target, (void *)obj->pltgot); 404 stubaddr = *where; 405 if (stubaddr != target) { 406 --- 105 unchanged lines hidden --- |