Fix error: Mixed case identifier found

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-07-09 06:16:11 +08:00 committed by Petro Karashchenko
parent ebcb03dce9
commit 9dc59e9109
5 changed files with 73 additions and 65 deletions

View File

@ -27,6 +27,7 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <nuttx/symtab.h>
#include <stdint.h>
#include <arch/stm32/chip.h>

View File

@ -7,7 +7,7 @@
#
# Find an entrypoint using a binary search
#
findEP()
findep()
{
CHECK=$1
SIZE=${#SYM[@]}
@ -50,7 +50,7 @@ getEP()
FUNC=(${FUNCS})
for ((j = 0; j < ${#FUNC[@]}; j++))
do
findEP ${FUNC[$j]}
findep ${FUNC[$j]}
if [ $? -eq 1 ]; then
EP[${I_EP}]=${FUNC[$j]}
I_EP=$((I_EP + 1))
@ -63,7 +63,7 @@ getEP()
#
# Symbols to ignore within the NuttX libraries
#
FILTER="^lib_low|^FUNCTION|^STUB|^__start|^_vect|^arm_|^arp_|^bch|^binfmt|^blake|^block_|^cdcacm|^chksum|^clock_|^close_|^crypto_|^devif_|^devnull|^devuran|^devzero|^emerg|^epoll_|^elf_|^_dbgR|^dq_|^env_|^file_|^files_|^fs_|^ftl_|^g_|^get_|^group_|^global|^hcom|^i2c_|^inode_|^iob_|^irq_|^kmm_|^lfs_|^lib_|^local_|^mm_|^modlib_|^mpu_|^mq_|^nGlobals|^net_|^netdev_|^nx|^pipecommon|^posix_spawn_file|^psock_|^ramlog|^rammap|^readline_|^register_|^sched_|^sockfd|^spawn_|^sq_|^stm32|^symtab_|^syslog_|^syslogstream|^task_|^tcp_|^timer_|^uart_|^ub[12]|^udp_|^umm_|^umount|^unload_|^unregister|^up_|^usb|^usrsock_|^watchdog|^wd_|globalNames$|nGlobals$|globalTable$|^\.l"
FILTER="^lib_low|^FUNCTION|^STUB|^__start|^_vect|^arm_|^arp_|^bch|^binfmt|^blake|^block_|^cdcacm|^chksum|^clock_|^close_|^crypto_|^devif_|^devnull|^devuran|^devzero|^emerg|^epoll_|^elf_|^_dbgR|^dq_|^env_|^file_|^files_|^fs_|^ftl_|^g_|^get_|^group_|^global|^hcom|^i2c_|^inode_|^iob_|^irq_|^kmm_|^lfs_|^lib_|^local_|^mm_|^modlib_|^mpu_|^mq_|^nglobals|^net_|^netdev_|^nx|^pipecommon|^posix_spawn_file|^psock_|^ramlog|^rammap|^readline_|^register_|^sched_|^sockfd|^spawn_|^sq_|^stm32|^symtab_|^syslog_|^syslogstream|^task_|^tcp_|^timer_|^uart_|^ub[12]|^udp_|^umm_|^umount|^unload_|^unregister|^up_|^usb|^usrsock_|^watchdog|^wd_|globalNames$|nglobals$|global_table$|^\.l"
if [ -z "${NM}" ]; then
NM="nm"
@ -170,14 +170,14 @@ cat >>${GLOBALS} <<__EOF__
SIZE globalNames
.align ALIGN
GLOBAL nGlobals
SYMBOL(nGlobals):
GLOBAL nglobals
SYMBOL(nglobals):
.word ${#EP[@]}
SIZE nGlobals
SIZE nglobals
.align ALIGN
GLOBAL globalTable
SYMBOL(globalTable):
GLOBAL global_table
SYMBOL(global_table):
__EOF__
for ((i = 0; i < ${#EP[@]}; i++))
@ -186,7 +186,7 @@ do
done
cat >>${GLOBALS} <<__EOF__
SIZE globalTable
SIZE global_table
__EOF__
echo "${#EP[@]} symbols defined"

View File

@ -188,26 +188,26 @@ struct mod_loadinfo_s
* after the module has been loaded.
*/
uintptr_t textalloc; /* .text memory allocated when module was loaded */
uintptr_t datastart; /* Start of.bss/.data memory in .text allocation */
size_t textsize; /* Size of the module .text memory allocation */
size_t datasize; /* Size of the module .bss/.data memory allocation */
size_t textalign; /* Necessary alignment of .text */
size_t dataalign; /* Necessary alignment of .bss/.text */
off_t filelen; /* Length of the entire module file */
Elf_Ehdr ehdr; /* Buffered module file header */
FAR Elf_Phdr *phdr; /* Buffered module program headers */
FAR Elf_Shdr *shdr; /* Buffered module section headers */
FAR void *exported; /* Module exports */
uint8_t *iobuffer; /* File I/O buffer */
uintptr_t datasec; /* ET_DYN - data area start from Phdr */
uintptr_t segpad; /* Padding between text and data */
uint16_t symtabidx; /* Symbol table section index */
uint16_t strtabidx; /* String table section index */
uint16_t dsymtabidx; /* Dynamic symbol table section index */
uint16_t buflen; /* size of iobuffer[] */
int filfd; /* Descriptor for the file being loaded */
int nexports; /* ET_DYN - Number of symbols exported */
uintptr_t textalloc; /* .text memory allocated when module was loaded */
uintptr_t datastart; /* Start of.bss/.data memory in .text allocation */
size_t textsize; /* Size of the module .text memory allocation */
size_t datasize; /* Size of the module .bss/.data memory allocation */
size_t textalign; /* Necessary alignment of .text */
size_t dataalign; /* Necessary alignment of .bss/.text */
off_t filelen; /* Length of the entire module file */
Elf_Ehdr ehdr; /* Buffered module file header */
FAR Elf_Phdr *phdr; /* Buffered module program headers */
FAR Elf_Shdr *shdr; /* Buffered module section headers */
FAR void *exported; /* Module exports */
uint8_t *iobuffer; /* File I/O buffer */
uintptr_t datasec; /* ET_DYN - data area start from Phdr */
uintptr_t segpad; /* Padding between text and data */
uint16_t symtabidx; /* Symbol table section index */
uint16_t strtabidx; /* String table section index */
uint16_t dsymtabidx; /* Dynamic symbol table section index */
uint16_t buflen; /* size of iobuffer[] */
int filfd; /* Descriptor for the file being loaded */
int nexports; /* ET_DYN - Number of symbols exported */
};
/****************************************************************************

View File

@ -66,12 +66,12 @@ SYMBOL(globalNames):
SIZE globalNames
.align ALIGN
GLOBAL nGlobals
SYMBOL(nGlobals):
GLOBAL nglobals
SYMBOL(nglobals):
.word 0
SIZE nGlobals
SIZE nglobals
.align ALIGN
GLOBAL globalTable
SYMBOL(globalTable):
SIZE globalTable
GLOBAL global_table
SYMBOL(global_table):
SIZE global_table

View File

@ -57,12 +57,19 @@ struct mod_exportinfo_s
FAR const struct symtab_s *symbol; /* Symbol info returned (if found) */
};
struct epTable_s
struct eptable_s
{
uint8_t *epName; /* Name of global symbol */
void *epAddr; /* Address of global symbol */
FAR uint8_t *epname; /* Name of global symbol */
FAR void *epaddr; /* Address of global symbol */
};
/****************************************************************************
* Public Data
****************************************************************************/
extern struct eptable_s global_table[];
extern int nglobals;
/****************************************************************************
* Private Functions
****************************************************************************/
@ -456,12 +463,12 @@ int modlib_insertsymtab(FAR struct module_s *modp,
FAR Elf_Shdr *shdr, FAR Elf_Sym *sym)
{
FAR struct symtab_s *symbol;
FAR Elf_Shdr *strTab = &loadinfo->shdr[shdr->sh_link];
FAR Elf_Shdr *strtab = &loadinfo->shdr[shdr->sh_link];
int ret = 0;
int i;
int j;
int nSym;
int symCount;
int nsym;
int symcount;
if (modp->modinfo.exports != NULL)
{
@ -471,28 +478,28 @@ int modlib_insertsymtab(FAR struct module_s *modp,
/* Count the "live" symbols */
nSym = shdr->sh_size / sizeof(Elf_Sym);
for (i = 0, symCount = 0; i < nSym; i++)
nsym = shdr->sh_size / sizeof(Elf_Sym);
for (i = 0, symcount = 0; i < nsym; i++)
{
if (sym[i].st_name != 0)
symCount++;
symcount++;
}
if (symCount > 0)
if (symcount > 0)
{
modp->modinfo.exports = symbol =
loadinfo->exported =
lib_malloc(sizeof(*symbol) * symCount);
lib_malloc(sizeof(*symbol) * symcount);
if (modp->modinfo.exports)
{
/* Build out module's symbol table */
modp->modinfo.nexports = symCount;
for (i = 0, j = 0; i < nSym; i++)
modp->modinfo.nexports = symcount;
for (i = 0, j = 0; i < nsym; i++)
{
if (sym[i].st_name != 0)
{
ret = modlib_symname(loadinfo, &sym[i], strTab->sh_offset);
ret = modlib_symname(loadinfo, &sym[i], strtab->sh_offset);
if (ret < 0)
{
lib_free((FAR void *) modp->modinfo.exports);
@ -517,7 +524,7 @@ int modlib_insertsymtab(FAR struct module_s *modp,
}
/****************************************************************************
* Name: findEP
* Name: findep
*
* Description:
* Binary search comparison function
@ -528,11 +535,11 @@ int modlib_insertsymtab(FAR struct module_s *modp,
*
****************************************************************************/
static int findEP(const void *c1, const void *c2)
static int findep(FAR const void *c1, FAR const void *c2)
{
const struct epTable_s *m1 = (struct epTable_s *) c1;
const struct epTable_s *m2 = (struct epTable_s *) c2;
return strcmp((FAR const char *)m1->epName, (FAR const char *)m2->epName);
FAR const struct eptable_s *m1 = (FAR const struct eptable_s *)c1;
FAR const struct eptable_s *m2 = (FAR const struct eptable_s *)c2;
return strcmp((FAR const char *)m1->epname, (FAR const char *)m2->epname);
}
/****************************************************************************
@ -547,26 +554,26 @@ static int findEP(const void *c1, const void *c2)
****************************************************************************/
void *modlib_findglobal(FAR struct module_s *modp,
struct mod_loadinfo_s *loadinfo,
FAR struct mod_loadinfo_s *loadinfo,
FAR Elf_Shdr *shdr, FAR Elf_Sym *sym)
{
FAR Elf_Shdr *strTab = &loadinfo->shdr[shdr->sh_link];
FAR Elf_Shdr *strtab = &loadinfo->shdr[shdr->sh_link];
int ret;
struct epTable_s key;
struct epTable_s *res;
extern struct epTable_s globalTable[];
extern int nGlobals;
struct eptable_s key;
FAR struct eptable_s *res;
ret = modlib_symname(loadinfo, sym, strTab->sh_offset);
ret = modlib_symname(loadinfo, sym, strtab->sh_offset);
if (ret < 0)
{
return NULL;
}
key.epName = loadinfo->iobuffer;
res = bsearch(&key, globalTable, nGlobals,
sizeof(struct epTable_s), findEP);
key.epname = loadinfo->iobuffer;
res = bsearch(&key, global_table, nglobals,
sizeof(struct eptable_s), findep);
if (res != NULL)
{
return res->epAddr;
return res->epaddr;
}
else
{