File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ function jit_calc() {
7070 object files when their content should have been changed by a change to cg_clif.</dd>
7171 <dt>CG_CLIF_DISPLAY_CG_TIME</dt>
7272 <dd>If "1", display the time it took to perform codegen for a crate</dd>
73+ <dt>CG_CLIF_FUNCTION_SECTIONS</dt>
74+ <dd>Use a single section for each function. This will often reduce the executable size at the
75+ cost of making linking significantly slower.</dd>
7376</dl >
7477
7578## Not yet supported
Original file line number Diff line number Diff line change @@ -186,13 +186,17 @@ pub(crate) type Backend =
186186 impl cranelift_module:: Backend < Product : AddConstructor + Emit + WriteDebugInfo > ;
187187
188188pub ( crate ) fn make_module ( sess : & Session , name : String ) -> Module < Backend > {
189+ let mut builder = ObjectBuilder :: new (
190+ crate :: build_isa ( sess, true ) ,
191+ name + ".o" ,
192+ cranelift_module:: default_libcall_names ( ) ,
193+ )
194+ . unwrap ( ) ;
195+ if std:: env:: var ( "CG_CLIF_FUNCTION_SECTIONS" ) . is_ok ( ) {
196+ builder. per_function_section ( true ) ;
197+ }
189198 let module: Module < ObjectBackend > = Module :: new (
190- ObjectBuilder :: new (
191- crate :: build_isa ( sess, true ) ,
192- name + ".o" ,
193- cranelift_module:: default_libcall_names ( ) ,
194- )
195- . unwrap ( ) ,
199+ builder,
196200 ) ;
197201 module
198202}
You can’t perform that action at this time.
0 commit comments