comparison head/libexec/rtld-elf/ia64/reloc.c @ 481:737774f27543

Update libexec/rtld-elf to @235221
author Aleksandr Rybalko <ray@ddteam.net>
date Thu, 10 May 2012 14:47:51 +0300
parents f2935497fa04
children
comparison
equal deleted inserted replaced
480:31ffb4589c7c 481:737774f27543
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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 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. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 * 24 *
25 * $FreeBSD: head/libexec/rtld-elf/ia64/reloc.c 233307 2012-03-22 14:20:51Z kib $ 25 * $FreeBSD: head/libexec/rtld-elf/ia64/reloc.c 234841 2012-04-30 13:31:10Z kib $
26 */ 26 */
27 27
28 /* 28 /*
29 * Dynamic linker for ELF. 29 * Dynamic linker for ELF.
30 * 30 *
102 alloc_fptrs(Obj_Entry *obj, bool mapped) 102 alloc_fptrs(Obj_Entry *obj, bool mapped)
103 { 103 {
104 struct fptr **fptrs; 104 struct fptr **fptrs;
105 size_t fbytes; 105 size_t fbytes;
106 106
107 fbytes = obj->nchains * sizeof(struct fptr *); 107 fbytes = obj->dynsymcount * sizeof(struct fptr *);
108 108
109 /* 109 /*
110 * Avoid malloc, if requested. Happens when relocating 110 * Avoid malloc, if requested. Happens when relocating
111 * rtld itself on startup. 111 * rtld itself on startup.
112 */ 112 */
136 136
137 fptrs = obj->priv; 137 fptrs = obj->priv;
138 if (fptrs == NULL) 138 if (fptrs == NULL)
139 return; 139 return;
140 140
141 fbytes = obj->nchains * sizeof(struct fptr *); 141 fbytes = obj->dynsymcount * sizeof(struct fptr *);
142 if (mapped) 142 if (mapped)
143 munmap(fptrs, fbytes); 143 munmap(fptrs, fbytes);
144 else 144 else
145 free(fptrs); 145 free(fptrs);
146 obj->priv = NULL; 146 obj->priv = NULL;
346 const Elf_Rel *rellim; 346 const Elf_Rel *rellim;
347 const Elf_Rel *rel; 347 const Elf_Rel *rel;
348 const Elf_Rela *relalim; 348 const Elf_Rela *relalim;
349 const Elf_Rela *rela; 349 const Elf_Rela *rela;
350 SymCache *cache; 350 SymCache *cache;
351 int bytes = obj->nchains * sizeof(SymCache); 351 int bytes = obj->dynsymcount * sizeof(SymCache);
352 int r = -1; 352 int r = -1;
353 353
354 /* 354 /*
355 * The dynamic loader may be called from a thread, we have 355 * The dynamic loader may be called from a thread, we have
356 * limited amounts of stack available so we cannot use alloca(). 356 * limited amounts of stack available so we cannot use alloca().