summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_bind.c17
-rw-r--r--nuttx/examples/nxflat/nxflat_main.c4
2 files changed, 15 insertions, 6 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
diff --git a/nuttx/examples/nxflat/nxflat_main.c b/nuttx/examples/nxflat/nxflat_main.c
index 78146b913..a2143005d 100644
--- a/nuttx/examples/nxflat/nxflat_main.c
+++ b/nuttx/examples/nxflat/nxflat_main.c
@@ -225,7 +225,9 @@ int user_start(int argc, char *argv[])
}
message("Wait a bit for test completion\n");
- sleep(2);
+ sleep(4);
}
+
+ message("End-of-Test.. Exit-ing\n");
return 0;
}