Check the type of symbols; if it's a Thumb function, then set the Thumb

bit in the relocated value (JUMP_SLOT, ABS32 & GLOB_DAT).
This commit is contained in:
rearnsha 2004-08-21 11:14:07 +00:00
parent 7d7af84e20
commit 3fa803b523
1 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mdreloc.c,v 1.23 2003/07/26 15:04:38 mrg Exp $ */
/* $NetBSD: mdreloc.c,v 1.24 2004/08/21 11:14:07 rearnsha Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@ -129,11 +129,17 @@ _rtld_relocate_nonplt_objects(const Obj_Entry *obj)
if (__predict_true(RELOC_ALIGNED_P(where))) {
tmp = *where + (Elf_Addr)defobj->relocbase +
def->st_value;
/* Set the Thumb bit, if needed. */
if (ELF32_ST_TYPE(def->st_info) == STT_ARM_TFUNC)
tmp |= 1;
*where = tmp;
} else {
tmp = load_ptr(where) +
(Elf_Addr)defobj->relocbase +
def->st_value;
/* Set the Thumb bit, if needed. */
if (ELF32_ST_TYPE(def->st_info) == STT_ARM_TFUNC)
tmp |= 1;
store_ptr(where, tmp);
}
rdbg(("ABS32/GLOB_DAT %s in %s --> %p @ %p in %s",
@ -222,6 +228,9 @@ _rtld_bind(const Obj_Entry *obj, Elf_Word reloff)
_rtld_die();
new_value = (Elf_Addr)(defobj->relocbase + def->st_value);
/* Set the Thumb bit, if needed. */
if (ELF32_ST_TYPE(def->st_info) == STT_ARM_TFUNC)
new_value |= 1;
rdbg(("bind now/fixup in %s --> old=%p new=%p",
defobj->strtab + def->st_name, (void *)*where, (void *)new_value));
if (*where != new_value)
@ -248,6 +257,10 @@ _rtld_relocate_plt_objects(const Obj_Entry *obj)
if (def == NULL)
return -1;
target = (Elf_Addr)(defobj->relocbase + def->st_value);
/* Set the Thumb bit, if needed. */
if (ELF32_ST_TYPE(def->st_info) == STT_ARM_TFUNC)
target |= 1;
rdbg(("bind now/fixup in %s --> old=%p new=%p",
defobj->strtab + def->st_name, (void *)*where,
(void *)target));