Still waffling on relocation types
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1931 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
6d2642ec8d
commit
7c790feb6a
|
@ -144,6 +144,49 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
|
|||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_bindrel32id
|
||||
*
|
||||
* Description:
|
||||
* Perform the NXFLAT_RELOC_TYPE_REL32ID binding:
|
||||
*
|
||||
* Meaning: Object file contains a 32-bit offset into I-Space at the offset
|
||||
* that will unfortunately be references relative to the GOT
|
||||
* Fixup: Add allocated the mapped I-Space address MINUS the allocated
|
||||
* D-Space address to the offset.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NXFLAT_RELOC_TYPE_REL32ID
|
||||
static inline int nxflat_bindrel32id(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
uint32 offset)
|
||||
{
|
||||
uint32 *addr;
|
||||
|
||||
bvdbg("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n",
|
||||
offset, loadinfo->dspace->region);
|
||||
|
||||
if (offset < loadinfo->dsize)
|
||||
{
|
||||
addr = (uint32*)(offset + loadinfo->dspace->region);
|
||||
bvdbg(" Before: %08x\n", *addr);
|
||||
*addr += ((uint32)loadinfo->ispace - (uint32)(loadinfo->dspace->region));
|
||||
bvdbg(" After: %08x\n", *addr);
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
bdbg("Offset: %08 does not lie in D-Space size: %08x\n",
|
||||
offset, loadinfo->dsize);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_gotrelocs
|
||||
*
|
||||
|
@ -221,6 +264,23 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
|||
}
|
||||
break;
|
||||
|
||||
/* NXFLAT_RELOC_TYPE_REL32ID Meaning: Object file contains a 32-bit offset
|
||||
* into I-Space at the offset that will
|
||||
* unfortunately be references relative
|
||||
* to the GOT
|
||||
* Fixup: Add allocated the mapped I-Space
|
||||
* address MINUS the allocated D-Space
|
||||
* address to the offset.
|
||||
*/
|
||||
|
||||
#ifdef NXFLAT_RELOC_TYPE_REL32ID
|
||||
case NXFLAT_RELOC_TYPE_REL32ID:
|
||||
{
|
||||
result = nxflat_bindrel32id(loadinfo, NXFLAT_RELOC_OFFSET(reloc.r_info));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
bdbg("ERROR: Unrecognized relocation type: %d\n", NXFLAT_RELOC_TYPE(reloc.r_info));
|
||||
|
|
|
@ -161,21 +161,24 @@ struct nxflat_reloc_s
|
|||
/* These are possible values for the relocation type:
|
||||
*
|
||||
* NXFLAT_RELOC_TYPE_REL32I Meaning: Object file contains a 32-bit offset
|
||||
* into I-Space at the the offset.
|
||||
* into I-Space at the offset.
|
||||
* Fixup: Add mapped I-Space address to the offset.
|
||||
* NXFLAT_RELOC_TYPE_REL32D Meaning: Object file contains a 32-bit offset
|
||||
* into D-Space at the the offset.
|
||||
* into D-Space at the offset.
|
||||
* Fixup: Add allocated D-Space address to the
|
||||
* offset.
|
||||
* NXFLAT_RELOC_TYPE_ABS32 Meaning: Offset refers to a struct nxflat_import_s
|
||||
* describing a function pointer to be
|
||||
* imported.
|
||||
* Fixup: Provide the absolute function address
|
||||
* in the struct nxflat_import_s instance.
|
||||
* NXFLAT_RELOC_TYPE_REL32ID Meaning: Object file contains a 32-bit offset
|
||||
* into I-Space at the offset that will
|
||||
* unfortunately be references relative
|
||||
* to the GOT
|
||||
* Fixup: Add allocated the mapped I-Space
|
||||
* address MINUS the allocated D-Space
|
||||
* address to the offset.
|
||||
*/
|
||||
|
||||
#define NXFLAT_RELOC_TYPE_REL32I 0
|
||||
#define NXFLAT_RELOC_TYPE_REL32D 1
|
||||
#undef NXFLAT_RELOC_TYPE_REL32ID /* May not need */
|
||||
#define NXFLAT_RELOC_TYPE_NUM 2 /* Number of relocation types */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue