diff options
| author | ruki <[email protected]> | 2025-12-14 22:41:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-14 22:41:35 +0800 |
| commit | cdfc65c451343242c4d007483da1ad4a6ba7fe84 (patch) | |
| tree | 192ce1f90e6eba1e08d84decc69dcbf1fd1e7b80 /core/src | |
| parent | d131da854a1f2b62fd26237b95f55441b1ea3b75 (diff) | |
fix compile error
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/binutils/elf/deplibs.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/binutils/elf/prefix.h | 11 | ||||
| -rw-r--r-- | core/src/xmake/binutils/elf/readsyms.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/binutils/mslib/readsyms.c | 2 |
4 files changed, 5 insertions, 16 deletions
diff --git a/core/src/xmake/binutils/elf/deplibs.c b/core/src/xmake/binutils/elf/deplibs.c index 6ee471af7..39c5625ed 100644 --- a/core/src/xmake/binutils/elf/deplibs.c +++ b/core/src/xmake/binutils/elf/deplibs.c @@ -173,7 +173,7 @@ static tb_bool_t xm_binutils_elf_deplibs_32(tb_stream_ref_t istream, tb_hize_t b if (dyn.d_tag == XM_ELF_DT_NEEDED || dyn.d_tag == XM_ELF_DT_SONAME || dyn.d_tag == XM_ELF_DT_AUXILIARY || dyn.d_tag == XM_ELF_DT_FILTER) { tb_char_t name[256]; - if (xm_binutils_elf_read_string(istream, base_offset + strtab_offset, dyn.d_un.d_val, name, sizeof(name)) && name[0]) { + if (xm_binutils_read_string(istream, base_offset + strtab_offset + dyn.d_un.d_val, name, sizeof(name)) && name[0]) { lua_pushinteger(lua, result_count + 1); lua_pushstring(lua, name); lua_settable(lua, -3); @@ -324,7 +324,7 @@ static tb_bool_t xm_binutils_elf_deplibs_64(tb_stream_ref_t istream, tb_hize_t b if (dyn.d_tag == XM_ELF_DT_NEEDED || dyn.d_tag == XM_ELF_DT_SONAME || dyn.d_tag == XM_ELF_DT_AUXILIARY || dyn.d_tag == XM_ELF_DT_FILTER) { tb_char_t name[256]; - if (xm_binutils_elf_read_string(istream, base_offset + strtab_offset, (tb_uint32_t)dyn.d_un.d_val, name, sizeof(name)) && name[0]) { + if (xm_binutils_read_string(istream, base_offset + strtab_offset + (tb_uint32_t)dyn.d_un.d_val, name, sizeof(name)) && name[0]) { lua_pushinteger(lua, result_count + 1); lua_pushstring(lua, name); lua_settable(lua, -3); diff --git a/core/src/xmake/binutils/elf/prefix.h b/core/src/xmake/binutils/elf/prefix.h index 4e61c4741..caf5ef1e3 100644 --- a/core/src/xmake/binutils/elf/prefix.h +++ b/core/src/xmake/binutils/elf/prefix.h @@ -277,17 +277,6 @@ static __tb_inline__ tb_bool_t xm_binutils_elf_is_64bit(tb_char_t const *arch) { * readsyms inline implementation */ -/* read string from ELF string table - * - * @param istream the input stream - * @param strtab_offset the string table offset - * @param offset the string offset - * @return the string (static buffer, valid until next call) - */ -static __tb_inline__ tb_bool_t xm_binutils_elf_read_string(tb_stream_ref_t istream, tb_uint64_t strtab_offset, tb_uint32_t offset, tb_char_t *name, tb_size_t name_size) { - return xm_binutils_read_string(istream, strtab_offset + offset, name, name_size); -} - /* get symbol type character (nm-style) from ELF symbol * * @param st_info the symbol info byte diff --git a/core/src/xmake/binutils/elf/readsyms.c b/core/src/xmake/binutils/elf/readsyms.c index 03756d240..770ead980 100644 --- a/core/src/xmake/binutils/elf/readsyms.c +++ b/core/src/xmake/binutils/elf/readsyms.c @@ -126,7 +126,7 @@ tb_bool_t xm_binutils_elf_read_symbols_32(tb_stream_ref_t istream, tb_hize_t bas // get symbol name tb_char_t name[256]; - if (!xm_binutils_elf_read_string(istream, base_offset + strtab_section.sh_offset, sym.st_name, name, sizeof(name)) || !name[0]) { + if (!xm_binutils_read_string(istream, base_offset + strtab_section.sh_offset + sym.st_name, name, sizeof(name)) || !name[0]) { continue; } @@ -253,7 +253,7 @@ tb_bool_t xm_binutils_elf_read_symbols_64(tb_stream_ref_t istream, tb_hize_t bas // get symbol name tb_char_t name[256]; - if (!xm_binutils_elf_read_string(istream, base_offset + strtab_section.sh_offset, sym.st_name, name, sizeof(name)) || !name[0]) { + if (!xm_binutils_read_string(istream, base_offset + strtab_section.sh_offset + sym.st_name, name, sizeof(name)) || !name[0]) { continue; } diff --git a/core/src/xmake/binutils/mslib/readsyms.c b/core/src/xmake/binutils/mslib/readsyms.c index de9dc9d62..55857bb58 100644 --- a/core/src/xmake/binutils/mslib/readsyms.c +++ b/core/src/xmake/binutils/mslib/readsyms.c @@ -331,7 +331,7 @@ tb_bool_t xm_binutils_mslib_read_symbols(tb_stream_ref_t istream, tb_hize_t base if (!has_symbols) { // check map - lua_pushinteger(lua, header_offset); + lua_pushinteger(lua, (lua_Integer)header_offset); lua_rawget(lua, map_idx); if (lua_istable(lua, -1)) { // convert list of names to list of {name=..., type="global"} |
