DL_DEB(("PLABEL32: %x(_fini) -> 0x%x in %s\n", object->dyn.fini, addr, object->load_name));
DL_DEB(("PLABEL32: %p:%p(_fini) -> 0x%x in %s\n", object->dyn.fini, object->dyn.pltgot, addr, object->load_name));
_dl_md_reloc(elf_object_t *object, int rel, int relasz){	Elf_RelA	*rela;	Elf_Addr	loff;	int	i, numrela, fails = 0;	size_t	size;	loff = object->load_offs;	numrela = object->Dyn.info[relasz] / sizeof(Elf_RelA);	rela = (Elf_RelA *)(object->Dyn.info[rel]);	DL_DEB(("object %s relasz %x, numrela %x loff %x\n",	    object->load_name, object->Dyn.info[relasz], numrela, loff));	if (rela == NULL)		return (0);	/* either it's an ld bug or a wacky hpux abi */	if (!object->dyn.pltgot)		object->Dyn.info[DT_PLTGOT] += loff;	if (object->dyn.init && !((Elf_Addr)object->dyn.init & 2)) {		Elf_Addr addr = _dl_md_plabel((Elf_Addr)object->dyn.init,		    object->dyn.pltgot);		DL_DEB(("PLABEL32: %x(_init) -> 0x%x in %s\n",		    object->dyn.init, addr, object->load_name));		object->dyn.init = (void *)addr;	}	if (object->dyn.fini && !((Elf_Addr)object->dyn.fini & 2)) {		Elf_Addr addr = _dl_md_plabel((Elf_Addr)object->dyn.fini,		    object->dyn.pltgot);		DL_DEB(("PLABEL32: %x(_fini) -> 0x%x in %s\n",		    object->dyn.fini, addr, object->load_name));		object->dyn.fini = (void *)addr;	}	for (i = 0; i < numrela; i++, rela++) {		const elf_object_t *sobj;		const Elf_Sym *sym, *this;		Elf_Addr *pt, ooff;		const char *symn;		int type;		type = ELF_R_TYPE(rela->r_info);		if (type == RELOC_NONE)			continue;		this = sym = object->dyn.symtab + ELF_R_SYM(rela->r_info);		sobj = object;		symn = object->dyn.strtab + sym->st_name;		pt = (Elf_Addr *)(rela->r_offset + loff);		ooff = 0;		if (ELF_R_SYM(rela->r_info) && sym->st_name) {			ooff = _dl_find_symbol_bysym(object,			    ELF_R_SYM(rela->r_info), _dl_objects,			    &this, &sobj, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|			    ((type == RELOC_DIR32) ? SYM_NOTPLT : SYM_PLT),			    sym->st_size);			if (!this) {				_dl_printf("%s: %s: can't resolve reference '%s'\n",				    _dl_progname, object->load_name, symn);				fails++;				continue;			}		}		DL_DEB(("*pt=%x r_addend=%x r_sym=%x\n",		    *pt, rela->r_addend, ELF_R_SYM(rela->r_info)));		switch (type) {		case RELOC_DIR32:			if (ELF_R_SYM(rela->r_info) && sym->st_name) {				*pt = ooff + this->st_value + rela->r_addend;				DL_DEB(("[%x]DIR32: %s:%s -> 0x%x in %s\n",				    i, symn, object->load_name,				    *pt, sobj->load_name));			} else {				/*				 * XXX should objects ever get their				 * sections loaded insequential this				 * would have to get a section number				 * (ELF_R_SYM(rela->r_info))-1 and then:				 *    *pt = sect->addr + rela->r_addend;				 */				if (ELF_R_SYM(rela->r_info))					*pt += loff;				else					*pt += loff + rela->r_addend;				DL_DEB(("[%x]DIR32: %s @ 0x%x\n", i,				    object->load_name, *pt));			}			break;		case RELOC_PLABEL32:			if (ELF_R_SYM(rela->r_info)) {				if (ELF_ST_TYPE(this->st_info) != STT_FUNC) {					DL_DEB(("[%x]PLABEL32: bad\n", i));					break;				}				*pt = _dl_md_plabel(sobj->load_offs +				    this->st_value + rela->r_addend,				    sobj->dyn.pltgot);				DL_DEB(("[%x]PLABEL32: %s:%s -> 0x%x in %s\n",				    i, symn, object->load_name,				    *pt, sobj->load_name));			} else {				*pt = loff + rela->r_addend;				DL_DEB(("[%x]PLABEL32: %s @ 0x%x\n", i,				    object->load_name, *pt));			}			break;		case RELOC_IPLT:			if (ELF_R_SYM(rela->r_info)) {				pt[0] = ooff + this->st_value + rela->r_addend;				pt[1] = (Elf_Addr)sobj->dyn.pltgot;				DL_DEB(("[%x]IPLT: %s:%s -> 0x%x:0x%x in %s\n",				    i, symn, object->load_name,				    pt[0], pt[1], sobj->load_name));			} else {				pt[0] = loff + rela->r_addend;				pt[1] = (Elf_Addr)object->dyn.pltgot;				DL_DEB(("[%x]IPLT: %s @ 0x%x:0x%x\n", i,				    object->load_name, pt[0], pt[1]));			}			break;		case RELOC_COPY:			size = sym->st_size;			ooff = _dl_find_symbol(symn, object->next, &sym, NULL,			    SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_NOTPLT,			    size, object);			if (sym) {				_dl_bcopy((void *)(ooff + sym->st_value),				    pt, sym->st_size);				DL_DEB(("[%x]COPY: %s[%x]:%s -> %p[%x] in %s\n",				    i, symn, ooff + sym->st_value,				    object->load_name, pt, sym->st_size,				    sobj->load_name));			} else				DL_DEB(("[%x]COPY: no sym\n", i));			break;		default:			DL_DEB(("[%x]UNKNOWN(%d): type=%d off=0x%lx "			    "addend=0x%lx rel=0x%x\n", i, type,			    ELF_R_TYPE(rela->r_info), rela->r_offset,			    rela->r_addend, *pt));			break;		}	}	return (fails);}