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:
parent
7d7af84e20
commit
3fa803b523
|
@ -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/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -129,11 +129,17 @@ _rtld_relocate_nonplt_objects(const Obj_Entry *obj)
|
||||||
if (__predict_true(RELOC_ALIGNED_P(where))) {
|
if (__predict_true(RELOC_ALIGNED_P(where))) {
|
||||||
tmp = *where + (Elf_Addr)defobj->relocbase +
|
tmp = *where + (Elf_Addr)defobj->relocbase +
|
||||||
def->st_value;
|
def->st_value;
|
||||||
|
/* Set the Thumb bit, if needed. */
|
||||||
|
if (ELF32_ST_TYPE(def->st_info) == STT_ARM_TFUNC)
|
||||||
|
tmp |= 1;
|
||||||
*where = tmp;
|
*where = tmp;
|
||||||
} else {
|
} else {
|
||||||
tmp = load_ptr(where) +
|
tmp = load_ptr(where) +
|
||||||
(Elf_Addr)defobj->relocbase +
|
(Elf_Addr)defobj->relocbase +
|
||||||
def->st_value;
|
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);
|
store_ptr(where, tmp);
|
||||||
}
|
}
|
||||||
rdbg(("ABS32/GLOB_DAT %s in %s --> %p @ %p in %s",
|
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();
|
_rtld_die();
|
||||||
|
|
||||||
new_value = (Elf_Addr)(defobj->relocbase + def->st_value);
|
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",
|
rdbg(("bind now/fixup in %s --> old=%p new=%p",
|
||||||
defobj->strtab + def->st_name, (void *)*where, (void *)new_value));
|
defobj->strtab + def->st_name, (void *)*where, (void *)new_value));
|
||||||
if (*where != new_value)
|
if (*where != new_value)
|
||||||
|
@ -248,6 +257,10 @@ _rtld_relocate_plt_objects(const Obj_Entry *obj)
|
||||||
if (def == NULL)
|
if (def == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
target = (Elf_Addr)(defobj->relocbase + def->st_value);
|
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",
|
rdbg(("bind now/fixup in %s --> old=%p new=%p",
|
||||||
defobj->strtab + def->st_name, (void *)*where,
|
defobj->strtab + def->st_name, (void *)*where,
|
||||||
(void *)target));
|
(void *)target));
|
||||||
|
|
Loading…
Reference in New Issue