Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

components: libc: fix pointer-to-integer cast warnings and address tr… #10019

Merged
merged 1 commit into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/libc/posix/libdl/dlelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
rt_memcpy(ptr,
(rt_uint8_t *)elf_module + shdr[index].sh_offset,
shdr[index].sh_size);
rodata_addr = (rt_uint32_t)ptr;
rodata_addr = (rt_ubase_t)ptr;
LOG_D("load rodata 0x%x, size %d, rodata 0x%x", ptr,
shdr[index].sh_size, *(rt_uint32_t *)data_addr);
shdr[index].sh_size, *(rt_ubase_t *)rodata_addr);
ptr += shdr[index].sh_size;
}

Expand All @@ -395,17 +395,17 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
rt_memcpy(ptr,
(rt_uint8_t *)elf_module + shdr[index].sh_offset,
shdr[index].sh_size);
data_addr = (rt_uint32_t)ptr;
data_addr = (rt_ubase_t)ptr;
LOG_D("load data 0x%x, size %d, data 0x%x", ptr,
shdr[index].sh_size, *(rt_uint32_t *)data_addr);
shdr[index].sh_size, *(rt_ubase_t *)data_addr);
ptr += shdr[index].sh_size;
}

/* load bss section */
if (IS_NOPROG(shdr[index]) && IS_AW(shdr[index]))
{
rt_memset(ptr, 0, shdr[index].sh_size);
bss_addr = (rt_uint32_t)ptr;
bss_addr = (rt_ubase_t)ptr;
LOG_D("load bss 0x%x, size %d", ptr, shdr[index].sh_size);
}
}
Expand Down
6 changes: 3 additions & 3 deletions components/libc/posix/libdl/dlmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,18 +837,18 @@ void dlmodule_exit(int ret_code)
* @brief search for a symbol by its name in the kernel symbol table.
*
* @param sym_str the symbol name string.
* @return rt_uint32_t On success, it returns the address of the symbol.
* @return rt_ubase_t On success, it returns the address of the symbol.
* Otherwise, it returns 0 (indicating the symbol was not found).
*/
rt_uint32_t dlmodule_symbol_find(const char *sym_str)
rt_ubase_t dlmodule_symbol_find(const char *sym_str)
{
/* find in kernel symbol table */
struct rt_module_symtab *index;

for (index = _rt_module_symtab_begin; index != _rt_module_symtab_end; index ++)
{
if (rt_strcmp(index->name, sym_str) == 0)
return (rt_uint32_t)index->addr;
return (rt_ubase_t)index->addr;
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion components/libc/posix/libdl/dlmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ void dlmodule_exit(int ret_code);

struct rt_dlmodule *dlmodule_find(const char *name);

rt_uint32_t dlmodule_symbol_find(const char *sym_str);
rt_ubase_t dlmodule_symbol_find(const char *sym_str);

#endif