From 10bc661bedcd77f98993650a96f3fae476685bb3 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 7 Dec 2025 00:19:02 +0800 Subject: fix symbol size in coff --- core/src/xmake/utils/bin2coff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/xmake/utils/bin2coff.c b/core/src/xmake/utils/bin2coff.c index 24c7d1b2a..076dd50cd 100644 --- a/core/src/xmake/utils/bin2coff.c +++ b/core/src/xmake/utils/bin2coff.c @@ -309,11 +309,12 @@ static tb_bool_t xm_utils_bin2coff_dump(tb_stream_ref_t istream, } // symbol 3: _binary_xxx_size + // Note: use section symbol instead of absolute symbol to avoid relocation issues xm_utils_bin2coff_write_symbol_name(ostream, symbol_size, &strtab_offset); tb_uint32_t sym_size_value = datasize; - tb_int16_t sym_size_sect = -1; // absolute symbol + tb_int16_t sym_size_sect = 1; // same section as data tb_uint16_t sym_size_type = 0; - tb_uint8_t sym_size_scl = 2; + tb_uint8_t sym_size_scl = 2; // IMAGE_SYM_CLASS_EXTERNAL tb_uint8_t sym_size_naux = 0; if (!tb_stream_bwrit(ostream, (tb_byte_t const *)&sym_size_value, 4) || !tb_stream_bwrit(ostream, (tb_byte_t const *)&sym_size_sect, 2) || -- cgit v1.3.1