mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
binfmt/libelf, libs/libc/modlib: Optimize elf load speed: (1) Don't zero out memory, (2) Reduce the initial buffer size to 32 bytes.
This commit is contained in:
parent
264a7164bc
commit
0edcd6b85e
9 changed files with 8 additions and 22 deletions
|
@ -17,12 +17,12 @@ config ELF_STACKSIZE
|
||||||
|
|
||||||
config ELF_BUFFERSIZE
|
config ELF_BUFFERSIZE
|
||||||
int "ELF I/O Buffer Size"
|
int "ELF I/O Buffer Size"
|
||||||
default 128
|
default 32
|
||||||
---help---
|
---help---
|
||||||
This is an I/O buffer that is used to access the ELF file. Variable length items
|
This is an I/O buffer that is used to access the ELF file. Variable length items
|
||||||
will need to be read (such as symbol names). This is really just this initial
|
will need to be read (such as symbol names). This is really just this initial
|
||||||
size of the buffer; it will be reallocated as necessary to hold large symbol
|
size of the buffer; it will be reallocated as necessary to hold large symbol
|
||||||
names). Default: 128
|
names). Default: 32
|
||||||
|
|
||||||
config ELF_BUFFERINCR
|
config ELF_BUFFERINCR
|
||||||
int "ELF I/O Buffer Realloc Increment"
|
int "ELF I/O Buffer Realloc Increment"
|
||||||
|
|
|
@ -131,7 +131,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
||||||
#else
|
#else
|
||||||
/* Allocate memory to hold the ELF image */
|
/* Allocate memory to hold the ELF image */
|
||||||
|
|
||||||
loadinfo->textalloc = (uintptr_t)kumm_zalloc(textsize + datasize);
|
loadinfo->textalloc = (uintptr_t)kumm_malloc(textsize + datasize);
|
||||||
if (!loadinfo->textalloc)
|
if (!loadinfo->textalloc)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -63,10 +63,6 @@
|
||||||
# undef CONFIG_ELF_DUMPBUFFER
|
# undef CONFIG_ELF_DUMPBUFFER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_ELF_BUFFERSIZE
|
|
||||||
# define CONFIG_ELF_BUFFERSIZE 128
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_ELF_DUMPBUFFER
|
#ifdef CONFIG_ELF_DUMPBUFFER
|
||||||
# define elf_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
|
# define elf_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -53,10 +53,6 @@
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_ELF_BUFFERINCR
|
|
||||||
# define CONFIG_ELF_BUFFERINCR 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Constant Data
|
* Private Constant Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_ELF_BUFFERSIZE
|
#ifndef CONFIG_ELF_BUFFERSIZE
|
||||||
# define CONFIG_ELF_BUFFERSIZE 128
|
# define CONFIG_ELF_BUFFERSIZE 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_ELF_BUFFERINCR
|
#ifndef CONFIG_ELF_BUFFERINCR
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_MODLIB_BUFFERSIZE
|
#ifndef CONFIG_MODLIB_BUFFERSIZE
|
||||||
# define CONFIG_MODLIB_BUFFERSIZE 128
|
# define CONFIG_MODLIB_BUFFERSIZE 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_MODLIB_BUFFERINCR
|
#ifndef CONFIG_MODLIB_BUFFERINCR
|
||||||
|
|
|
@ -33,12 +33,12 @@ config MODLIB_ALIGN_LOG2
|
||||||
|
|
||||||
config MODLIB_BUFFERSIZE
|
config MODLIB_BUFFERSIZE
|
||||||
int "Module I/O Buffer Size"
|
int "Module I/O Buffer Size"
|
||||||
default 128
|
default 32
|
||||||
---help---
|
---help---
|
||||||
This is an I/O buffer that is used to access the module file.
|
This is an I/O buffer that is used to access the module file.
|
||||||
Variable length items will need to be read (such as symbol names).
|
Variable length items will need to be read (such as symbol names).
|
||||||
This is really just this initial size of the buffer; it will be
|
This is really just this initial size of the buffer; it will be
|
||||||
reallocated as necessary to hold large symbol names). Default: 128
|
reallocated as necessary to hold large symbol names). Default: 32
|
||||||
|
|
||||||
config MODLIB_BUFFERINCR
|
config MODLIB_BUFFERINCR
|
||||||
int "Module I/O Buffer Realloc Increment"
|
int "Module I/O Buffer Realloc Increment"
|
||||||
|
|
|
@ -261,7 +261,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
|
||||||
|
|
||||||
/* Allocate memory to hold the ELF image */
|
/* Allocate memory to hold the ELF image */
|
||||||
|
|
||||||
loadinfo->textalloc = (uintptr_t)lib_zalloc(loadinfo->textsize + loadinfo->datasize);
|
loadinfo->textalloc = (uintptr_t)lib_malloc(loadinfo->textsize + loadinfo->datasize);
|
||||||
if (!loadinfo->textalloc)
|
if (!loadinfo->textalloc)
|
||||||
{
|
{
|
||||||
berr("ERROR: Failed to allocate memory for the module\n");
|
berr("ERROR: Failed to allocate memory for the module\n");
|
||||||
|
|
|
@ -52,12 +52,6 @@
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Amount to reallocate buffer when buffer is full */
|
|
||||||
|
|
||||||
#ifndef CONFIG_MODLIB_BUFFERINCR
|
|
||||||
# define CONFIG_MODLIB_BUFFERINCR 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return values search for exported modules */
|
/* Return values search for exported modules */
|
||||||
|
|
||||||
#define SYM_NOT_FOUND 0
|
#define SYM_NOT_FOUND 0
|
||||||
|
|
Loading…
Reference in a new issue