When the debug info contains a relocation against a dead symbol, wasm-ld emits a range-list terminator entry (an entry with Start==0 and End==0).
This is not correct, because it incorrectly terminates the range list of that compilation unit, hiding the valid range entries that come after that invalid entry.
The behavior is different when compiling to native, in that case we get entries with Start==0 and End > 0:
.debug_ranges section
00004280 0000000000231030 000000000023105a
00004280 0000000000000000 0000000000000024
00004280 0000000000000000 000000000000007a
00004280 0000000000231060 00000000002310a7
...
while with Wasm we see range entries (0, 0) that spuriously terminate the sequence:
.debug_ranges contents:
00000000 000002ef 0000032d
00000000 00000357 00000360
00000000 <End of list>
00000028 000004ba 000004ff
00000028 00000576 000005c1
00000028 <End of list>
...
This patch fixes this problem by emitting the WasmRelocation Addend as End value for a non-live symbol.