summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-07 00:19:02 +0800
committerruki <[email protected]>2025-12-07 17:15:59 +0800
commit10bc661bedcd77f98993650a96f3fae476685bb3 (patch)
treeecef7a8842609cdb1b17082bdc59afdde030d1d6 /core/src
parent19451b8b7f31a3885011098792d5f9f98eba3401 (diff)
fix symbol size in coff
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/utils/bin2coff.c5
1 files 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) ||