Set object_format when creating module_infos

This commit is contained in:
Felix Schütt
2022-12-30 11:07:33 +01:00
parent 9df3d955f3
commit cbc0775db6

View File

@@ -201,7 +201,7 @@ impl CreateExe {
AllowMultiWasm::Allow,
self.debug_dir.is_some(),
)?;
get_module_infos(&tempdir, &atoms)?;
get_module_infos(&tempdir, &atoms, object_format)?;
let mut entrypoint = get_entrypoint(&tempdir)?;
create_header_files_in_dir(&tempdir, &mut entrypoint, &atoms, &self.precompiled_atom)?;
link_exe_from_dir(
@@ -231,7 +231,7 @@ impl CreateExe {
&self.precompiled_atom,
self.debug_dir.is_some(),
)?;
get_module_infos(&tempdir, &atoms)?;
get_module_infos(&tempdir, &atoms, object_format)?;
let mut entrypoint = get_entrypoint(&tempdir)?;
create_header_files_in_dir(&tempdir, &mut entrypoint, &atoms, &self.precompiled_atom)?;
link_exe_from_dir(
@@ -917,6 +917,7 @@ pub(super) fn prepare_directory_from_single_wasm_file(
fn get_module_infos(
directory: &Path,
atoms: &[(String, Vec<u8>)],
object_format: ObjectFormat,
) -> Result<BTreeMap<String, ModuleInfo>, anyhow::Error> {
let mut entrypoint =
get_entrypoint(directory).with_context(|| anyhow::anyhow!("get module infos"))?;
@@ -936,6 +937,8 @@ fn get_module_infos(
}
}
entrypoint.object_format = object_format;
write_entrypoint(directory, &entrypoint)?;
Ok(module_infos)