FreeBSD/libexec/rtld-elf/powerpc64/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 (def == &sym_zero) {
#if !defined(_CALL_ELF) || _CALL_ELF == 1
			bzero(where, sizeof(struct funcdesc));
#else
			*where = 0;
#endif
		} else {
			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 ( def == & sym_zero ) { #if ! defined ( _CALL_ELF ) || _CALL_ELF == 1 bzero ( where , sizeof ( struct funcdesc ) ) ; #else * where = 0 ; #endif } else { 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
/* Zero undefined weak symbols */