summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-09 00:42:58 +0800
committerruki <[email protected]>2025-12-09 00:42:58 +0800
commitb5b4ed3cf17b9c3d11e24d16e3fe692377ecaf95 (patch)
tree5cc29ee3ae2db2255b5275a54ae9fa5cf0faf577 /core/src
parentd48b2fcf37ed5c323d8e2d2d407bda9679dc01dc (diff)
fix dump elf symbols
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/binutils/elf/readsyms.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/core/src/xmake/binutils/elf/readsyms.c b/core/src/xmake/binutils/elf/readsyms.c
index 6a9f333c7..f0d0a1061 100644
--- a/core/src/xmake/binutils/elf/readsyms.c
+++ b/core/src/xmake/binutils/elf/readsyms.c
@@ -129,8 +129,14 @@ tb_bool_t xm_binutils_elf_read_symbols_32(tb_stream_ref_t istream, lua_State *lu
continue;
}
- // skip internal symbols (starting with .)
- if (name[0] == '.') {
+ // skip internal symbols (starting with . or $)
+ if (name[0] == '.' || name[0] == '$') {
+ continue;
+ }
+
+ // skip local symbols (unless undefined)
+ tb_uint8_t bind = (sym.st_info >> 4) & 0xf;
+ if (bind == 0 && sym.st_shndx != 0) { // STB_LOCAL and not undefined
continue;
}
@@ -250,8 +256,14 @@ tb_bool_t xm_binutils_elf_read_symbols_64(tb_stream_ref_t istream, lua_State *lu
continue;
}
- // skip internal symbols (starting with .)
- if (name[0] == '.') {
+ // skip internal symbols (starting with . or $)
+ if (name[0] == '.' || name[0] == '$') {
+ continue;
+ }
+
+ // skip local symbols (unless undefined)
+ tb_uint8_t bind = (sym.st_info >> 4) & 0xf;
+ if (bind == 0 && sym.st_shndx != 0) { // STB_LOCAL and not undefined
continue;
}