Skip to content
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

Remove the automatic ISA assumption in the cranelift-codegen build.rs #8424

Open
lambdadeltakay opened this issue Apr 21, 2024 · 2 comments
Open

Comments

@lambdadeltakay
Copy link

lambdadeltakay commented Apr 21, 2024

Feature

Allow for specifiying no ISA targets and not failing to compile in the build.rs when no ISA targets are specified on a unsupported platform for code generation on cranelift-codegen

Benefit

This would allow for using cranelift related utilities on platforms like wasm or powerpc.

Implementation

This would require just removing the code in the build.rs that assumes the ISA target for generation when no ISA targets are specified

Alternatives

A possible alternative would be a feature flag that would specify that no ISA targets should be built in

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 21, 2024

I believe disabling the host-arch feature of cranelift-codegen will already do this.

@lambdadeltakay
Copy link
Author

// Don't require host isa if under 'all-arch' feature.
let host_isa = env::var("CARGO_FEATURE_HOST_ARCH").is_ok() && !all_arch;
if isas.is_empty() || host_isa {
// Try to match native target.
let target_name = target_triple.split('-').next().unwrap();
let isa = meta::isa_from_arch(&target_name).expect("error when identifying target");
println!("cargo:rustc-cfg=feature=\"{}\"", isa);
isas.push(isa);
}

From my experiments and these lines of code it doesn't seem to do this, instead I have to manually set at least one ISA that doesn't relate to the target to avoid a compile error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants