diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-12 10:32:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-12 10:32:23 -0600 |
commit | 17fa17a246746d8b05fb9078234b934a53809ec2 (patch) | |
tree | 020728abd50ce45f281a5e0bddcfedef01c4d649 /nuttx/binfmt/libelf | |
parent | 5e6d8cafd8f47bc78a4667732837dae68869283c (diff) | |
download | px4-nuttx-17fa17a246746d8b05fb9078234b934a53809ec2.tar.gz px4-nuttx-17fa17a246746d8b05fb9078234b934a53809ec2.tar.bz2 px4-nuttx-17fa17a246746d8b05fb9078234b934a53809ec2.zip |
ELF: Critical bugfix.. BSS was not being cleared
Diffstat (limited to 'nuttx/binfmt/libelf')
-rw-r--r-- | nuttx/binfmt/libelf/libelf_load.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nuttx/binfmt/libelf/libelf_load.c b/nuttx/binfmt/libelf/libelf_load.c index 75ecb30fc..11d054a94 100644 --- a/nuttx/binfmt/libelf/libelf_load.c +++ b/nuttx/binfmt/libelf/libelf_load.c @@ -43,6 +43,7 @@ #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <elf32.h> #include <assert.h> @@ -200,6 +201,15 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo) } } + /* If there is no data in an allocated section, then the allocated + * section must be cleared. + */ + + else + { + memset(*pptr, 0, shdr->sh_size); + } + /* Update sh_addr to point to copy in memory */ bvdbg("%d. %08lx->%08lx\n", i, |