There many occurences of the global variable g_exports and the opportunity for collisions. Make the global variable names unique.

This commit is contained in:
Gregory Nutt 2018-07-14 16:36:25 -06:00
parent e778a6990d
commit 5ecec24084
11 changed files with 29 additions and 29 deletions

View File

@ -1465,14 +1465,14 @@ examples/posix_spawn
Requires:
CONFIG_BINFMT_DISABLE=n - Don't disable the binary loader
CONFIG_ELF=y - Enable ELF binary loader
CONFIG_LIBC_EXECFUNCS=y - Enable support for posix_spawn
CONFIG_EXECFUNCS_SYMTAB="g_exports" - The name of the symbol table
created by the test.
CONFIG_EXECFUNCS_NSYMBOLS=10 - Value does not matter, it will be
corrected at runtime.
CONFIG_POSIX_SPAWN_STACKSIZE=768 - This default setting.
CONFIG_BINFMT_DISABLE=n - Don't disable the binary loader
CONFIG_ELF=y - Enable ELF binary loader
CONFIG_LIBC_EXECFUNCS=y - Enable support for posix_spawn
CONFIG_EXECFUNCS_SYMTAB="g_spawn_exports" - The name of the symbol table
created by the test.
CONFIG_EXECFUNCS_NSYMBOLS=10 - Value does not matter, it will be
corrected at runtime.
CONFIG_POSIX_SPAWN_STACKSIZE=768 - This default setting.
Test-specific configuration options:

View File

@ -164,8 +164,8 @@ static char fullpath[128];
* Symbols from Auto-Generated Code
****************************************************************************/
extern const struct symtab_s g_exports[];
extern const int g_nexports;
extern const struct symtab_s g_elf_exports[];
extern const int g_elf_nexports;
/****************************************************************************
* Private Functions
@ -343,7 +343,7 @@ int elf_main(int argc, char *argv[])
*/
args[0] = NULL;
ret = exec(filename, args, g_exports, g_nexports);
ret = exec(filename, args, g_elf_exports, g_elf_nexports);
mm_update(&g_mmstep, "after exec");

View File

@ -38,7 +38,7 @@ for var in $varlist; do
done
echo ""
echo "const struct symtab_s g_exports[] = "
echo "const struct symtab_s g_elf_exports[] = "
echo "{"
for var in $varlist; do
@ -47,5 +47,5 @@ done
echo "};"
echo ""
echo "const int g_nexports = sizeof(g_exports) / sizeof(struct symtab_s);"
echo "const int g_elf_nexports = sizeof(g_elf_exports) / sizeof(struct symtab_s);"

View File

@ -233,7 +233,7 @@ int nxflat_main(int argc, char *argv[])
*/
args[0] = NULL;
ret = exec(filename, args, g_exports, NEXPORTS);
ret = exec(filename, args, g_nxflat_exports, NEXPORTS);
if (ret < 0)
{
errmsg("ERROR: exec(%s) failed: %d\n", dirlist[i], errno);

View File

@ -24,7 +24,7 @@ echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H"
echo ""
echo "#include <nuttx/binfmt/symtab.h>"
echo ""
echo "static const struct symtab_s g_exports[] = "
echo "static const struct symtab_s g_nxflat_exports[] = "
echo "{"
for string in $varlist; do
@ -33,7 +33,7 @@ for string in $varlist; do
done
echo "};"
echo "#define NEXPORTS (sizeof(g_exports)/sizeof(struct symtab_s))"
echo "#define NEXPORTS (sizeof(g_nxflat_exports)/sizeof(struct symtab_s))"
echo ""
echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */"

View File

@ -38,7 +38,7 @@ for var in $varlist; do
done
echo ""
echo "const struct symtab_s g_exports[] = "
echo "const struct symtab_s g_spawn_exports[] = "
echo "{"
for var in $varlist; do
@ -47,5 +47,5 @@ done
echo "};"
echo ""
echo "const int g_nexports = sizeof(g_exports) / sizeof(struct symtab_s);"
echo "const int g_spawn_nexports = sizeof(g_spawn_exports) / sizeof(struct symtab_s);"

View File

@ -160,8 +160,8 @@ static char * const g_argv[4] =
* Symbols from Auto-Generated Code
****************************************************************************/
extern const struct symtab_s g_exports[];
extern const int g_nexports;
extern const struct symtab_s g_spawn_exports[];
extern const int g_spawn_nexports;
/****************************************************************************
* Private Functions
@ -300,8 +300,8 @@ int spawn_main(int argc, char *argv[])
/* Make sure that we are using our symbol tablee */
symdesc.symtab = (FAR struct symtab_s *)g_exports; /* Discard 'const' */
symdesc.nsymbols = g_nexports;
symdesc.symtab = (FAR struct symtab_s *)g_spawn_exports; /* Discard 'const' */
symdesc.nsymbols = g_spawn_nexports;
(void)boardctl(BOARDIOC_APP_SYMTAB, (uintptr_t)&symdesc);
/*************************************************************************

View File

@ -57,7 +57,7 @@ static void modprint(FAR const char *fmt, ...);
* Private Data
****************************************************************************/
static const struct symtab_s g_exports[1] =
static const struct symtab_s g_modprint_exports[1] =
{
{
(FAR const char *)"modprint", (FAR const void *)modprint,
@ -109,7 +109,7 @@ int module_initialize(FAR struct mod_info_s *modinfo)
modinfo->uninitializer = module_uninitialize;
modinfo->arg = NULL;
modinfo->exports = g_exports;
modinfo->exports = g_modprint_exports;
modinfo->nexports = 1;
return OK;

View File

@ -72,7 +72,7 @@ static const char g_msg1[] = "Hello to you too!";
static const char g_msg2[] = "Not so bad so far.";
static const char g_msg3[] = "Yes, don't be a stranger!";
static const struct symtab_s g_exports[6] =
static const struct symtab_s g_sotest_exports[6] =
{
{
(FAR const char *)"testfunc1", (FAR const void *)testfunc1,
@ -171,7 +171,7 @@ int module_initialize(FAR struct mod_info_s *modinfo)
modinfo->uninitializer = module_uninitialize;
modinfo->arg = NULL;
modinfo->exports = g_exports;
modinfo->exports = g_sotest_exports;
modinfo->nexports = 6;
return OK;

View File

@ -24,7 +24,7 @@ echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H"
echo ""
echo "#include <nuttx/binfmt/symtab.h>"
echo ""
echo "static const struct symtab_s g_exports[] = "
echo "static const struct symtab_s g_thttpd_exports[] = "
echo "{"
for string in $varlist; do
@ -33,7 +33,7 @@ for string in $varlist; do
done
echo "};"
echo "#define NEXPORTS (sizeof(g_exports)/sizeof(struct symtab_s))"
echo "#define NEXPORTS (sizeof(g_thttpd_exports)/sizeof(struct symtab_s))"
echo ""
echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */"

View File

@ -338,7 +338,7 @@ int thttp_main(int argc, char *argv[])
/* Start THTTPD. At present, symbol table info is passed via global variables */
#ifdef CONFIG_THTTPD_NXFLAT
g_thttpdsymtab = g_exports;
g_thttpdsymtab = g_thttpd_exports;
g_thttpdnsymbols = NEXPORTS;
#endif