diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-23 20:22:50 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-23 20:22:50 +0000 |
commit | 9a9e45763f369718d75e08868a7d6a98fbc21324 (patch) | |
tree | 7b886ee3cfece132109a74dc44610294d8e52331 /nuttx/binfmt | |
parent | 84b2cb0e20adc129e915644b55aba7d93243b2cc (diff) | |
download | px4-nuttx-9a9e45763f369718d75e08868a7d6a98fbc21324.tar.gz px4-nuttx-9a9e45763f369718d75e08868a7d6a98fbc21324.tar.bz2 px4-nuttx-9a9e45763f369718d75e08868a7d6a98fbc21324.zip |
Still waffling on relocation types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1931 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_bind.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c index 98b00996b..2afb92f12 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_bind.c +++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c @@ -145,6 +145,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 * * Description: @@ -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)); |