@@ -225,9 +225,12 @@ pub struct ProjectConfig {
225225 /// and instead assumes that all symbols are known.
226226 #[ serde( default , skip_serializing_if = "is_default" ) ]
227227 pub symbols_known : bool ,
228- /// Fills gaps between symbols with
228+ /// Fills gaps between symbols to avoid linker realignment.
229229 #[ serde( default = "bool_true" , skip_serializing_if = "is_true" ) ]
230230 pub fill_gaps : bool ,
231+ /// Marks all emitted symbols as "force active" to prevent the linker from removing them.
232+ #[ serde( default = "bool_true" , skip_serializing_if = "is_true" ) ]
233+ pub auto_force_active : bool ,
231234}
232235
233236#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
@@ -859,7 +862,7 @@ fn split_write_obj(
859862 entry,
860863 } ;
861864 for ( unit, split_obj) in module. obj . link_order . iter ( ) . zip ( & split_objs) {
862- let out_obj = write_elf ( split_obj) ?;
865+ let out_obj = write_elf ( split_obj, config . auto_force_active ) ?;
863866 let out_path = obj_dir. join ( obj_path_for_unit ( & unit. name ) ) ;
864867 out_config. units . push ( OutputUnit {
865868 object : out_path. clone ( ) ,
@@ -1763,6 +1766,7 @@ fn config(args: ConfigArgs) -> Result<()> {
17631766 common_start : None ,
17641767 symbols_known : false ,
17651768 fill_gaps : true ,
1769+ auto_force_active : true ,
17661770 } ;
17671771
17681772 let mut modules = Vec :: < ( u32 , ModuleConfig ) > :: new ( ) ;
0 commit comments