summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-24 12:57:02 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-24 12:57:02 -0600
commit65dcc20142c98e13e52ab7129c489059c4d64380 (patch)
tree6c39bd7aa847275b9ebb67236aaefb2b1533b216 /nuttx/binfmt
parent9f1f24faa04da13e1edc7534111fe4fdf6ab8621 (diff)
downloadpx4-nuttx-65dcc20142c98e13e52ab7129c489059c4d64380.tar.gz
px4-nuttx-65dcc20142c98e13e52ab7129c489059c4d64380.tar.bz2
px4-nuttx-65dcc20142c98e13e52ab7129c489059c4d64380.zip
Fix some compilation errors in ELF logic that were introduced in a recent commit
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/elf.c12
-rw-r--r--nuttx/binfmt/libelf/libelf_load.c26
2 files changed, 20 insertions, 18 deletions
diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c
index 04e182603..eb0adc702 100644
--- a/nuttx/binfmt/elf.c
+++ b/nuttx/binfmt/elf.c
@@ -112,8 +112,10 @@ static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo)
int i;
bdbg("LOAD_INFO:\n");
- bdbg(" elfalloc: %08lx\n", (long)loadinfo->elfalloc);
- bdbg(" elfsize: %ld\n", (long)loadinfo->elfsize);
+ bdbg(" textalloc: %08lx\n", (long)loadinfo->textalloc);
+ bdbg(" dataalloc: %08lx\n", (long)loadinfo->dataalloc);
+ bdbg(" textsize: %ld\n", (long)loadinfo->textsize);
+ bdbg(" datasize: %ld\n", (long)loadinfo->datasize);
bdbg(" filelen: %ld\n", (long)loadinfo->filelen);
#ifdef CONFIG_BINFMT_CONSTRUCTORS
bdbg(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
@@ -215,7 +217,7 @@ static int elf_loadbinary(struct binary_s *binp)
/* Return the load information */
- binp->entrypt = (main_t)(loadinfo.elfalloc + loadinfo.ehdr.e_entry);
+ binp->entrypt = (main_t)(loadinfo.textalloc + loadinfo.ehdr.e_entry);
binp->stacksize = CONFIG_ELF_STACKSIZE;
/* Add the ELF allocation to the alloc[] only if there is no address
@@ -229,11 +231,11 @@ static int elf_loadbinary(struct binary_s *binp)
#ifdef CONFIG_ARCH_ADDRENV
# warning "REVISIT"
#else
- binp->alloc[0] = (FAR void *)loadinfo.elfalloc;
+ binp->alloc[0] = (FAR void *)loadinfo.textalloc;
#endif
#ifdef CONFIG_BINFMT_CONSTRUCTORS
- /* Save information about constructors. NOTE: desctructors are not
+ /* Save information about constructors. NOTE: destructors are not
* yet supported.
*/
diff --git a/nuttx/binfmt/libelf/libelf_load.c b/nuttx/binfmt/libelf/libelf_load.c
index 9f33abb40..81016a908 100644
--- a/nuttx/binfmt/libelf/libelf_load.c
+++ b/nuttx/binfmt/libelf/libelf_load.c
@@ -177,25 +177,25 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
continue;
}
+ /* SHF_WRITE indicates that the section address space is write-
+ * able
+ */
+
+ if ((shdr->sh_flags & SHF_WRITE) != 0)
+ {
+ pptr = &data;
+ }
+ else
+ {
+ pptr = &text;
+ }
+
/* SHT_NOBITS indicates that there is no data in the file for the
* section.
*/
if (shdr->sh_type != SHT_NOBITS)
{
- /* SHF_WRITE indicates that the section address space is write-
- * able
- */
-
- if ((shdr->sh_flags & SHF_WRITE) != 0)
- {
- pptr = &data;
- }
- else
- {
- pptr = &text;
- }
-
/* If CONFIG_ARCH_ADDRENV=y, then 'text' lies in a virtual address
* space that may not be in place now. elf_addrenv_select() will
* temporarily instantiate that address space.