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/i386/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 --- 80 unchanged lines hidden (view full) --- 114 115/* Process the non-PLT relocations. */ 116int 117reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) 118{ 119 const Elf_Rel *rellim; 120 const Elf_Rel *rel; 121 SymCache *cache; |
122 int r = -1; 123 124 /* 125 * The dynamic loader may be called from a thread, we have 126 * limited amounts of stack available so we cannot use alloca(). 127 */ |
128 if (obj != obj_rtld) { 129 cache = calloc(obj->nchains, sizeof(SymCache)); 130 /* No need to check for NULL here */ 131 } else |
132 cache = NULL; 133 134 rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize); 135 for (rel = obj->rel; rel < rellim; rel++) { 136 Elf_Addr *where = (Elf_Addr *) (obj->relocbase + rel->r_offset); 137 138 switch (ELF_R_TYPE(rel->r_info)) { 139 --- 129 unchanged lines hidden (view full) --- 269 _rtld_error("%s: Unsupported relocation type %d" 270 " in non-PLT relocations\n", obj->path, 271 ELF_R_TYPE(rel->r_info)); 272 goto done; 273 } 274 } 275 r = 0; 276done: |
277 if (cache != NULL) 278 free(cache); |
279 return(r); 280} 281 282/* Process the PLT relocations. */ 283int 284reloc_plt(Obj_Entry *obj) 285{ 286 const Elf_Rel *rellim; --- 81 unchanged lines hidden --- |