rel = (Elf_Rel *)(object->Dyn.info[DT_JMPREL]); num = (object->Dyn.info[DT_PLTRELSZ]); for (llist = object->load_list; llist != NULL; llist = llist->next) { if (!(llist->prot & PROT_WRITE)) _dl_mprotect(llist->start, llist->size, llist->prot|PROT_WRITE); } for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) { Elf_Addr *where; where = (Elf_Addr *)(rel->r_offset + object->load_offs); *where += object->load_offs; } for (llist = object->load_list; llist != NULL; llist = llist->next) { if (!(llist->prot & PROT_WRITE)) _dl_mprotect(llist->start, llist->size, llist->prot); }
_dl_md_reloc_got(elf_object_t *object, int lazy){	extern void _dl_bind_start(void);       /* XXX */	Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT];	int i, num;	Elf_Rel *rel;	struct load_list *llist;	Elf_Addr ooff;	const Elf_Sym *this;	if (pltgot == NULL)		return; /* it is possible to have no PLT/GOT relocations */	pltgot[1] = (Elf_Addr)object;	pltgot[2] = (Elf_Addr)&_dl_bind_start;	if (object->Dyn.info[DT_PLTREL] != DT_REL)		return;	object->got_addr = NULL;	object->got_size = 0;	this = NULL;	ooff = _dl_find_symbol("__got_start", object, &this,	    SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object);	if (this != NULL)		object->got_addr = ooff + this->st_value;	this = NULL;	ooff = _dl_find_symbol("__got_end", object, &this,	    SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object);	if (this != NULL)		object->got_size = ooff + this->st_value  - object->got_addr;	if (object->got_addr == NULL)		object->got_start = NULL;	else {		object->got_start = ELF_TRUNC(object->got_addr, _dl_pagesz);		object->got_size += object->got_addr - object->got_start;		object->got_size = ELF_ROUND(object->got_size, _dl_pagesz);	}	if (!lazy) {		_dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);		return;	}	rel = (Elf_Rel *)(object->Dyn.info[DT_JMPREL]);	num = (object->Dyn.info[DT_PLTRELSZ]);	for (llist = object->load_list; llist != NULL; llist = llist->next) {		if (!(llist->prot & PROT_WRITE))			_dl_mprotect(llist->start, llist->size,			    llist->prot|PROT_WRITE);	}	for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) {		Elf_Addr *where;		where = (Elf_Addr *)(rel->r_offset + object->load_offs);		*where += object->load_offs;	}	for (llist = object->load_list; llist != NULL; llist = llist->next) {		if (!(llist->prot & PROT_WRITE))			_dl_mprotect(llist->start, llist->size,			    llist->prot);	}	/* PLT is already RO on i386, no point in mprotecting it, just GOT */	if (object->got_size != 0)		_dl_mprotect((void*)object->got_start, object->got_size,		    PROT_READ);}