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/amd64/reloc.c 208256 2010-05-18 08:55:23Z rdivacky $ |
26 */ 27 28/* 29 * Dynamic linker for ELF. 30 * 31 * John Polstra <jdp@polstra.com>. 32 */ 33 --- 79 unchanged lines hidden (view full) --- 113 114/* Process the non-PLT relocations. */ 115int 116reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) 117{ 118 const Elf_Rela *relalim; 119 const Elf_Rela *rela; 120 SymCache *cache; |
121 int r = -1; 122 123 /* 124 * The dynamic loader may be called from a thread, we have 125 * limited amounts of stack available so we cannot use alloca(). 126 */ |
127 if (obj != obj_rtld) { 128 cache = calloc(obj->nchains, sizeof(SymCache)); 129 /* No need to check for NULL here */ 130 } else |
131 cache = NULL; 132 133 relalim = (const Elf_Rela *) ((caddr_t) obj->rela + obj->relasize); 134 for (rela = obj->rela; rela < relalim; rela++) { 135 Elf_Addr *where = (Elf_Addr *) (obj->relocbase + rela->r_offset); 136 Elf32_Addr *where32 = (Elf32_Addr *)where; 137 138 switch (ELF_R_TYPE(rela->r_info)) { --- 179 unchanged lines hidden (view full) --- 318 _rtld_error("%s: Unsupported relocation type %u" 319 " in non-PLT relocations\n", obj->path, 320 (unsigned int)ELF_R_TYPE(rela->r_info)); 321 goto done; 322 } 323 } 324 r = 0; 325done: |
326 if (cache != NULL) 327 free(cache); |
328 return(r); 329} 330 331/* Process the PLT relocations. */ 332int 333reloc_plt(Obj_Entry *obj) 334{ 335 const Elf_Rela *relalim; --- 65 unchanged lines hidden --- |