11use crate :: error:: LucetcErrorKind ;
22use crate :: function_manifest:: { write_function_manifest, FUNCTION_MANIFEST_SYM } ;
33use crate :: name:: Name ;
4- use crate :: pointer:: NATIVE_POINTER_SIZE ;
54use crate :: stack_probe;
65use crate :: table:: { link_tables, TABLE_SYM } ;
76use crate :: traps:: write_trap_tables;
@@ -10,7 +9,9 @@ use cranelift_codegen::{ir, isa};
109use cranelift_faerie:: FaerieProduct ;
1110use faerie:: { Artifact , Decl , Link } ;
1211use failure:: { format_err, Error , ResultExt } ;
13- use lucet_module:: { FunctionSpec , VersionInfo , LUCET_MODULE_SYM , MODULE_DATA_SYM } ;
12+ use lucet_module:: {
13+ FunctionSpec , SerializedModule , VersionInfo , LUCET_MODULE_SYM , MODULE_DATA_SYM ,
14+ } ;
1415use std:: collections:: HashMap ;
1516use std:: fs:: File ;
1617use std:: io:: { Cursor , Write } ;
@@ -136,7 +137,7 @@ fn write_module(
136137 function_manifest_len : usize ,
137138 obj : & mut Artifact ,
138139) -> Result < ( ) , Error > {
139- let mut native_data = Cursor :: new ( Vec :: with_capacity ( 16 + NATIVE_POINTER_SIZE * 4 ) ) ;
140+ let mut native_data = Cursor :: new ( Vec :: with_capacity ( std :: mem :: size_of :: < SerializedModule > ( ) ) ) ;
140141 obj. declare ( LUCET_MODULE_SYM , Decl :: data ( ) . global ( ) )
141142 . context ( format ! ( "declaring {}" , LUCET_MODULE_SYM ) ) ?;
142143
0 commit comments