summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-26 18:58:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-26 18:58:37 +0000
commit083b33a940fa68f8a0751677c6e861efb0e11dad (patch)
treeea1f3b5a8a9bcfe87719f0972d0ce728d91f195f /nuttx/binfmt
parentae74e84615e37f8c23fd8cadcd9e24476b011ce3 (diff)
downloadpx4-nuttx-083b33a940fa68f8a0751677c6e861efb0e11dad.tar.gz
px4-nuttx-083b33a940fa68f8a0751677c6e861efb0e11dad.tar.bz2
px4-nuttx-083b33a940fa68f8a0751677c6e861efb0e11dad.zip
Completes initial shaky integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1963 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_bind.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c
index 32442467a..0b2a80a95 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_bind.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c
@@ -368,6 +368,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
offset = ntohl(hdr->h_importsymbols);
nimports = ntohs(hdr->h_importcount);
+ bvdbg("Imports offset: %08x nimports: %d\n", offset, nimports);
/* Verify that this module requires imported symbols */
@@ -396,6 +397,9 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
for (i = 0; i < nimports; i++)
{
+ bvdbg("Import[%d] (%08p) offset: %08x func: %08x\n",
+ i, &imports[i], imports[i].i_funcname, imports[i].i_funcaddress);
+
/* Get a pointer to the imported symbol name. The name itself
* lies in the TEXT segment. But the reference to the name
* lies in DATA segment. Therefore, the name reference should
@@ -424,7 +428,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
imports[i].i_funcaddress = (uint32)symbol->sym_value;
- bvdbg("Bound import %d (%08p) to export '%s' (%08x)\n",
+ bvdbg("Bound import[%d] (%08p) to export '%s' (%08x)\n",
i, &imports[i], symname, imports[i].i_funcaddress);
}
}
@@ -462,14 +466,17 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo,
FAR const struct symtab_s *exports, int nexports)
{
- /* First bind all GOT relocations */
+ /* Bind the imported symbol, absolute relocations separately. This is done
+ * before the standard relocations because that logic may modify the
+ * import list (for the better hopefully, but we don't want to depend on it).
+ */
- int ret = nxflat_gotrelocs(loadinfo);
+ int ret = nxflat_bindimports(loadinfo, exports, nexports);
if (ret == OK)
{
- /* Then bind the imported symbol, absolute relocations separately. */
+ /* Then bind all GOT relocations */
- ret = nxflat_bindimports(loadinfo, exports, nexports);
+ ret = nxflat_gotrelocs(loadinfo);
if (ret == OK)
{
/* Zero the BSS area, trashing the relocations that lived in that