summaryrefslogtreecommitdiff
path: root/core/src/xmake/binutils/readsyms.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/xmake/binutils/readsyms.c')
-rw-r--r--core/src/xmake/binutils/readsyms.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/src/xmake/binutils/readsyms.c b/core/src/xmake/binutils/readsyms.c
index e29010314..2c119a538 100644
--- a/core/src/xmake/binutils/readsyms.c
+++ b/core/src/xmake/binutils/readsyms.c
@@ -41,6 +41,7 @@ extern tb_bool_t xm_binutils_elf_read_symbols(tb_stream_ref_t istream, tb_hize_t
extern tb_bool_t xm_binutils_macho_read_symbols(tb_stream_ref_t istream, tb_hize_t base_offset, lua_State *lua);
extern tb_bool_t xm_binutils_ar_read_symbols(tb_stream_ref_t istream, tb_hize_t base_offset, lua_State *lua);
extern tb_bool_t xm_binutils_mslib_read_symbols(tb_stream_ref_t istream, tb_hize_t base_offset, lua_State *lua);
+extern tb_bool_t xm_binutils_wasm_read_symbols(tb_stream_ref_t istream, tb_hize_t base_offset, lua_State *lua);
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
@@ -62,7 +63,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
tb_stream_ref_t istream = tb_stream_init_from_file(objectfile, TB_FILE_MODE_RO);
if (!istream) {
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: open %s failed", objectfile);
+ lua_pushfstring(lua, "open %s failed", objectfile);
return 2;
}
@@ -70,7 +71,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
do {
if (!tb_stream_open(istream)) {
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: open %s failed", objectfile);
+ lua_pushfstring(lua, "open %s failed", objectfile);
break;
}
@@ -78,7 +79,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
tb_int_t format = xm_binutils_format_detect(istream);
if (format < 0) {
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: cannot detect file format");
+ lua_pushfstring(lua, "cannot detect file format");
break;
}
@@ -101,14 +102,14 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
// fallback to ar
if (!xm_binutils_ar_read_symbols(istream, 0, lua)) {
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: read AR/MSLIB archive symbols failed");
+ lua_pushfstring(lua, "read AR/MSLIB archive symbols failed");
break;
}
}
} else {
if (!xm_binutils_ar_read_symbols(istream, 0, lua)) {
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: read AR archive symbols failed");
+ lua_pushfstring(lua, "read AR archive symbols failed");
break;
}
}
@@ -140,6 +141,8 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
read_ok = xm_binutils_elf_read_symbols(istream, 0, lua);
} else if (format == XM_BINUTILS_FORMAT_MACHO) {
read_ok = xm_binutils_macho_read_symbols(istream, 0, lua);
+ } else if (format == XM_BINUTILS_FORMAT_WASM) {
+ read_ok = xm_binutils_wasm_read_symbols(istream, 0, lua);
}
if (read_ok) {
@@ -148,7 +151,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) {
} else {
lua_pop(lua, 2); // pop entry table and result list
lua_pushboolean(lua, tb_false);
- lua_pushfstring(lua, "readsyms: read symbols failed");
+ lua_pushfstring(lua, "read symbols failed");
break;
}
}