FreeBSD/libexec/rtld-elf/powerpc/reloc.c
/*
 * LD_BIND_NOW was set - force relocation for all jump slots
 */
LD_BIND_NOW was set - force relocation for all jump slots
LD_BIND_NOW was set - force relocation for all jump slots
int
reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockState *lockstate)
{
	const Obj_Entry *defobj;
	const Elf_Rela *relalim;
	const Elf_Rela *rela;
	const Elf_Sym *def;
	Elf_Addr *where;
	Elf_Addr target;
	relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
	for (rela = obj->pltrela; rela < relalim; rela++) {
		assert(ELF_R_TYPE(rela->r_info) == R_PPC_JMP_SLOT);
		where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
		def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
		    SYMLOOK_IN_PLT | flags, NULL, lockstate);
		if (def == NULL) {
			dbg("reloc_jmpslots: sym not found");
			return (-1);
		}
		target = (Elf_Addr)(defobj->relocbase + def->st_value);
#if 0
		dbg("\"%s\" in \"%s\" --> %p in \"%s\"",
		    defobj->strtab + def->st_name, basename(obj->path),
		    (void *)target, basename(defobj->path));
#endif
		reloc_jmpslot(where, target, defobj, obj,
		    (const Elf_Rel *) rela);
	}
	obj->jmpslots_done = true;
	return (0);
}
int reloc_jmpslots ( Obj_Entry * obj , int flags , RtldLockState * lockstate ) { const Obj_Entry * defobj ; const Elf_Rela * relalim ; const Elf_Rela * rela ; const Elf_Sym * def ; Elf_Addr * where ; Elf_Addr target ; relalim = ( const Elf_Rela * ) ( ( char * ) obj -> pltrela + obj -> pltrelasize ) ; for ( rela = obj -> pltrela ; rela < relalim ; rela ++ ) { assert ( ELF_R_TYPE ( rela -> r_info ) == R_PPC_JMP_SLOT ) ; where = ( Elf_Addr * ) ( obj -> relocbase + rela -> r_offset ) ; def = find_symdef ( ELF_R_SYM ( rela -> r_info ) , obj , & defobj , SYMLOOK_IN_PLT | flags , NULL , lockstate ) ; if ( def == NULL ) { dbg ( " " ) ; return ( -1 ) ; } target = ( Elf_Addr ) ( defobj -> relocbase + def -> st_value ) ; #if 0 dbg ( " \" \" \" \" \" \" " , defobj -> strtab + def -> st_name , basename ( obj -> path ) , ( void * ) target , basename ( defobj -> path ) ) ; #endif reloc_jmpslot ( where , target , defobj , obj , ( const Elf_Rel * ) rela ) ; } obj -> jmpslots_done = true ; return ( 0 ) ; }
LD_BIND_NOW was set - force relocation for all jump slots
LD_BIND_NOW was set - force relocation for all jump slots
/* PG XXX */