diff options
| author | ruki <[email protected]> | 2025-12-07 19:43:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-07 19:43:34 +0800 |
| commit | 8e3cc0092d8e356c6387aee941825cf66615541c (patch) | |
| tree | 8e9d3cf29071bf65d3b0a097deadabe25245cacf | |
| parent | e17cc0cfe314d1e691d120d2dfa92f6c92790dff (diff) | |
add wasm support for bin2elf
| -rw-r--r-- | core/src/xmake/binutils/bin2elf.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/xmake/binutils/bin2elf.c b/core/src/xmake/binutils/bin2elf.c index 22339925c..a536143c4 100644 --- a/core/src/xmake/binutils/bin2elf.c +++ b/core/src/xmake/binutils/bin2elf.c @@ -47,6 +47,7 @@ #define XM_ELF_MACHINE_X86_64 0x3e #define XM_ELF_MACHINE_RISCV 0xf3 #define XM_ELF_MACHINE_ARM64 0xb7 +#define XM_ELF_MACHINE_WASM 0xe7 #define XM_ELF_MACHINE_LOONGARCH 0x102 #define XM_ELF_SHT_PROGBITS 0x1 @@ -196,6 +197,10 @@ static tb_uint16_t xm_binutils_bin2elf_get_machine(tb_char_t const *arch) { else if (tb_strncmp(arch, "loongarch", 9) == 0 || tb_strncmp(arch, "loong64", 7) == 0) { return XM_ELF_MACHINE_LOONGARCH; } + // WebAssembly (WASM and WASM64 use same machine type, distinguished by ELF class) + else if (tb_strncmp(arch, "wasm", 4) == 0) { + return XM_ELF_MACHINE_WASM; + } // SuperH else if (tb_strncmp(arch, "sh", 2) == 0 || tb_strncmp(arch, "superh", 6) == 0) { return XM_ELF_MACHINE_SUPERH; @@ -245,6 +250,10 @@ static tb_bool_t xm_binutils_bin2elf_is_64bit(tb_char_t const *arch) { else if (tb_strncmp(arch, "loongarch64", 11) == 0) { return tb_true; } + // WebAssembly 64 + else if (tb_strcmp(arch, "wasm64") == 0) { + return tb_true; + } // IA-64 else if (tb_strcmp(arch, "ia64") == 0 || tb_strcmp(arch, "itanium") == 0) { return tb_true; |
