mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Disable PIC when jitting
This fixes jitting on non-x86_64 targets.
This commit is contained in:
@@ -325,10 +325,8 @@ fn new(
|
||||
target_compiler.rustflags.extend(rustflags_from_env("RUSTFLAGS"));
|
||||
target_compiler.rustdocflags.extend(rustflags_from_env("RUSTDOCFLAGS"));
|
||||
|
||||
let jit_supported = use_unstable_features
|
||||
&& is_native
|
||||
&& target_compiler.triple.contains("x86_64")
|
||||
&& !target_compiler.triple.contains("windows");
|
||||
let jit_supported =
|
||||
use_unstable_features && is_native && !target_compiler.triple.contains("windows");
|
||||
|
||||
Self { is_native, jit_supported, skip_tests, dirs, target_compiler, stdlib_source }
|
||||
}
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ fn produce_final_output_artifacts(
|
||||
}
|
||||
|
||||
fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {
|
||||
let isa = crate::build_isa(sess);
|
||||
let isa = crate::build_isa(sess, false);
|
||||
|
||||
let mut builder =
|
||||
ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule<JITModule>, CodegenCx) {
|
||||
let crate_info = CrateInfo::new(tcx, "dummy_target_cpu".to_string());
|
||||
|
||||
let isa = crate::build_isa(tcx.sess);
|
||||
let isa = crate::build_isa(tcx.sess, true);
|
||||
let mut jit_builder = JITBuilder::with_isa(isa, cranelift_module::default_libcall_names());
|
||||
crate::compiler_builtins::register_functions_for_jit(&mut jit_builder);
|
||||
jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info));
|
||||
|
||||
+2
-2
@@ -250,13 +250,13 @@ fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
|
||||
fn build_isa(sess: &Session, jit: bool) -> Arc<dyn TargetIsa + 'static> {
|
||||
use target_lexicon::BinaryFormat;
|
||||
|
||||
let target_triple = crate::target_triple(sess);
|
||||
|
||||
let mut flags_builder = settings::builder();
|
||||
flags_builder.enable("is_pic").unwrap();
|
||||
flags_builder.set("is_pic", if jit { "false" } else { "true" }).unwrap();
|
||||
let enable_verifier = if enable_verifier(sess) { "true" } else { "false" };
|
||||
flags_builder.set("enable_verifier", enable_verifier).unwrap();
|
||||
flags_builder.set("regalloc_checker", enable_verifier).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user