wasmtime
wasmtime copied to clipboard
Large `.rela` sections for debug info
Reproduction:
> wasmtime compile -D debug-info -O opt-level=0 wasm-with-di.wasm
> llvm-objdump wasm-with-di.cwasm
Expected result: the output does not contain an excessive number of relocations.
Actual result: there are lots of them:
8 .debug_abbrev 000704e1 0000000000000000 DEBUG
9 .debug_str 00164a48 0000000000000000 DEBUG
10 .debug_line 00247334 0000000000000000 DEBUG
11 .rela.debug_line 00055ef0 0000000000000000
12 .debug_ranges 0003e530 0000000000000000 DEBUG
13 .rela.debug_ranges 00097fb0 0000000000000000
14 .debug_loc 0062e922 0000000000000000 DEBUG
15 .rela.debug_loc 00cc02a0 0000000000000000
16 .debug_info 00200ebf 0000000000000000 DEBUG
17 .rela.debug_info 0065c958 0000000000000000
18 .debug_frame 0009ada8 0000000000000000 DEBUG
19 .rela.debug_frame 000abe40 0000000000000000
Looking at .debug_loc in particular, we can see the following for the very first location list:
> llvm-objdump -j .rela.debug_loc -x wasm-with-di.cwasm > rel.txt
RELOCATION RECORDS FOR [.debug_loc]:
OFFSET TYPE VALUE
0000000000000000 R_X86_64_64 wasm[0]::function[41]::_start+0x26
0000000000000008 R_X86_64_64 wasm[0]::function[41]::_start+0x5b
0000000000000013 R_X86_64_64 wasm[0]::function[41]::_start+0x5b
000000000000001b R_X86_64_64 wasm[0]::function[41]::_start+0x68
0000000000000026 R_X86_64_64 wasm[0]::function[41]::_start+0x68
000000000000002e R_X86_64_64 wasm[0]::function[41]::_start+0x91
0000000000000049 R_X86_64_64 wasm[0]::function[41]::_start+0x73
0000000000000051 R_X86_64_64 wasm[0]::function[41]::_start+0x81
000000000000005c R_X86_64_64 wasm[0]::function[41]::_start+0x81
0000000000000064 R_X86_64_64 wasm[0]::function[41]::_start+0x88
The debug info and code are part of the same 'object file' - much of this should be unnecessary.