Skip to content

Support -Zmin-function-alignment #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bjorn3 opened this issue Jan 15, 2025 · 1 comment · Fixed by #1572
Closed

Support -Zmin-function-alignment #1555

bjorn3 opened this issue Jan 15, 2025 · 1 comment · Fixed by #1572
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Jan 15, 2025

This was added in rust-lang/rust#134030. This will require a minor change to cranelif-object to be able to increase the alignment at https://github.com/bytecodealliance/wasmtime/blob/7f9049b9df84a748d0f7b4024e29b26014923c28/cranelift/object/src/backend.rs#L378-L380

@bjorn3 bjorn3 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jan 15, 2025
@bjorn3
Copy link
Member Author

bjorn3 commented Mar 13, 2025

Once bytecodealliance/wasmtime#10391 is merged this can be implemented using:

diff --git a/src/lib.rs b/src/lib.rs
index caaa0696..bc8fba81 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -278,6 +278,12 @@ fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
 
     flags_builder.set("enable_llvm_abi_extensions", "true").unwrap();
 
+    if let Some(min_function_alignment) = sess.opts.unstable_opts.min_function_alignment {
+        flags_builder
+            .set("log2_min_function_alignment", &min_function_alignment.bytes().ilog2().to_string())
+            .unwrap();
+    }
+
     use rustc_session::config::OptLevel;
     match sess.opts.optimize {
         OptLevel::No => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant