PowerPC: support ADDR16_LO, ADDR16_HI and ADDR16_HA relocations.

This commit is contained in:
kleink 2000-05-01 11:41:08 +00:00
parent 0344f24921
commit e425e0a706

View File

@ -1,4 +1,4 @@
/* $NetBSD: reloc.c,v 1.25 2000/02/07 21:40:41 scottb Exp $ */
/* $NetBSD: reloc.c,v 1.26 2000/05/01 11:41:08 kleink Exp $ */
/*
* Copyright 1996 John D. Polstra.
@ -388,6 +388,33 @@ _rtld_relocate_nonplt_object(obj, rela, dodebug)
break;
#endif /* __powerpc__ || __vax__ */
#if defined(__powerpc__)
case R_TYPE(16_LO): /* #lo(S + A) */
tmp = (Elf_Addr)(obj->relocbase + rela->r_addend);
if (*(Elf32_Half *)where != tmp)
*(Elf32_Half *)where = tmp;
rdbg(dodebug, ("16_LO in %s --> %p", obj->path,
(void *)*where));
break;
case R_TYPE(16_HI): /* #hi(S + A) */
tmp = (Elf_Addr)(obj->relocbase + rela->r_addend) >> 16;
if (*(Elf32_Half *)where != tmp)
*(Elf32_Half *)where = tmp;
rdbg(dodebug, ("16_HI in %s --> %p", obj->path,
(void *)*where));
break;
case R_TYPE(16_HA): /* #ha(S + A) */
tmp = (Elf_Addr)(obj->relocbase + rela->r_addend + 0x8000)
>> 16;
if (*(Elf32_Half *)where != tmp)
*(Elf32_Half *)where = tmp;
rdbg(dodebug, ("16_HA in %s --> %p", obj->path,
(void *)*where));
break;
#endif /* __powerpc__ */
#if defined(__vax__)
case R_TYPE(REL32):
def = _rtld_find_symdef(_rtld_objlist, rela->r_info, NULL, obj,