Change how wasm DWARF is inserted into artifacts (#5358)
This commit fixes a bug with components by changing how DWARF information from a wasm binary is copied over to the final compiled artifact. Note that this is not the Wasmtime-generated DWARF but rather the native wasm DWARF itself used in backtraces. Previously the wasm dwarf was inserted into sections `.*.wasm` where `*` was `debug_info`, `debug_str`, etc -- one per `gimli::SectionId` as found in the original wasm module. This does not work with components, however, where modules did not correctly separate their debug information into separate sections or otherwise disambiguate. The fix in this commit is to instead smash all the debug information together into one large section and store offsets into that giant section. This is similar to the `name`-section scraping or the trap metadata section where one section contains all the data for all the modules in a component. This simplifies the object file parsing by only looking for one section name and doesn't add all that much complexity to serializing and looking up dwarf information as well.
This commit is contained in:
@@ -119,3 +119,12 @@ pub const ELF_WASMTIME_INFO: &'static str = ".wasmtime.info";
|
||||
/// sometimes quite large (3MB seen for spidermonkey-compiled-to-wasm), can be
|
||||
/// paged in lazily from an mmap and is never paged in if we never reference it.
|
||||
pub const ELF_NAME_DATA: &'static str = ".name.wasm";
|
||||
|
||||
/// This is the name of the section in the final ELF image that contains the
|
||||
/// concatenation of all the native DWARF information found in the original wasm
|
||||
/// files.
|
||||
///
|
||||
/// This concatenation is not intended to be read by external tools at this time
|
||||
/// and is instead indexed directly by relative indices stored in compilation
|
||||
/// metadata.
|
||||
pub const ELF_WASMTIME_DWARF: &str = ".wasmtime.dwarf";
|
||||
|
||||
Reference in New Issue
Block a user