Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large .rela sections for debug info #9486

Open
SingleAccretion opened this issue Oct 19, 2024 · 1 comment
Open

Large .rela sections for debug info #9486

SingleAccretion opened this issue Oct 19, 2024 · 1 comment

Comments

@SingleAccretion
Copy link
Contributor

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.

@SingleAccretion SingleAccretion changed the title Large .rela. sections for debug sections Large .rela sections for debug sections Oct 19, 2024
@SingleAccretion SingleAccretion changed the title Large .rela sections for debug sections Large .rela sections for debug info Oct 19, 2024
@alexcrichton
Copy link
Member

Oh wow yeah those are huge! Definitely seems reasonable to remove as it's all local within the same binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants