FreeBSD/usr.sbin/kldxref/ef_powerpc.c
/*
 * Apply relocations to the values obtained from the file. `relbase' is the
 * target relocation address of the section, and `dataoff/len' is the region
 * that is to be relocated, and has been copied to *dest
 */
Apply relocations to the values obtained from the file. `relbase' is the
target relocation address of the section, and `dataoff/len' is the region
that is to be relocated, and has been copied to *dest
Apply relocations to the values obtained from the file . ` relbase ' is the target relocation address of the section and ` dataoff / len ' is the region that is to be relocated and has been copied to * dest
int
ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
    Elf_Off dataoff, size_t len, void *dest)
{
        Elf_Addr *where, addend;
        Elf_Size rtype, symidx;
        const Elf_Rela *rela;
	if (reltype != EF_RELOC_RELA)
		return (EINVAL);
	rela = (const Elf_Rela *)reldata;
	where = (Elf_Addr *) ((Elf_Off)dest - dataoff + rela->r_offset);
	addend = rela->r_addend;
	rtype = ELF_R_TYPE(rela->r_info);
	symidx = ELF_R_SYM(rela->r_info);
	 if ((char *)where < (char *)dest || (char *)where >= (char *)dest + len)
                return (0);
	switch(rtype) {
	case R_PPC_RELATIVE: 
		*where = relbase + addend;
		break;
	default:
		warnx("unhandled relocation type %d", rtype);
	}
	return (0);
}
int ef_reloc ( struct elf_file * ef , const void * reldata , int reltype , Elf_Off relbase , Elf_Off dataoff , size_t len , void * dest ) { Elf_Addr * where , addend ; Elf_Size rtype , symidx ; const Elf_Rela * rela ; if ( reltype != EF_RELOC_RELA ) return ( EINVAL ) ; rela = ( const Elf_Rela * ) reldata ; where = ( Elf_Addr * ) ( ( Elf_Off ) dest - dataoff + rela -> r_offset ) ; addend = rela -> r_addend ; rtype = ELF_R_TYPE ( rela -> r_info ) ; symidx = ELF_R_SYM ( rela -> r_info ) ; if ( ( char * ) where < ( char * ) dest || ( char * ) where >= ( char * ) dest + len ) return ( 0 ) ; switch ( rtype ) { case R_PPC_RELATIVE : * where = relbase + addend ; break ; default : warnx ( " " , rtype ) ; } return ( 0 ) ; }
Apply relocations to the values obtained from the file.
Apply relocations to the values obtained from the file .
/* word32 B + A */