aboutsummaryrefslogtreecommitdiff
path: root/nuttx/binfmt/elf.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-29 20:43:35 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-29 20:43:35 +0000
commitb48508c844dbd558e728c5695136696b5dfea1fc (patch)
treeb7c28580644d845360274723b39b8367ed109bba /nuttx/binfmt/elf.c
parent5681b615ec10265a27677bc2ca98fa385460afec (diff)
downloadpx4-firmware-b48508c844dbd558e728c5695136696b5dfea1fc.tar.gz
px4-firmware-b48508c844dbd558e728c5695136696b5dfea1fc.tar.bz2
px4-firmware-b48508c844dbd558e728c5695136696b5dfea1fc.zip
C++ static destructors work with ELF load too now
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5274 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/elf.c')
-rw-r--r--nuttx/binfmt/elf.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c
index 26057ffc1..ea1e7b0ca 100644
--- a/nuttx/binfmt/elf.c
+++ b/nuttx/binfmt/elf.c
@@ -111,12 +111,16 @@ static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo)
int i;
bdbg("LOAD_INFO:\n");
- bdbg(" alloc: %08lx\n", (long)loadinfo->alloc);
- bdbg(" allocsize: %ld\n", (long)loadinfo->allocsize);
+ bdbg(" elfalloc: %08lx\n", (long)loadinfo->elfalloc);
+ bdbg(" elfsize: %ld\n", (long)loadinfo->elfsize);
bdbg(" filelen: %ld\n", (long)loadinfo->filelen);
#ifdef CONFIG_BINFMT_CONSTRUCTORS
+ bdbg(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
bdbg(" ctors: %08lx\n", (long)loadinfo->ctors);
bdbg(" nctors: %d\n", loadinfo->nctors);
+ bdbg(" dtoralloc: %08lx\n", (long)loadinfo->dtoralloc);
+ bdbg(" dtors: %08lx\n", (long)loadinfo->dtors);
+ bdbg(" ndtors: %d\n", loadinfo->ndtors);
#endif
bdbg(" filfd: %d\n", loadinfo->filfd);
bdbg(" symtabidx: %d\n", loadinfo->symtabidx);
@@ -210,8 +214,8 @@ static int elf_loadbinary(struct binary_s *binp)
/* Return the load information */
- binp->entrypt = (main_t)(loadinfo.alloc + loadinfo.ehdr.e_entry);
- binp->alloc[0] = (FAR void *)loadinfo.alloc;
+ binp->entrypt = (main_t)(loadinfo.elfalloc + loadinfo.ehdr.e_entry);
+ binp->alloc[0] = (FAR void *)loadinfo.elfalloc;
binp->stacksize = CONFIG_ELF_STACKSIZE;
#ifdef CONFIG_BINFMT_CONSTRUCTORS
@@ -219,19 +223,13 @@ static int elf_loadbinary(struct binary_s *binp)
* yet supported.
*/
- binp->ctors = loadinfo.ctors;
- binp->nctors = loadinfo.nctors;
+ binp->alloc[1] = loadinfo.ctoralloc;
+ binp->ctors = loadinfo.ctors;
+ binp->nctors = loadinfo.nctors;
- /* Was memory allocated for constructors? */
-
- if (!loadinfo.newabi)
- {
- /* Yes.. save the allocation address so that it can be freed by
- * unload module.
- */
-
- binp->alloc[1] = (FAR void *)loadinfo.ctors;
- }
+ binp->alloc[2] = loadinfo.dtoralloc;
+ binp->dtors = loadinfo.dtors;
+ binp->ndtors = loadinfo.ndtors;
#endif
elf_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt,