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

Don't emit empty DWARF sections #284

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Conversation

daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Nov 29, 2024

This change prevents empty custom sections for debug information to be generated when no debug information is available. fallible-iterator is not a new dependency, it is a dependency of gimli, but is not re-exported.

Not only are a bunch of empty custom sections undesirable, seemingly wasm-opt had issues parsing those. I'm unsure if this is a bug or not, I don't know if completely empty DWARF sections are valid or not.

This will enable wasm-bindgen to stop throwing away the debug information if its available.

See rustwasm/wasm-bindgen#3876.

@philipc
Copy link

philipc commented Nov 29, 2024

While empty DWARF sections shouldn't be a problem, it's pointless to emit them. This applies even if some DWARF sections have data and others don't. So I think it would be better to skip the following if data is empty:

cx.wasm_module.section(&wasm_encoder::CustomSection {
name: id.name().into(),
data: data.slice().into(),
});

@daxpedda
Copy link
Contributor Author

While empty DWARF sections shouldn't be a problem, it's pointless to emit them. This applies even if some DWARF sections have data and others don't. So I think it would be better to skip the following if data is empty:

Ha, this is actually what I had implemented initially.
Will do that then, thank you!

@guybedford guybedford merged commit 94522dc into rustwasm:main Dec 2, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

3 participants