Add option to use a single section for each function
This commit is contained in:
parent
e5437b650b
commit
a0f8765251
2 changed files with 13 additions and 6 deletions
|
@ -70,6 +70,9 @@ function jit_calc() {
|
||||||
object files when their content should have been changed by a change to cg_clif.</dd>
|
object files when their content should have been changed by a change to cg_clif.</dd>
|
||||||
<dt>CG_CLIF_DISPLAY_CG_TIME</dt>
|
<dt>CG_CLIF_DISPLAY_CG_TIME</dt>
|
||||||
<dd>If "1", display the time it took to perform codegen for a crate</dd>
|
<dd>If "1", display the time it took to perform codegen for a crate</dd>
|
||||||
|
<dt>CG_CLIF_FUNCTION_SECTIONS</dt>
|
||||||
|
<dd>Use a single section for each function. This will often reduce the executable size at the
|
||||||
|
cost of making linking significantly slower.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
## Not yet supported
|
## Not yet supported
|
||||||
|
|
|
@ -186,13 +186,17 @@ pub(crate) type Backend =
|
||||||
impl cranelift_module::Backend<Product: AddConstructor + Emit + WriteDebugInfo>;
|
impl cranelift_module::Backend<Product: AddConstructor + Emit + WriteDebugInfo>;
|
||||||
|
|
||||||
pub(crate) fn make_module(sess: &Session, name: String) -> Module<Backend> {
|
pub(crate) fn make_module(sess: &Session, name: String) -> Module<Backend> {
|
||||||
|
let mut builder = ObjectBuilder::new(
|
||||||
|
crate::build_isa(sess, true),
|
||||||
|
name + ".o",
|
||||||
|
cranelift_module::default_libcall_names(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
if std::env::var("CG_CLIF_FUNCTION_SECTIONS").is_ok() {
|
||||||
|
builder.per_function_section(true);
|
||||||
|
}
|
||||||
let module: Module<ObjectBackend> = Module::new(
|
let module: Module<ObjectBackend> = Module::new(
|
||||||
ObjectBuilder::new(
|
builder,
|
||||||
crate::build_isa(sess, true),
|
|
||||||
name + ".o",
|
|
||||||
cranelift_module::default_libcall_names(),
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
);
|
);
|
||||||
module
|
module
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue